Commit bf4d8d3d authored by Keith Randall's avatar Keith Randall

cmd/compile: rename SSA Register.Name to Register.String

Just to get rid of lots of .Name() stutter in printf calls.

Change-Id: I86cf00b3f7b2172387a1c6a7f189c1897fab6300
Reviewed-on: https://go-review.googlesource.com/56630
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDavid Chase <drchase@google.com>
parent 455775da
...@@ -575,7 +575,7 @@ var knownFormats = map[string]string{ ...@@ -575,7 +575,7 @@ var knownFormats = map[string]string{
"*cmd/compile/internal/ssa.FuncDebug %v": "", "*cmd/compile/internal/ssa.FuncDebug %v": "",
"*cmd/compile/internal/ssa.LocalSlot %+v": "", "*cmd/compile/internal/ssa.LocalSlot %+v": "",
"*cmd/compile/internal/ssa.LocalSlot %v": "", "*cmd/compile/internal/ssa.LocalSlot %v": "",
"*cmd/compile/internal/ssa.Register %v": "", "*cmd/compile/internal/ssa.Register %s": "",
"*cmd/compile/internal/ssa.SparseTreeNode %v": "", "*cmd/compile/internal/ssa.SparseTreeNode %v": "",
"*cmd/compile/internal/ssa.Value %s": "", "*cmd/compile/internal/ssa.Value %s": "",
"*cmd/compile/internal/ssa.Value %v": "", "*cmd/compile/internal/ssa.Value %v": "",
...@@ -643,8 +643,8 @@ var knownFormats = map[string]string{ ...@@ -643,8 +643,8 @@ var knownFormats = map[string]string{
"cmd/compile/internal/ssa.GCNode %v": "", "cmd/compile/internal/ssa.GCNode %v": "",
"cmd/compile/internal/ssa.ID %d": "", "cmd/compile/internal/ssa.ID %d": "",
"cmd/compile/internal/ssa.ID %v": "", "cmd/compile/internal/ssa.ID %v": "",
"cmd/compile/internal/ssa.LocalSlot %v": "", "cmd/compile/internal/ssa.LocalSlot %s": "",
"cmd/compile/internal/ssa.Location %v": "", "cmd/compile/internal/ssa.Location %s": "",
"cmd/compile/internal/ssa.Op %s": "", "cmd/compile/internal/ssa.Op %s": "",
"cmd/compile/internal/ssa.Op %v": "", "cmd/compile/internal/ssa.Op %v": "",
"cmd/compile/internal/ssa.ValAndOff %s": "", "cmd/compile/internal/ssa.ValAndOff %s": "",
......
...@@ -4773,7 +4773,7 @@ func CheckLoweredPhi(v *ssa.Value) { ...@@ -4773,7 +4773,7 @@ func CheckLoweredPhi(v *ssa.Value) {
loc := f.RegAlloc[v.ID] loc := f.RegAlloc[v.ID]
for _, a := range v.Args { for _, a := range v.Args {
if aloc := f.RegAlloc[a.ID]; aloc != loc { // TODO: .Equal() instead? if aloc := f.RegAlloc[a.ID]; aloc != loc { // TODO: .Equal() instead?
v.Fatalf("phi arg at different location than phi: %v @ %v, but arg %v @ %v\n%s\n", v, loc, a, aloc, v.Block.Func) v.Fatalf("phi arg at different location than phi: %v @ %s, but arg %v @ %s\n%s\n", v, loc, a, aloc, v.Block.Func)
} }
} }
} }
......
...@@ -115,9 +115,9 @@ func (v *VarLoc) String() string { ...@@ -115,9 +115,9 @@ func (v *VarLoc) String() string {
continue continue
} }
if registers != nil { if registers != nil {
regnames = append(regnames, registers[reg].Name()) regnames = append(regnames, registers[reg].String())
} else { } else {
regnames = append(regnames, fmt.Sprintf("reg%v", reg)) regnames = append(regnames, fmt.Sprintf("reg%d", reg))
} }
} }
loc += strings.Join(regnames, ",") loc += strings.Join(regnames, ",")
...@@ -193,7 +193,7 @@ func BuildFuncDebug(f *Func, loggingEnabled bool) *FuncDebug { ...@@ -193,7 +193,7 @@ func BuildFuncDebug(f *Func, loggingEnabled bool) *FuncDebug {
if state.loggingEnabled { if state.loggingEnabled {
var names []string var names []string
for i, name := range f.Names { for i, name := range f.Names {
names = append(names, fmt.Sprintf("%v = %v", i, name)) names = append(names, fmt.Sprintf("%d = %s", i, name))
} }
state.logf("Name table: %v\n", strings.Join(names, ", ")) state.logf("Name table: %v\n", strings.Join(names, ", "))
} }
...@@ -333,7 +333,7 @@ func BuildFuncDebug(f *Func, loggingEnabled bool) *FuncDebug { ...@@ -333,7 +333,7 @@ func BuildFuncDebug(f *Func, loggingEnabled bool) *FuncDebug {
// isSynthetic reports whether if slot represents a compiler-inserted variable, // isSynthetic reports whether if slot represents a compiler-inserted variable,
// e.g. an autotmp or an anonymous return value that needed a stack slot. // e.g. an autotmp or an anonymous return value that needed a stack slot.
func isSynthetic(slot *LocalSlot) bool { func isSynthetic(slot *LocalSlot) bool {
c := slot.Name()[0] c := slot.String()[0]
return c == '.' || c == '~' return c == '.' || c == '~'
} }
...@@ -470,11 +470,11 @@ func (state *debugState) processValue(locs *FuncDebug, v *Value, vSlots []SlotID ...@@ -470,11 +470,11 @@ func (state *debugState) processValue(locs *FuncDebug, v *Value, vSlots []SlotID
for _, slot := range vSlots { for _, slot := range vSlots {
last := locs.lastLoc(slot) last := locs.lastLoc(slot)
if last == nil { if last == nil {
state.unexpected(v, "regkill of already dead %v, %+v\n", vReg, state.slots[slot]) state.unexpected(v, "regkill of already dead %s, %+v\n", vReg, state.slots[slot])
continue continue
} }
if state.loggingEnabled { if state.loggingEnabled {
state.logf("at %v: %v regkilled out of %v\n", v.ID, state.slots[slot], vReg.Name()) state.logf("at %v: %v regkilled out of %s\n", v.ID, state.slots[slot], vReg)
} }
if last.End != nil { if last.End != nil {
state.unexpected(v, "regkill of dead slot, died at %v\n", last.End) state.unexpected(v, "regkill of dead slot, died at %v\n", last.End)
...@@ -509,7 +509,7 @@ func (state *debugState) processValue(locs *FuncDebug, v *Value, vSlots []SlotID ...@@ -509,7 +509,7 @@ func (state *debugState) processValue(locs *FuncDebug, v *Value, vSlots []SlotID
} }
last := locs.lastLoc(slot) last := locs.lastLoc(slot)
if last == nil { if last == nil {
state.unexpected(v, "spill of unnamed register %v\n", vReg) state.unexpected(v, "spill of unnamed register %s\n", vReg)
break break
} }
last.End = v last.End = v
...@@ -536,7 +536,7 @@ func (state *debugState) processValue(locs *FuncDebug, v *Value, vSlots []SlotID ...@@ -536,7 +536,7 @@ func (state *debugState) processValue(locs *FuncDebug, v *Value, vSlots []SlotID
for _, slot := range vSlots { for _, slot := range vSlots {
if state.loggingEnabled { if state.loggingEnabled {
state.logf("at %v: %v now in %v\n", v.ID, state.slots[slot], vReg.Name()) state.logf("at %v: %v now in %s\n", v.ID, state.slots[slot], vReg)
} }
last := locs.lastLoc(slot) last := locs.lastLoc(slot)
if last != nil && last.End == nil { if last != nil && last.End == nil {
......
...@@ -100,7 +100,7 @@ func decomposeBuiltIn(f *Func) { ...@@ -100,7 +100,7 @@ func decomposeBuiltIn(f *Func) {
// floats are never decomposed, even ones bigger than RegSize // floats are never decomposed, even ones bigger than RegSize
newNames = append(newNames, name) newNames = append(newNames, name)
case t.Size() > f.Config.RegSize: case t.Size() > f.Config.RegSize:
f.Fatalf("undecomposed named type %v %v", name, t) f.Fatalf("undecomposed named type %s %v", name, t)
default: default:
newNames = append(newNames, name) newNames = append(newNames, name)
} }
......
...@@ -361,13 +361,13 @@ func (v *Value) LongHTML() string { ...@@ -361,13 +361,13 @@ func (v *Value) LongHTML() string {
} }
r := v.Block.Func.RegAlloc r := v.Block.Func.RegAlloc
if int(v.ID) < len(r) && r[v.ID] != nil { if int(v.ID) < len(r) && r[v.ID] != nil {
s += " : " + html.EscapeString(r[v.ID].Name()) s += " : " + html.EscapeString(r[v.ID].String())
} }
var names []string var names []string
for name, values := range v.Block.Func.NamedValues { for name, values := range v.Block.Func.NamedValues {
for _, value := range values { for _, value := range values {
if value == v { if value == v {
names = append(names, name.Name()) names = append(names, name.String())
break // drop duplicates. break // drop duplicates.
} }
} }
...@@ -482,7 +482,7 @@ func (p htmlFuncPrinter) endDepCycle() { ...@@ -482,7 +482,7 @@ func (p htmlFuncPrinter) endDepCycle() {
} }
func (p htmlFuncPrinter) named(n LocalSlot, vals []*Value) { func (p htmlFuncPrinter) named(n LocalSlot, vals []*Value) {
fmt.Fprintf(p.w, "<li>name %s: ", n.Name()) fmt.Fprintf(p.w, "<li>name %s: ", n)
for _, val := range vals { for _, val := range vals {
fmt.Fprintf(p.w, "%s ", val.HTML()) fmt.Fprintf(p.w, "%s ", val.HTML())
} }
......
...@@ -11,18 +11,18 @@ import ( ...@@ -11,18 +11,18 @@ import (
// A place that an ssa variable can reside. // A place that an ssa variable can reside.
type Location interface { type Location interface {
Name() string // name to use in assembly templates: %rax, 16(%rsp), ... String() string // name to use in assembly templates: AX, 16(SP), ...
} }
// A Register is a machine register, like %rax. // A Register is a machine register, like AX.
// They are numbered densely from 0 (for each architecture). // They are numbered densely from 0 (for each architecture).
type Register struct { type Register struct {
num int32 num int32 // dense numbering
objNum int16 // register number from cmd/internal/obj/$ARCH objNum int16 // register number from cmd/internal/obj/$ARCH
name string name string
} }
func (r *Register) Name() string { func (r *Register) String() string {
return r.name return r.name
} }
...@@ -60,7 +60,7 @@ type LocalSlot struct { ...@@ -60,7 +60,7 @@ type LocalSlot struct {
SplitOffset int64 // .. at this offset. SplitOffset int64 // .. at this offset.
} }
func (s LocalSlot) Name() string { func (s LocalSlot) String() string {
if s.Off == 0 { if s.Off == 0 {
return fmt.Sprintf("%v[%v]", s.N, s.Type) return fmt.Sprintf("%v[%v]", s.N, s.Type)
} }
...@@ -69,13 +69,13 @@ func (s LocalSlot) Name() string { ...@@ -69,13 +69,13 @@ func (s LocalSlot) Name() string {
type LocPair [2]Location type LocPair [2]Location
func (t LocPair) Name() string { func (t LocPair) String() string {
n0, n1 := "nil", "nil" n0, n1 := "nil", "nil"
if t[0] != nil { if t[0] != nil {
n0 = t[0].Name() n0 = t[0].String()
} }
if t[1] != nil { if t[1] != nil {
n1 = t[1].Name() n1 = t[1].String()
} }
return fmt.Sprintf("<%s,%s>", n0, n1) return fmt.Sprintf("<%s,%s>", n0, n1)
} }
...@@ -78,7 +78,7 @@ func (p stringFuncPrinter) startDepCycle() { ...@@ -78,7 +78,7 @@ func (p stringFuncPrinter) startDepCycle() {
func (p stringFuncPrinter) endDepCycle() {} func (p stringFuncPrinter) endDepCycle() {}
func (p stringFuncPrinter) named(n LocalSlot, vals []*Value) { func (p stringFuncPrinter) named(n LocalSlot, vals []*Value) {
fmt.Fprintf(p.w, "name %s: %v\n", n.Name(), vals) fmt.Fprintf(p.w, "name %s: %v\n", n, vals)
} }
func fprintFunc(p funcPrinter, f *Func) { func fprintFunc(p funcPrinter, f *Func) {
......
...@@ -317,7 +317,7 @@ func (s *regAllocState) freeOrResetReg(r register, resetting bool) { ...@@ -317,7 +317,7 @@ func (s *regAllocState) freeOrResetReg(r register, resetting bool) {
// Mark r as unused. // Mark r as unused.
if s.f.pass.debug > regDebug { if s.f.pass.debug > regDebug {
fmt.Printf("freeReg %s (dump %s/%s)\n", s.registers[r].Name(), v, s.regs[r].c) fmt.Printf("freeReg %s (dump %s/%s)\n", &s.registers[r], v, s.regs[r].c)
} }
if !resetting && s.f.Config.ctxt.Flag_locationlists && len(s.valueNames[v.ID]) != 0 { if !resetting && s.f.Config.ctxt.Flag_locationlists && len(s.valueNames[v.ID]) != 0 {
kill := s.curBlock.NewValue0(src.NoXPos, OpRegKill, types.TypeVoid) kill := s.curBlock.NewValue0(src.NoXPos, OpRegKill, types.TypeVoid)
...@@ -357,7 +357,7 @@ func (s *regAllocState) setOrig(c *Value, v *Value) { ...@@ -357,7 +357,7 @@ func (s *regAllocState) setOrig(c *Value, v *Value) {
// r must be unused. // r must be unused.
func (s *regAllocState) assignReg(r register, v *Value, c *Value) { func (s *regAllocState) assignReg(r register, v *Value, c *Value) {
if s.f.pass.debug > regDebug { if s.f.pass.debug > regDebug {
fmt.Printf("assignReg %s %s/%s\n", s.registers[r].Name(), v, c) fmt.Printf("assignReg %s %s/%s\n", &s.registers[r], v, c)
} }
if s.regs[r].v != nil { if s.regs[r].v != nil {
s.f.Fatalf("tried to assign register %d to %s/%s but it is already used by %s", r, v, c, s.regs[r].v) s.f.Fatalf("tried to assign register %d to %s/%s but it is already used by %s", r, v, c, s.regs[r].v)
...@@ -422,7 +422,7 @@ func (s *regAllocState) allocReg(mask regMask, v *Value) register { ...@@ -422,7 +422,7 @@ func (s *regAllocState) allocReg(mask regMask, v *Value) register {
c := s.curBlock.NewValue1(v2.Pos, OpCopy, v2.Type, s.regs[r].c) c := s.curBlock.NewValue1(v2.Pos, OpCopy, v2.Type, s.regs[r].c)
s.copies[c] = false s.copies[c] = false
if s.f.pass.debug > regDebug { if s.f.pass.debug > regDebug {
fmt.Printf("copy %s to %s : %s\n", v2, c, s.registers[r2].Name()) fmt.Printf("copy %s to %s : %s\n", v2, c, &s.registers[r2])
} }
s.setOrig(c, v2) s.setOrig(c, v2)
s.assignReg(r2, v2, c) s.assignReg(r2, v2, c)
...@@ -531,7 +531,7 @@ func (s *regAllocState) init(f *Func) { ...@@ -531,7 +531,7 @@ func (s *regAllocState) init(f *Func) {
s.SBReg = noRegister s.SBReg = noRegister
s.GReg = noRegister s.GReg = noRegister
for r := register(0); r < s.numRegs; r++ { for r := register(0); r < s.numRegs; r++ {
switch s.registers[r].Name() { switch s.registers[r].String() {
case "SP": case "SP":
s.SPReg = r s.SPReg = r
case "SB": case "SB":
...@@ -877,7 +877,7 @@ func (s *regAllocState) regalloc(f *Func) { ...@@ -877,7 +877,7 @@ func (s *regAllocState) regalloc(f *Func) {
if s.f.pass.debug > regDebug { if s.f.pass.debug > regDebug {
fmt.Printf("starting merge block %s with end state of %s:\n", b, p) fmt.Printf("starting merge block %s with end state of %s:\n", b, p)
for _, x := range s.endRegs[p.ID] { for _, x := range s.endRegs[p.ID] {
fmt.Printf(" %s: orig:%s cache:%s\n", s.registers[x.r].Name(), x.v, x.c) fmt.Printf(" %s: orig:%s cache:%s\n", &s.registers[x.r], x.v, x.c)
} }
} }
...@@ -933,7 +933,7 @@ func (s *regAllocState) regalloc(f *Func) { ...@@ -933,7 +933,7 @@ func (s *regAllocState) regalloc(f *Func) {
c := p.NewValue1(a.Pos, OpCopy, a.Type, s.regs[r].c) c := p.NewValue1(a.Pos, OpCopy, a.Type, s.regs[r].c)
s.copies[c] = false s.copies[c] = false
if s.f.pass.debug > regDebug { if s.f.pass.debug > regDebug {
fmt.Printf("copy %s to %s : %s\n", a, c, s.registers[r2].Name()) fmt.Printf("copy %s to %s : %s\n", a, c, &s.registers[r2])
} }
s.setOrig(c, a) s.setOrig(c, a)
s.assignReg(r2, a, c) s.assignReg(r2, a, c)
...@@ -1012,7 +1012,7 @@ func (s *regAllocState) regalloc(f *Func) { ...@@ -1012,7 +1012,7 @@ func (s *regAllocState) regalloc(f *Func) {
if s.f.pass.debug > regDebug { if s.f.pass.debug > regDebug {
fmt.Printf("after phis\n") fmt.Printf("after phis\n")
for _, x := range s.startRegs[b.ID] { for _, x := range s.startRegs[b.ID] {
fmt.Printf(" %s: v%d\n", s.registers[x.r].Name(), x.v.ID) fmt.Printf(" %s: v%d\n", &s.registers[x.r], x.v.ID)
} }
} }
} }
...@@ -1177,7 +1177,7 @@ func (s *regAllocState) regalloc(f *Func) { ...@@ -1177,7 +1177,7 @@ func (s *regAllocState) regalloc(f *Func) {
fmt.Printf(" out:") fmt.Printf(" out:")
for _, r := range dinfo[idx].out { for _, r := range dinfo[idx].out {
if r != noRegister { if r != noRegister {
fmt.Printf(" %s", s.registers[r].Name()) fmt.Printf(" %s", &s.registers[r])
} }
} }
fmt.Println() fmt.Println()
...@@ -1185,7 +1185,7 @@ func (s *regAllocState) regalloc(f *Func) { ...@@ -1185,7 +1185,7 @@ func (s *regAllocState) regalloc(f *Func) {
fmt.Printf(" in%d:", i) fmt.Printf(" in%d:", i)
for _, r := range dinfo[idx].in[i] { for _, r := range dinfo[idx].in[i] {
if r != noRegister { if r != noRegister {
fmt.Printf(" %s", s.registers[r].Name()) fmt.Printf(" %s", &s.registers[r])
} }
} }
fmt.Println() fmt.Println()
...@@ -1857,11 +1857,11 @@ func (e *edgeState) setup(idx int, srcReg []endReg, dstReg []startReg, stacklive ...@@ -1857,11 +1857,11 @@ func (e *edgeState) setup(idx int, srcReg []endReg, dstReg []startReg, stacklive
for _, vid := range e.cachedVals { for _, vid := range e.cachedVals {
a := e.cache[vid] a := e.cache[vid]
for _, c := range a { for _, c := range a {
fmt.Printf("src %s: v%d cache=%s\n", e.s.f.getHome(c.ID).Name(), vid, c) fmt.Printf("src %s: v%d cache=%s\n", e.s.f.getHome(c.ID), vid, c)
} }
} }
for _, d := range e.destinations { for _, d := range e.destinations {
fmt.Printf("dst %s: v%d\n", d.loc.Name(), d.vid) fmt.Printf("dst %s: v%d\n", d.loc, d.vid)
} }
} }
} }
...@@ -1918,7 +1918,7 @@ func (e *edgeState) process() { ...@@ -1918,7 +1918,7 @@ func (e *edgeState) process() {
c := e.contents[loc].c c := e.contents[loc].c
r := e.findRegFor(c.Type) r := e.findRegFor(c.Type)
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
fmt.Printf("breaking cycle with v%d in %s:%s\n", vid, loc.Name(), c) fmt.Printf("breaking cycle with v%d in %s:%s\n", vid, loc, c)
} }
e.erase(r) e.erase(r)
if _, isReg := loc.(*Register); isReg { if _, isReg := loc.(*Register); isReg {
...@@ -1964,13 +1964,13 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP ...@@ -1964,13 +1964,13 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP
var c *Value var c *Value
var src Location var src Location
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
fmt.Printf("moving v%d to %s\n", vid, loc.Name()) fmt.Printf("moving v%d to %s\n", vid, loc)
fmt.Printf("sources of v%d:", vid) fmt.Printf("sources of v%d:", vid)
} }
for _, w := range e.cache[vid] { for _, w := range e.cache[vid] {
h := e.s.f.getHome(w.ID) h := e.s.f.getHome(w.ID)
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
fmt.Printf(" %s:%s", h.Name(), w) fmt.Printf(" %s:%s", h, w)
} }
_, isreg := h.(*Register) _, isreg := h.(*Register)
if src == nil || isreg { if src == nil || isreg {
...@@ -1980,7 +1980,7 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP ...@@ -1980,7 +1980,7 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP
} }
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
if src != nil { if src != nil {
fmt.Printf(" [use %s]\n", src.Name()) fmt.Printf(" [use %s]\n", src)
} else { } else {
fmt.Printf(" [no source]\n") fmt.Printf(" [no source]\n")
} }
...@@ -2074,7 +2074,7 @@ func (e *edgeState) set(loc Location, vid ID, c *Value, final bool, pos src.XPos ...@@ -2074,7 +2074,7 @@ func (e *edgeState) set(loc Location, vid ID, c *Value, final bool, pos src.XPos
} }
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
fmt.Printf("%s\n", c.LongString()) fmt.Printf("%s\n", c.LongString())
fmt.Printf("v%d now available in %s:%s\n", vid, loc.Name(), c) fmt.Printf("v%d now available in %s:%s\n", vid, loc, c)
} }
} }
...@@ -2098,7 +2098,7 @@ func (e *edgeState) erase(loc Location) { ...@@ -2098,7 +2098,7 @@ func (e *edgeState) erase(loc Location) {
for i, c := range a { for i, c := range a {
if e.s.f.getHome(c.ID) == loc { if e.s.f.getHome(c.ID) == loc {
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
fmt.Printf("v%d no longer available in %s:%s\n", vid, loc.Name(), c) fmt.Printf("v%d no longer available in %s:%s\n", vid, loc, c)
} }
a[i], a = a[len(a)-1], a[:len(a)-1] a[i], a = a[len(a)-1], a[:len(a)-1]
if e.s.f.Config.ctxt.Flag_locationlists { if e.s.f.Config.ctxt.Flag_locationlists {
...@@ -2174,7 +2174,7 @@ func (e *edgeState) findRegFor(typ *types.Type) Location { ...@@ -2174,7 +2174,7 @@ func (e *edgeState) findRegFor(typ *types.Type) Location {
// TODO: reuse these slots. They'll need to be erased first. // TODO: reuse these slots. They'll need to be erased first.
e.set(t, vid, x, false, c.Pos) e.set(t, vid, x, false, c.Pos)
if e.s.f.pass.debug > regDebug { if e.s.f.pass.debug > regDebug {
fmt.Printf(" SPILL %s->%s %s\n", r.Name(), t.Name(), x.LongString()) fmt.Printf(" SPILL %s->%s %s\n", r, t, x.LongString())
} }
} }
// r will now be overwritten by the caller. At some point // r will now be overwritten by the caller. At some point
...@@ -2189,7 +2189,7 @@ func (e *edgeState) findRegFor(typ *types.Type) Location { ...@@ -2189,7 +2189,7 @@ func (e *edgeState) findRegFor(typ *types.Type) Location {
for _, vid := range e.cachedVals { for _, vid := range e.cachedVals {
a := e.cache[vid] a := e.cache[vid]
for _, c := range a { for _, c := range a {
fmt.Printf("v%d: %s %s\n", vid, c, e.s.f.getHome(c.ID).Name()) fmt.Printf("v%d: %s %s\n", vid, c, e.s.f.getHome(c.ID))
} }
} }
e.s.f.Fatalf("can't find empty register on edge %s->%s", e.p, e.b) e.s.f.Fatalf("can't find empty register on edge %s->%s", e.p, e.b)
...@@ -2412,7 +2412,7 @@ func (s *regAllocState) computeLive() { ...@@ -2412,7 +2412,7 @@ func (s *regAllocState) computeLive() {
if !first { if !first {
fmt.Printf(",") fmt.Printf(",")
} }
fmt.Print(s.registers[r].Name()) fmt.Print(&s.registers[r])
first = false first = false
} }
fmt.Printf("]") fmt.Printf("]")
......
...@@ -153,7 +153,7 @@ func (s *stackAllocState) stackalloc() { ...@@ -153,7 +153,7 @@ func (s *stackAllocState) stackalloc() {
} }
loc := LocalSlot{N: v.Aux.(GCNode), Type: v.Type, Off: v.AuxInt} loc := LocalSlot{N: v.Aux.(GCNode), Type: v.Type, Off: v.AuxInt}
if f.pass.debug > stackDebug { if f.pass.debug > stackDebug {
fmt.Printf("stackalloc %s to %s\n", v, loc.Name()) fmt.Printf("stackalloc %s to %s\n", v, loc)
} }
f.setHome(v, loc) f.setHome(v, loc)
} }
...@@ -216,7 +216,7 @@ func (s *stackAllocState) stackalloc() { ...@@ -216,7 +216,7 @@ func (s *stackAllocState) stackalloc() {
} }
} }
if f.pass.debug > stackDebug { if f.pass.debug > stackDebug {
fmt.Printf("stackalloc %s to %s\n", v, name.Name()) fmt.Printf("stackalloc %s to %s\n", v, name)
} }
s.nNamedSlot++ s.nNamedSlot++
f.setHome(v, name) f.setHome(v, name)
...@@ -253,7 +253,7 @@ func (s *stackAllocState) stackalloc() { ...@@ -253,7 +253,7 @@ func (s *stackAllocState) stackalloc() {
// Use the stack variable at that index for v. // Use the stack variable at that index for v.
loc := locs[i] loc := locs[i]
if f.pass.debug > stackDebug { if f.pass.debug > stackDebug {
fmt.Printf("stackalloc %s to %s\n", v, loc.Name()) fmt.Printf("stackalloc %s to %s\n", v, loc)
} }
f.setHome(v, loc) f.setHome(v, loc)
slots[v.ID] = i slots[v.ID] = i
......
...@@ -109,13 +109,13 @@ func (v *Value) LongString() string { ...@@ -109,13 +109,13 @@ func (v *Value) LongString() string {
} }
r := v.Block.Func.RegAlloc r := v.Block.Func.RegAlloc
if int(v.ID) < len(r) && r[v.ID] != nil { if int(v.ID) < len(r) && r[v.ID] != nil {
s += " : " + r[v.ID].Name() s += " : " + r[v.ID].String()
} }
var names []string var names []string
for name, values := range v.Block.Func.NamedValues { for name, values := range v.Block.Func.NamedValues {
for _, value := range values { for _, value := range values {
if value == v { if value == v {
names = append(names, name.Name()) names = append(names, name.String())
break // drop duplicates. break // drop duplicates.
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment