[dev.ssa] cmd/compiler/internal/ssa: Add auxint field
Add an additional int64 auxiliary field to Value.
There are two main reasons for doing this:
1) Ints in interfaces require allocation, and we store ints in Aux a lot.
2) I'd like to have both *gc.Sym and int offsets included in lots
of operations (e.g. MOVQloadidx8). It will be more efficient to
store them as separate fields instead of a pointer to a sym/int pair.
It also simplifies a bunch of code.
This is just the refactoring. I'll start using this some more in a
subsequent changelist.
Change-Id: I1ca797ff572553986cf90cab3ac0a0c1d01ad241
Reviewed-on: https://go-review.googlesource.com/10929
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go
index f249bba..3ed1f3c 100644
--- a/src/cmd/compile/internal/ssa/value.go
+++ b/src/cmd/compile/internal/ssa/value.go
@@ -22,7 +22,9 @@
Type Type
// Auxiliary info for this value. The type of this information depends on the opcode and type.
- Aux interface{}
+ // AuxInt is used for integer values, Aux is used for other values.
+ AuxInt int64
+ Aux interface{}
// Arguments of this value
Args []*Value
@@ -53,8 +55,11 @@
func (v *Value) LongString() string {
s := fmt.Sprintf("v%d = %s", v.ID, v.Op.String())
s += " <" + v.Type.String() + ">"
+ if v.AuxInt != 0 {
+ s += fmt.Sprintf(" [%d]", v.AuxInt)
+ }
if v.Aux != nil {
- s += fmt.Sprintf(" [%v]", v.Aux)
+ s += fmt.Sprintf(" {%v}", v.Aux)
}
for _, a := range v.Args {
s += fmt.Sprintf(" %v", a)