]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: print block auxint value in HTML output
authorMichael Munday <mike.munday@ibm.com>
Sat, 4 Apr 2020 21:51:15 +0000 (22:51 +0100)
committerMichael Munday <mike.munday@ibm.com>
Mon, 6 Apr 2020 14:42:24 +0000 (14:42 +0000)
The auxint value was being printed in LongString() but not LongHTML().

Fixes #38250.

Change-Id: I28e819feef8710f912bee424d1b900eb07f3abb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/227160
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/block.go
src/cmd/compile/internal/ssa/html.go

index c1a734b20b0b8a38371e20dd24ca9e382f36b1f5..fedbc7af0e3cfe9c0139e8cc6384776f86bc0980 100644 (file)
@@ -124,15 +124,8 @@ func (b *Block) LongString() string {
        if b.Aux != nil {
                s += fmt.Sprintf(" {%s}", b.Aux)
        }
-       if t := b.Kind.AuxIntType(); t != "" {
-               switch t {
-               case "Int8":
-                       s += fmt.Sprintf(" [%v]", int8(b.AuxInt))
-               case "UInt8":
-                       s += fmt.Sprintf(" [%v]", uint8(b.AuxInt))
-               default:
-                       s += fmt.Sprintf(" [%v]", b.AuxInt)
-               }
+       if t := b.AuxIntString(); t != "" {
+               s += fmt.Sprintf(" [%s]", t)
        }
        for _, c := range b.ControlValues() {
                s += fmt.Sprintf(" %s", c)
@@ -341,6 +334,19 @@ func (b *Block) LackingPos() bool {
        return true
 }
 
+func (b *Block) AuxIntString() string {
+       switch b.Kind.AuxIntType() {
+       case "Int8":
+               return fmt.Sprintf("%v", int8(b.AuxInt))
+       case "UInt8":
+               return fmt.Sprintf("%v", uint8(b.AuxInt))
+       default: // type specified but not implemented - print as int64
+               return fmt.Sprintf("%v", b.AuxInt)
+       case "": // no aux int type
+               return ""
+       }
+}
+
 func (b *Block) Logf(msg string, args ...interface{})   { b.Func.Logf(msg, args...) }
 func (b *Block) Log() bool                              { return b.Func.Log() }
 func (b *Block) Fatalf(msg string, args ...interface{}) { b.Func.Fatalf(msg, args...) }
index f39106f45028cb5604561ddc7a470a5f43e9175f..730ec6dd3f67be2885be87bd50634c1e8be8cd0f 100644 (file)
@@ -1005,6 +1005,9 @@ func (b *Block) LongHTML() string {
        if b.Aux != nil {
                s += html.EscapeString(fmt.Sprintf(" {%v}", b.Aux))
        }
+       if t := b.AuxIntString(); t != "" {
+               s += html.EscapeString(fmt.Sprintf(" [%v]", t))
+       }
        for _, c := range b.ControlValues() {
                s += fmt.Sprintf(" %s", c.HTML())
        }