]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: generalize ir/mknode.go
authorMatthew Dempsky <mdempsky@google.com>
Tue, 29 Dec 2020 23:36:48 +0000 (15:36 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 30 Dec 2020 03:38:02 +0000 (03:38 +0000)
commit499851bac88dfa2a85c39a2123f092071098cada
treeed775cad0639a93e130f2cec89f1046237bfc002
parent82ab3d1448ee19ebf464297660ed1bc54aa2f3e6
[dev.regabi] cmd/compile: generalize ir/mknode.go

This CL generalizes ir/mknode.go to get rid of most of almost all of
its special cases for node field types. The only remaining speciale
case now is Field, which doesn't implement Node any more, but perhaps
should.

To help with removing special cases, node fields can now be tagged
with `mknode:"-"` so that mknode ignores them when generating its
helper methods. Further, to simplify skipping all of the orig fields,
a new origNode helper type is added which declares an orig field
marked as `mknode:"-"` and also provides the Orig and SetOrig methods
needed to implement the OrigNode interface.

Passes toolstash -cmp.

Change-Id: Ic68d4f0a9d2ef6e57e9fe87cdc641e5c4859830b
Reviewed-on: https://go-review.googlesource.com/c/go/+/280674
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/ir/copy.go
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/func.go
src/cmd/compile/internal/ir/mknode.go
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/ir/stmt.go
src/cmd/compile/internal/ir/type.go
src/cmd/compile/internal/ir/visit.go