aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/print.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/ssa/print.go')
-rw-r--r--src/cmd/compile/internal/ssa/print.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/print.go b/src/cmd/compile/internal/ssa/print.go
index 81c64a7692..96cd2c7c90 100644
--- a/src/cmd/compile/internal/ssa/print.go
+++ b/src/cmd/compile/internal/ssa/print.go
@@ -6,6 +6,7 @@ package ssa
import (
"bytes"
+ "cmd/internal/src"
"crypto/sha256"
"fmt"
"io"
@@ -83,13 +84,26 @@ func (p stringFuncPrinter) endBlock(b *Block, reachable bool) {
fmt.Fprintln(p.w, " "+b.LongString())
}
+func StmtString(p src.XPos) string {
+ linenumber := "(?) "
+ if p.IsKnown() {
+ pfx := ""
+ if p.IsStmt() == src.PosIsStmt {
+ pfx = "+"
+ }
+ if p.IsStmt() == src.PosNotStmt {
+ pfx = "-"
+ }
+ linenumber = fmt.Sprintf("(%s%d) ", pfx, p.Line())
+ }
+ return linenumber
+}
+
func (p stringFuncPrinter) value(v *Value, live bool) {
if !p.printDead && !live {
return
}
- fmt.Fprint(p.w, " ")
- //fmt.Fprint(p.w, v.Block.Func.fe.Pos(v.Pos))
- //fmt.Fprint(p.w, ": ")
+ fmt.Fprintf(p.w, " %s", StmtString(v.Pos))
fmt.Fprint(p.w, v.LongString())
if !live {
fmt.Fprint(p.w, " DEAD")