mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile: add instrumentation to regalloc
Change-Id: Ice206f7e94af4a148d9dd9a7570f5ed21722bedc Reviewed-on: https://go-review.googlesource.com/14075 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
451eca2293
commit
cff0c6ad0f
1 changed files with 10 additions and 0 deletions
|
|
@ -105,6 +105,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const regDebug = false
|
const regDebug = false
|
||||||
|
const logSpills = false
|
||||||
|
|
||||||
// regalloc performs register allocation on f. It sets f.RegAlloc
|
// regalloc performs register allocation on f. It sets f.RegAlloc
|
||||||
// to the resulting allocation.
|
// to the resulting allocation.
|
||||||
|
|
@ -402,6 +403,9 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool) *Val
|
||||||
// Instead, we regenerate the flags register by issuing the same instruction again.
|
// Instead, we regenerate the flags register by issuing the same instruction again.
|
||||||
// This requires (possibly) spilling and reloading that instruction's args.
|
// This requires (possibly) spilling and reloading that instruction's args.
|
||||||
case v.Type.IsFlags():
|
case v.Type.IsFlags():
|
||||||
|
if logSpills {
|
||||||
|
fmt.Println("regalloc: regenerating flags")
|
||||||
|
}
|
||||||
ns := s.nospill
|
ns := s.nospill
|
||||||
// Place v's arguments in registers, spilling and loading as needed
|
// Place v's arguments in registers, spilling and loading as needed
|
||||||
args := make([]*Value, 0, len(v.Args))
|
args := make([]*Value, 0, len(v.Args))
|
||||||
|
|
@ -429,9 +433,15 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool) *Val
|
||||||
// Load v from its spill location.
|
// Load v from its spill location.
|
||||||
// TODO: rematerialize if we can.
|
// TODO: rematerialize if we can.
|
||||||
case vi.spill2 != nil:
|
case vi.spill2 != nil:
|
||||||
|
if logSpills {
|
||||||
|
fmt.Println("regallog: load spill2")
|
||||||
|
}
|
||||||
c = s.curBlock.NewValue1(v.Line, OpLoadReg, v.Type, vi.spill2)
|
c = s.curBlock.NewValue1(v.Line, OpLoadReg, v.Type, vi.spill2)
|
||||||
vi.spill2used = true
|
vi.spill2used = true
|
||||||
case vi.spill != nil:
|
case vi.spill != nil:
|
||||||
|
if logSpills {
|
||||||
|
fmt.Println("regalloc: load spill")
|
||||||
|
}
|
||||||
c = s.curBlock.NewValue1(v.Line, OpLoadReg, v.Type, vi.spill)
|
c = s.curBlock.NewValue1(v.Line, OpLoadReg, v.Type, vi.spill)
|
||||||
vi.spillUsed = true
|
vi.spillUsed = true
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue