]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: cleanup label handling
authorRuss Cox <rsc@golang.org>
Sat, 28 Nov 2020 04:52:37 +0000 (23:52 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 30 Nov 2020 18:33:47 +0000 (18:33 +0000)
commit65f4ec2faec54b7a3e70f2404132df9d83df11e0
treeed1812824b1d385c28bc04b565f961c30fbcd9bc
parent88e33f6ecb9ea44a464bd3863f8037bc081b2a6e
[dev.regabi] cmd/compile: cleanup label handling

- The use of a label's Name.Defn to point at the named for/select/switch
  means that any rewrite of the for/select/switch must overwrite the original
  or else the pointer will dangle. Remove that pointer by adding the label
  name directly to the for/select/switch representation instead.

- The only uses of a label's Sym.Label were ephemeral values during
  markbreak and escape analysis. Use a map for each. Although in general
  we are not going to replace all computed fields with maps (too slow),
  the one in markbreak is only for labeled for/select/switch, and the one
  in escape is for all labels, but even so, labels are fairly rare.

In theory this cleanup should make it easy to allow labeled for/select/switch
in inlined bodies, but this CL does not attempt that. It's only concerned
with cleanup to enable a new Node representation.

Passes buildall w/ toolstash -cmp.

Change-Id: I7e36ee98d2ea40dbae94e6722d585f007b7afcfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/274086
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/types/sizeof_test.go
src/cmd/compile/internal/types/sym.go