cmd/compile/internal/gc: represent labels as bare Syms

Avoids allocating an ONAME for OLABEL, OGOTO, and named OBREAK and
OCONTINUE nodes.

Passes toolstash-check.

Change-Id: I359142cd48e8987b5bf29ac100752f8c497261c1
Reviewed-on: https://go-review.googlesource.com/c/145200
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2018-10-26 20:10:23 -07:00
parent c68e3bcb03
commit 2dda040f19
11 changed files with 47 additions and 39 deletions

View file

@ -234,7 +234,7 @@ func lookupN(prefix string, n int) *types.Sym {
// to help with debugging.
// It should begin with "." to avoid conflicts with
// user labels.
func autolabel(prefix string) *Node {
func autolabel(prefix string) *types.Sym {
if prefix[0] != '.' {
Fatalf("autolabel prefix must start with '.', have %q", prefix)
}
@ -244,7 +244,7 @@ func autolabel(prefix string) *Node {
}
n := fn.Func.Label
fn.Func.Label++
return newname(lookupN(prefix, int(n)))
return lookupN(prefix, int(n))
}
func restrictlookup(name string, pkg *types.Pkg) *types.Sym {