diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-01-11 22:58:23 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-01-14 06:10:09 +0000 |
commit | f97983249a812c2b079a489fc990fbeb3695be4d (patch) | |
tree | 2ecf5ed8eab72fa168faa97436ec0d1e708c4439 /src/cmd/compile/internal/gc | |
parent | 447630042588a14aec6680e624113258d3849d49 (diff) | |
download | go-f97983249a812c2b079a489fc990fbeb3695be4d.tar.gz go-f97983249a812c2b079a489fc990fbeb3695be4d.zip |
[dev.regabi] cmd/compile: move more PAUTOHEAP to SSA construction
This CL moves almost all PAUTOHEAP handling code to SSA construction.
Instead of changing Names to PAUTOHEAP, escape analysis now only sets
n.Esc() to ir.EscHeap, and SSA handles creating the "&x"
pseudo-variables and associating them via Heapaddr.
This CL also gets rid of n.Stackcopy, which was used to distinguish
the heap copy of a parameter used within a function from the stack
copy used in the function calling convention. In practice, this is
always obvious from context: liveness and function prologue/epilogue
want to know about the stack copies, and everywhere else wants the
heap copy.
Hopefully moving all parameter/result handling into SSA helps with
making the register ABI stuff easier.
Also, the only remaining uses of PAUTOHEAP are now for closure
variables, so I intend to rename it to PCLOSUREVAR or get rid of those
altogether too. But this CL is already big and scary enough.
Change-Id: Ief5ef6205041b9d0ee445314310c0c5a98187e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/283233
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc')
-rw-r--r-- | src/cmd/compile/internal/gc/compile.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/gc/compile.go b/src/cmd/compile/internal/gc/compile.go index 410b3e90ea..a8a0106320 100644 --- a/src/cmd/compile/internal/gc/compile.go +++ b/src/cmd/compile/internal/gc/compile.go @@ -90,15 +90,12 @@ func prepareFunc(fn *ir.Func) { // because symbols must be allocated before the parallel // phase of the compiler. for _, n := range fn.Dcl { - switch n.Class { - case ir.PPARAM, ir.PPARAMOUT, ir.PAUTO: - if liveness.ShouldTrack(n) && n.Addrtaken() { - reflectdata.WriteType(n.Type()) - // Also make sure we allocate a linker symbol - // for the stack object data, for the same reason. - if fn.LSym.Func().StackObjects == nil { - fn.LSym.Func().StackObjects = base.Ctxt.Lookup(fn.LSym.Name + ".stkobj") - } + if liveness.ShouldTrack(n) && n.Addrtaken() { + reflectdata.WriteType(n.Type()) + // Also make sure we allocate a linker symbol + // for the stack object data, for the same reason. + if fn.LSym.Func().StackObjects == nil { + fn.LSym.Func().StackObjects = base.Ctxt.Lookup(fn.LSym.Name + ".stkobj") } } } |