diff options
| author | Todd Neal <todd@tneal.org> | 2016-03-10 17:52:57 -0600 |
|---|---|---|
| committer | Todd Neal <todd@tneal.org> | 2016-03-11 01:35:12 +0000 |
| commit | 6b3d4a53538c091d3d0bf207d12db3ec641b85ea (patch) | |
| tree | 9e649f5d0f32be4283d09be816f63042a83f231e /src/cmd/compile/internal/ssa/stackalloc.go | |
| parent | 31d13f479a19ca6e07ad60c441298c6eca04eeb2 (diff) | |
| download | go-6b3d4a53538c091d3d0bf207d12db3ec641b85ea.tar.xz | |
cmd/compile: modify regalloc/stackalloc to use the cmd line debug args
Change the existing flags from compile time consts to be configurable
from the command line.
Change-Id: I4aab4bf3dfcbdd8e2b5a2ff51af95c2543967769
Reviewed-on: https://go-review.googlesource.com/20560
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/stackalloc.go')
| -rw-r--r-- | src/cmd/compile/internal/ssa/stackalloc.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/ssa/stackalloc.go b/src/cmd/compile/internal/ssa/stackalloc.go index ef8a5846b0..b4d964c87f 100644 --- a/src/cmd/compile/internal/ssa/stackalloc.go +++ b/src/cmd/compile/internal/ssa/stackalloc.go @@ -8,8 +8,6 @@ package ssa import "fmt" -const stackDebug = false // TODO: compiler flag - type stackAllocState struct { f *Func values []stackValState @@ -27,7 +25,7 @@ type stackValState struct { // all Values that did not get a register. // Returns a map from block ID to the stack values live at the end of that block. func stackalloc(f *Func, spillLive [][]ID) [][]ID { - if stackDebug { + if f.pass.debug > stackDebug { fmt.Println("before stackalloc") fmt.Println(f.String()) } @@ -46,7 +44,7 @@ func (s *stackAllocState) init(f *Func, spillLive [][]ID) { for _, v := range b.Values { s.values[v.ID].typ = v.Type s.values[v.ID].needSlot = !v.Type.IsMemory() && !v.Type.IsVoid() && !v.Type.IsFlags() && f.getHome(v.ID) == nil && !v.rematerializeable() - if stackDebug && s.values[v.ID].needSlot { + if f.pass.debug > stackDebug && s.values[v.ID].needSlot { fmt.Printf("%s needs a stack slot\n", v) } if v.Op == OpStoreReg { @@ -83,7 +81,7 @@ func (s *stackAllocState) stackalloc() { continue } loc := LocalSlot{v.Aux.(GCNode), v.Type, v.AuxInt} - if stackDebug { + if f.pass.debug > stackDebug { fmt.Printf("stackalloc %s to %s\n", v, loc.Name()) } f.setHome(v, loc) @@ -131,7 +129,7 @@ func (s *stackAllocState) stackalloc() { goto noname } } - if stackDebug { + if f.pass.debug > stackDebug { fmt.Printf("stackalloc %s to %s\n", v, name.Name()) } f.setHome(v, name) @@ -165,7 +163,7 @@ func (s *stackAllocState) stackalloc() { } // Use the stack variable at that index for v. loc := locs[i] - if stackDebug { + if f.pass.debug > stackDebug { fmt.Printf("stackalloc %s to %s\n", v, loc.Name()) } f.setHome(v, loc) @@ -249,7 +247,7 @@ func (s *stackAllocState) computeLive(spillLive [][]ID) { break } } - if stackDebug { + if s.f.pass.debug > stackDebug { for _, b := range s.f.Blocks { fmt.Printf("stacklive %s %v\n", b, s.live[b.ID]) } @@ -307,7 +305,7 @@ func (s *stackAllocState) buildInterferenceGraph() { } } } - if stackDebug { + if f.pass.debug > stackDebug { for vid, i := range s.interfere { if len(i) > 0 { fmt.Printf("v%d interferes with", vid) |
