[dev.ssa] cmd/compile: store floats in AuxInt
Store floats in AuxInt to reduce allocations.
Change-Id: I101e6322530b4a0b2ea3591593ad022c992e8df8
Reviewed-on: https://go-review.googlesource.com/14320
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go
index 04ea17c..d213b72 100644
--- a/src/cmd/compile/internal/ssa/value.go
+++ b/src/cmd/compile/internal/ssa/value.go
@@ -4,7 +4,10 @@
package ssa
-import "fmt"
+import (
+ "fmt"
+ "math"
+)
// A Value represents a value in the SSA representation of the program.
// The ID and Type fields must not be modified. The remainder may be modified
@@ -60,6 +63,15 @@
s += " <" + v.Type.String() + ">"
if v.AuxInt != 0 {
s += fmt.Sprintf(" [%d]", v.AuxInt)
+
+ switch {
+ case v.Op == OpConst32F || v.Op == OpConst64F:
+ s += fmt.Sprintf("(%g)", math.Float64frombits(uint64(v.AuxInt)))
+ case v.Op == OpConstBool && v.AuxInt == 0:
+ s += " (false)"
+ case v.Op == OpConstBool && v.AuxInt == 1:
+ s += " (true)"
+ }
}
if v.Aux != nil {
if _, ok := v.Aux.(string); ok {