diff options
Diffstat (limited to 'src/cmd/compile/internal/ssa/value.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/value.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go index 7edc71be52..6df535153a 100644 --- a/src/cmd/compile/internal/ssa/value.go +++ b/src/cmd/compile/internal/ssa/value.go @@ -10,6 +10,7 @@ import ( "cmd/internal/src" "fmt" "math" + "strings" ) // A Value represents a value in the SSA representation of the program. @@ -98,7 +99,7 @@ func (v *Value) AuxValAndOff() ValAndOff { return ValAndOff(v.AuxInt) } -// long form print. v# = opcode <type> [aux] args [: reg] +// long form print. v# = opcode <type> [aux] args [: reg] (names) func (v *Value) LongString() string { s := fmt.Sprintf("v%d = %s", v.ID, v.Op) s += " <" + v.Type.String() + ">" @@ -110,6 +111,18 @@ func (v *Value) LongString() string { if int(v.ID) < len(r) && r[v.ID] != nil { s += " : " + r[v.ID].Name() } + var names []string + for name, values := range v.Block.Func.NamedValues { + for _, value := range values { + if value == v { + names = append(names, name.Name()) + break // drop duplicates. + } + } + } + if len(names) != 0 { + s += " (" + strings.Join(names, ", ") + ")" + } return s } |