]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: introduce IR visitors
authorRuss Cox <rsc@golang.org>
Thu, 3 Dec 2020 17:57:38 +0000 (12:57 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 4 Dec 2020 16:52:48 +0000 (16:52 +0000)
commit0d1b44c6457bcfad611252175934e82f73440475
treebc5670fc842bfa2fa89f33526549f68ffea3339f
parent7fcf5b994cf24dc7eda4d65d448e25489dd357f6
[dev.regabi] cmd/compile: introduce IR visitors

This CL introduces the general visitor functionality that will replace
the Left, SetLeft, Right, SetRight, etc methods in the Node interface.

For now, the CL defines the functionality in terms of those methods,
but eventually the Nodes themselves will implement DoChildren
and EditChildren and be relieved of implementing Left, SetLeft, and so on.

The CL also updates Inspect (which moved to visit.go) and DeepCopy
to use the new functionality.

The Find helper is not used in this CL but will be used in a future one.

Passes buildall w/ toolstash -cmp.

Change-Id: Id0eea654a884ab3ea25f48bd8bdd71712b5dcb44
Reviewed-on: https://go-review.googlesource.com/c/go/+/275311
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/ir/copy.go
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/ir/visit.go [new file with mode: 0644]