cmd/compile: remove funcdepth variables

There were only two large classes of use for these variables:

1) Testing "funcdepth != 0" or "funcdepth > 0", which is equivalent to
checking "Curfn != nil".

2) In oldname, detecting whether a closure variable has been created
for the current function, which can be handled by instead testing
"n.Name.Curfn != Curfn".

Lastly, merge funcstart into funchdr, since it's only called once, and
it better matches up with funcbody now.

Passes toolstash-check.

Change-Id: I8fe159a9d37ef7debc4cd310354cea22a8b23394
Reviewed-on: https://go-review.googlesource.com/99076
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2018-03-06 18:30:58 -08:00
parent aa00ca12fe
commit d7eb4901f1
8 changed files with 14 additions and 43 deletions

View file

@ -242,7 +242,6 @@ type Name struct {
Param *Param // additional fields for ONAME, OTYPE
Decldepth int32 // declaration loop depth, increased for every loop or label
Vargen int32 // unique name for ONAME within a function. Function outputs are numbered starting at one.
Funcdepth int32
used bool // for variable declared and not used error
flags bitset8
@ -433,7 +432,6 @@ type Func struct {
Inl Nodes // copy of the body for use in inlining
InlCost int32
Depth int32
Label int32 // largest auto-generated label in this function