Skip to content

Commit a4451e1

Browse files
committed
cmd/compile: print block auxint value in HTML output
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
1 parent 815509a commit a4451e1

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/cmd/compile/internal/ssa/block.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,8 @@ func (b *Block) LongString() string {
124124
if b.Aux != nil {
125125
s += fmt.Sprintf(" {%s}", b.Aux)
126126
}
127-
if t := b.Kind.AuxIntType(); t != "" {
128-
switch t {
129-
case "Int8":
130-
s += fmt.Sprintf(" [%v]", int8(b.AuxInt))
131-
case "UInt8":
132-
s += fmt.Sprintf(" [%v]", uint8(b.AuxInt))
133-
default:
134-
s += fmt.Sprintf(" [%v]", b.AuxInt)
135-
}
127+
if t := b.AuxIntString(); t != "" {
128+
s += fmt.Sprintf(" [%s]", t)
136129
}
137130
for _, c := range b.ControlValues() {
138131
s += fmt.Sprintf(" %s", c)
@@ -341,6 +334,19 @@ func (b *Block) LackingPos() bool {
341334
return true
342335
}
343336

337+
func (b *Block) AuxIntString() string {
338+
switch b.Kind.AuxIntType() {
339+
case "Int8":
340+
return fmt.Sprintf("%v", int8(b.AuxInt))
341+
case "UInt8":
342+
return fmt.Sprintf("%v", uint8(b.AuxInt))
343+
default: // type specified but not implemented - print as int64
344+
return fmt.Sprintf("%v", b.AuxInt)
345+
case "": // no aux int type
346+
return ""
347+
}
348+
}
349+
344350
func (b *Block) Logf(msg string, args ...interface{}) { b.Func.Logf(msg, args...) }
345351
func (b *Block) Log() bool { return b.Func.Log() }
346352
func (b *Block) Fatalf(msg string, args ...interface{}) { b.Func.Fatalf(msg, args...) }

src/cmd/compile/internal/ssa/html.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,9 @@ func (b *Block) LongHTML() string {
10051005
if b.Aux != nil {
10061006
s += html.EscapeString(fmt.Sprintf(" {%v}", b.Aux))
10071007
}
1008+
if t := b.AuxIntString(); t != "" {
1009+
s += html.EscapeString(fmt.Sprintf(" [%v]", t))
1010+
}
10081011
for _, c := range b.ControlValues() {
10091012
s += fmt.Sprintf(" %s", c.HTML())
10101013
}

0 commit comments

Comments
 (0)