[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>
This commit is contained in:
Keith Randall 2015-06-11 21:29:25 -07:00
parent 0ad9c8c720
commit 8f22b5292f
20 changed files with 756 additions and 1003 deletions

View file

@ -10,14 +10,14 @@ func TestDeadLoop(t *testing.T) {
c := NewConfig("amd64", DummyFrontend{})
fun := Fun(c, "entry",
Bloc("entry",
Valu("mem", OpArg, TypeMem, ".mem"),
Valu("mem", OpArg, TypeMem, 0, ".mem"),
Goto("exit")),
Bloc("exit",
Exit("mem")),
// dead loop
Bloc("deadblock",
// dead value in dead block
Valu("deadval", OpConst, TypeBool, true),
Valu("deadval", OpConst, TypeBool, 0, true),
If("deadval", "deadblock", "exit")))
CheckFunc(fun.f)
@ -40,8 +40,8 @@ func TestDeadValue(t *testing.T) {
c := NewConfig("amd64", DummyFrontend{})
fun := Fun(c, "entry",
Bloc("entry",
Valu("mem", OpArg, TypeMem, ".mem"),
Valu("deadval", OpConst, TypeInt64, int64(37)),
Valu("mem", OpArg, TypeMem, 0, ".mem"),
Valu("deadval", OpConst, TypeInt64, 37, nil),
Goto("exit")),
Bloc("exit",
Exit("mem")))
@ -63,8 +63,8 @@ func TestNeverTaken(t *testing.T) {
c := NewConfig("amd64", DummyFrontend{})
fun := Fun(c, "entry",
Bloc("entry",
Valu("cond", OpConst, TypeBool, false),
Valu("mem", OpArg, TypeMem, ".mem"),
Valu("cond", OpConst, TypeBool, 0, false),
Valu("mem", OpArg, TypeMem, 0, ".mem"),
If("cond", "then", "else")),
Bloc("then",
Goto("exit")),