]> Cypherpunks repositories - gostls13.git/commit
[dev.regabi] cmd/compile: move Node.Opt to Name
authorMatthew Dempsky <mdempsky@google.com>
Tue, 29 Dec 2020 01:30:04 +0000 (17:30 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 29 Dec 2020 07:45:00 +0000 (07:45 +0000)
commit289da2b33ed6292c853017a15d3108d22ea7491a
treec884852f4e10cb51c45d42795b086f86d856f416
parent6acbae4fcc640715efd01cb161a65e1e04fda3cb
[dev.regabi] cmd/compile: move Node.Opt to Name

Escape analysis uses Node.Opt to map nodes to their "location", so
that other references to the same node use the same location
again. But in the current implementation of escape analysis, we never
need to refer back to a node's location except for named nodes (since
other nodes are anonymous, and have no way to be referenced).

This CL moves Opt from Node down to Name, turns it into a directly
accessed field, and cleans up escape analysis to avoid setting Opt on
non-named expressions.

One nit: in walkCheckPtrArithmetic, we were abusing Opt as a way to
detect/prevent loops. This CL adds a CheckPtr bit flag instead.

Passes toolstash -cmp.

Change-Id: If57d5ad8d972fa63bedbe69b9ebb6753e31aba85
Reviewed-on: https://go-review.googlesource.com/c/go/+/280638
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/escape/escape.go
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/mini.go
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/walk/convert.go
src/cmd/compile/internal/walk/walk.go