]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: fix printing of live information
authorKeith Randall <khr@golang.org>
Wed, 28 Oct 2015 17:40:47 +0000 (10:40 -0700)
committerKeith Randall <khr@golang.org>
Wed, 28 Oct 2015 19:52:34 +0000 (19:52 +0000)
SSA generates ACALL assembly with the target in a *Sym.
The old compiler generates both that *Sym and a *Node.
Use the *Sym to print the live info so it works with both compilers.

Change-Id: I0b12a161f83e76638604358c21b9f5abb31ce950
Reviewed-on: https://go-review.googlesource.com/16432
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/plive.go

index 00ae807609529db647e8d3fbbb6e2340809681ab..a09247b8a3182fe357959d970a0c6d4f1ad214a5 100644 (file)
@@ -19,6 +19,7 @@ import (
        "cmd/internal/obj"
        "fmt"
        "sort"
+       "strings"
 )
 
 const (
@@ -1393,8 +1394,13 @@ func livenessepilogue(lv *Liveness) {
                                if msg != nil {
                                        fmt_ = ""
                                        fmt_ += fmt.Sprintf("%v: live at ", p.Line())
-                                       if p.As == obj.ACALL && p.To.Node != nil {
-                                               fmt_ += fmt.Sprintf("call to %s:", ((p.To.Node).(*Node)).Sym.Name)
+                                       if p.As == obj.ACALL && p.To.Sym != nil {
+                                               name := p.To.Sym.Name
+                                               i := strings.Index(name, ".")
+                                               if i >= 0 {
+                                                       name = name[i+1:]
+                                               }
+                                               fmt_ += fmt.Sprintf("call to %s:", name)
                                        } else if p.As == obj.ACALL {
                                                fmt_ += "indirect call:"
                                        } else {