mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile: addressed vars and closures
Cleaned up first-block-in-function code. Added cases for |PHEAP for PPARAM and PAUTO. Made PPARAMOUT act more like PAUTO for purposes of address generation and vardef placement. Added cases for OCLOSUREVAR and Ops for getting closure pointer. Closure ops are scheduled at top of entry block to capture DX. Wrote test that seems to show proper behavior for addressed parameters, locals, and returns. Change-Id: Iee93ebf9e3d9f74cfb4d1c1da8038eb278d8a857 Reviewed-on: https://go-review.googlesource.com/14650 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: David Chase <drchase@google.com>
This commit is contained in:
parent
04d6edc36d
commit
956f3199a3
13 changed files with 339 additions and 22 deletions
|
|
@ -333,7 +333,11 @@ func (s *regAllocState) allocReg(mask regMask) register {
|
|||
// farthest-in-the-future use.
|
||||
// TODO: Prefer registers with already spilled Values?
|
||||
// TODO: Modify preference using affinity graph.
|
||||
mask &^= 1<<4 | 1<<32 // don't spill SP or SB
|
||||
|
||||
// SP and SB are allocated specially. No regular value should
|
||||
// be allocated to them.
|
||||
mask &^= 1<<4 | 1<<32
|
||||
|
||||
maxuse := int32(-1)
|
||||
for t := register(0); t < numRegs; t++ {
|
||||
if mask>>t&1 == 0 {
|
||||
|
|
@ -381,9 +385,7 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool) *Val
|
|||
return s.regs[r].c
|
||||
}
|
||||
|
||||
// SP and SB are allocated specially. No regular value should
|
||||
// be allocated to them.
|
||||
mask &^= 1<<4 | 1<<32
|
||||
mask &^= 1<<4 | 1<<32 // don't spill SP or SB
|
||||
|
||||
// Allocate a register.
|
||||
r := s.allocReg(mask)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue