Commit cb44c8de authored by isharipo's avatar isharipo Committed by Ilya Tocar

cmd/compile/internal/ssa: add Op{SP,SB} type checks to check.go

gc/ssa.go initilizes SP and SB values with TUINTPTR type.
Assign same type in SSA tests and modify check.go to catch
mismatching types for those ops.

This makes SSA tests more consistent.

Change-Id: I798440d57d00fb949d1a0cd796759c9b82a934bd
Reviewed-on: https://go-review.googlesource.com/106658
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent d18f186b
...@@ -37,7 +37,7 @@ func TestBranchElimIf(t *testing.T) { ...@@ -37,7 +37,7 @@ func TestBranchElimIf(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("const1", OpConst32, intType, 1, nil), Valu("const1", OpConst32, intType, 1, nil),
Valu("const2", OpConst32, intType, 2, nil), Valu("const2", OpConst32, intType, 2, nil),
Valu("addr", OpAddr, boolType.PtrTo(), 0, nil, "sb"), Valu("addr", OpAddr, boolType.PtrTo(), 0, nil, "sb"),
...@@ -89,7 +89,7 @@ func TestBranchElimIfElse(t *testing.T) { ...@@ -89,7 +89,7 @@ func TestBranchElimIfElse(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("const1", OpConst32, intType, 1, nil), Valu("const1", OpConst32, intType, 1, nil),
Valu("const2", OpConst32, intType, 2, nil), Valu("const2", OpConst32, intType, 2, nil),
Valu("addr", OpAddr, boolType.PtrTo(), 0, nil, "sb"), Valu("addr", OpAddr, boolType.PtrTo(), 0, nil, "sb"),
...@@ -141,7 +141,7 @@ func TestNoBranchElimLoop(t *testing.T) { ...@@ -141,7 +141,7 @@ func TestNoBranchElimLoop(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("const2", OpConst32, intType, 2, nil), Valu("const2", OpConst32, intType, 2, nil),
Valu("const3", OpConst32, intType, 3, nil), Valu("const3", OpConst32, intType, 3, nil),
Goto("b5")), Goto("b5")),
......
...@@ -212,8 +212,17 @@ func checkFunc(f *Func) { ...@@ -212,8 +212,17 @@ func checkFunc(f *Func) {
f.Fatalf("unexpected floating-point type %v", v.LongString()) f.Fatalf("unexpected floating-point type %v", v.LongString())
} }
// Check types.
// TODO: more type checks?
switch c := f.Config; v.Op {
case OpSP, OpSB:
if v.Type != c.Types.Uintptr {
f.Fatalf("bad %s type: want uintptr, have %s",
v.Op, v.Type.String())
}
}
// TODO: check for cycles in values // TODO: check for cycles in values
// TODO: check type
} }
} }
......
...@@ -25,7 +25,7 @@ func TestCSEAuxPartitionBug(t *testing.T) { ...@@ -25,7 +25,7 @@ func TestCSEAuxPartitionBug(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sp", OpSP, c.config.Types.BytePtr, 0, nil), Valu("sp", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("r7", OpAdd64, c.config.Types.Int64, 0, nil, "arg3", "arg1"), Valu("r7", OpAdd64, c.config.Types.Int64, 0, nil, "arg3", "arg1"),
Valu("r1", OpAdd64, c.config.Types.Int64, 0, nil, "arg1", "arg2"), Valu("r1", OpAdd64, c.config.Types.Int64, 0, nil, "arg1", "arg2"),
Valu("arg1", OpArg, c.config.Types.Int64, 0, arg1Aux), Valu("arg1", OpArg, c.config.Types.Int64, 0, arg1Aux),
...@@ -93,9 +93,9 @@ func TestZCSE(t *testing.T) { ...@@ -93,9 +93,9 @@ func TestZCSE(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sp", OpSP, c.config.Types.BytePtr, 0, nil), Valu("sp", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("sb1", OpSB, c.config.Types.BytePtr, 0, nil), Valu("sb1", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("sb2", OpSB, c.config.Types.BytePtr, 0, nil), Valu("sb2", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("addr1", OpAddr, c.config.Types.Int64.PtrTo(), 0, nil, "sb1"), Valu("addr1", OpAddr, c.config.Types.Int64.PtrTo(), 0, nil, "sb1"),
Valu("addr2", OpAddr, c.config.Types.Int64.PtrTo(), 0, nil, "sb2"), Valu("addr2", OpAddr, c.config.Types.Int64.PtrTo(), 0, nil, "sb2"),
Valu("a1ld", OpLoad, c.config.Types.Int64, 0, nil, "addr1", "start"), Valu("a1ld", OpLoad, c.config.Types.Int64, 0, nil, "addr1", "start"),
......
...@@ -16,7 +16,7 @@ func TestDeadStore(t *testing.T) { ...@@ -16,7 +16,7 @@ func TestDeadStore(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("v", OpConstBool, c.config.Types.Bool, 1, nil), Valu("v", OpConstBool, c.config.Types.Bool, 1, nil),
Valu("addr1", OpAddr, ptrType, 0, nil, "sb"), Valu("addr1", OpAddr, ptrType, 0, nil, "sb"),
Valu("addr2", OpAddr, ptrType, 0, nil, "sb"), Valu("addr2", OpAddr, ptrType, 0, nil, "sb"),
...@@ -51,7 +51,7 @@ func TestDeadStorePhi(t *testing.T) { ...@@ -51,7 +51,7 @@ func TestDeadStorePhi(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("v", OpConstBool, c.config.Types.Bool, 1, nil), Valu("v", OpConstBool, c.config.Types.Bool, 1, nil),
Valu("addr", OpAddr, ptrType, 0, nil, "sb"), Valu("addr", OpAddr, ptrType, 0, nil, "sb"),
Goto("loop")), Goto("loop")),
...@@ -78,7 +78,7 @@ func TestDeadStoreTypes(t *testing.T) { ...@@ -78,7 +78,7 @@ func TestDeadStoreTypes(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("v", OpConstBool, c.config.Types.Bool, 1, nil), Valu("v", OpConstBool, c.config.Types.Bool, 1, nil),
Valu("addr1", OpAddr, t1, 0, nil, "sb"), Valu("addr1", OpAddr, t1, 0, nil, "sb"),
Valu("addr2", OpAddr, t2, 0, nil, "sb"), Valu("addr2", OpAddr, t2, 0, nil, "sb"),
...@@ -108,7 +108,7 @@ func TestDeadStoreUnsafe(t *testing.T) { ...@@ -108,7 +108,7 @@ func TestDeadStoreUnsafe(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("v", OpConstBool, c.config.Types.Bool, 1, nil), Valu("v", OpConstBool, c.config.Types.Bool, 1, nil),
Valu("addr1", OpAddr, ptrType, 0, nil, "sb"), Valu("addr1", OpAddr, ptrType, 0, nil, "sb"),
Valu("store1", OpStore, types.TypeMem, 0, c.config.Types.Int64, "addr1", "v", "start"), // store 8 bytes Valu("store1", OpStore, types.TypeMem, 0, c.config.Types.Int64, "addr1", "v", "start"), // store 8 bytes
......
...@@ -13,7 +13,7 @@ func TestFuseEliminatesOneBranch(t *testing.T) { ...@@ -13,7 +13,7 @@ func TestFuseEliminatesOneBranch(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -41,7 +41,7 @@ func TestFuseEliminatesBothBranches(t *testing.T) { ...@@ -41,7 +41,7 @@ func TestFuseEliminatesBothBranches(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -74,7 +74,7 @@ func TestFuseHandlesPhis(t *testing.T) { ...@@ -74,7 +74,7 @@ func TestFuseHandlesPhis(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -107,7 +107,7 @@ func TestFuseEliminatesEmptyBlocks(t *testing.T) { ...@@ -107,7 +107,7 @@ func TestFuseEliminatesEmptyBlocks(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("z0")), Goto("z0")),
Bloc("z1", Bloc("z1",
Goto("z2")), Goto("z2")),
......
...@@ -49,7 +49,7 @@ func TestLoopConditionS390X(t *testing.T) { ...@@ -49,7 +49,7 @@ func TestLoopConditionS390X(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("SP", OpSP, c.config.Types.UInt64, 0, nil), Valu("SP", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("ret", OpAddr, c.config.Types.Int64.PtrTo(), 0, nil, "SP"), Valu("ret", OpAddr, c.config.Types.Int64.PtrTo(), 0, nil, "SP"),
Valu("N", OpArg, c.config.Types.Int64, 0, c.Frontend().Auto(src.NoXPos, c.config.Types.Int64)), Valu("N", OpArg, c.config.Types.Int64, 0, c.Frontend().Auto(src.NoXPos, c.config.Types.Int64)),
Valu("starti", OpConst64, c.config.Types.Int64, 0, nil), Valu("starti", OpConst64, c.config.Types.Int64, 0, nil),
......
...@@ -24,7 +24,7 @@ func benchmarkNilCheckDeep(b *testing.B, depth int) { ...@@ -24,7 +24,7 @@ func benchmarkNilCheckDeep(b *testing.B, depth int) {
blocs = append(blocs, blocs = append(blocs,
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto(blockn(0)), Goto(blockn(0)),
), ),
) )
...@@ -69,7 +69,7 @@ func TestNilcheckSimple(t *testing.T) { ...@@ -69,7 +69,7 @@ func TestNilcheckSimple(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -106,7 +106,7 @@ func TestNilcheckDomOrder(t *testing.T) { ...@@ -106,7 +106,7 @@ func TestNilcheckDomOrder(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -142,7 +142,7 @@ func TestNilcheckAddr(t *testing.T) { ...@@ -142,7 +142,7 @@ func TestNilcheckAddr(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpAddr, ptrType, 0, nil, "sb"), Valu("ptr1", OpAddr, ptrType, 0, nil, "sb"),
...@@ -175,7 +175,7 @@ func TestNilcheckAddPtr(t *testing.T) { ...@@ -175,7 +175,7 @@ func TestNilcheckAddPtr(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("off", OpConst64, c.config.Types.Int64, 20, nil), Valu("off", OpConst64, c.config.Types.Int64, 20, nil),
...@@ -210,8 +210,8 @@ func TestNilcheckPhi(t *testing.T) { ...@@ -210,8 +210,8 @@ func TestNilcheckPhi(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("sp", OpSP, types.TypeInvalid, 0, nil), Valu("sp", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("baddr", OpAddr, c.config.Types.Bool, 0, "b", "sp"), Valu("baddr", OpAddr, c.config.Types.Bool, 0, "b", "sp"),
Valu("bool1", OpLoad, c.config.Types.Bool, 0, nil, "baddr", "mem"), Valu("bool1", OpLoad, c.config.Types.Bool, 0, nil, "baddr", "mem"),
If("bool1", "b1", "b2")), If("bool1", "b1", "b2")),
...@@ -254,7 +254,7 @@ func TestNilcheckKeepRemove(t *testing.T) { ...@@ -254,7 +254,7 @@ func TestNilcheckKeepRemove(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -302,7 +302,7 @@ func TestNilcheckInFalseBranch(t *testing.T) { ...@@ -302,7 +302,7 @@ func TestNilcheckInFalseBranch(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -353,7 +353,7 @@ func TestNilcheckUser(t *testing.T) { ...@@ -353,7 +353,7 @@ func TestNilcheckUser(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
...@@ -392,7 +392,7 @@ func TestNilcheckBug(t *testing.T) { ...@@ -392,7 +392,7 @@ func TestNilcheckBug(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")), Goto("checkPtr")),
Bloc("checkPtr", Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"), Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
......
...@@ -68,7 +68,7 @@ func genFunction(size int) []bloc { ...@@ -68,7 +68,7 @@ func genFunction(size int) []bloc {
blocs = append(blocs, blocs = append(blocs,
Bloc("entry", Bloc("entry",
Valu(valn("store", 0, 4), OpInitMem, types.TypeMem, 0, nil), Valu(valn("store", 0, 4), OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, types.Types[types.TUINTPTR], 0, nil),
Goto(blockn(1)), Goto(blockn(1)),
), ),
) )
......
...@@ -35,7 +35,7 @@ func makeConstShiftFunc(c *Conf, amount int64, op Op, typ *types.Type) fun { ...@@ -35,7 +35,7 @@ func makeConstShiftFunc(c *Conf, amount int64, op Op, typ *types.Type) fun {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("SP", OpSP, c.config.Types.UInt64, 0, nil), Valu("SP", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("argptr", OpOffPtr, ptyp, 8, nil, "SP"), Valu("argptr", OpOffPtr, ptyp, 8, nil, "SP"),
Valu("resptr", OpOffPtr, ptyp, 16, nil, "SP"), Valu("resptr", OpOffPtr, ptyp, 16, nil, "SP"),
Valu("load", OpLoad, typ, 0, nil, "argptr", "mem"), Valu("load", OpLoad, typ, 0, nil, "argptr", "mem"),
...@@ -93,7 +93,7 @@ func makeShiftExtensionFunc(c *Conf, amount int64, lshift, rshift Op, typ *types ...@@ -93,7 +93,7 @@ func makeShiftExtensionFunc(c *Conf, amount int64, lshift, rshift Op, typ *types
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil), Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("SP", OpSP, c.config.Types.UInt64, 0, nil), Valu("SP", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("argptr", OpOffPtr, ptyp, 8, nil, "SP"), Valu("argptr", OpOffPtr, ptyp, 8, nil, "SP"),
Valu("resptr", OpOffPtr, ptyp, 16, nil, "SP"), Valu("resptr", OpOffPtr, ptyp, 16, nil, "SP"),
Valu("load", OpLoad, typ, 0, nil, "argptr", "mem"), Valu("load", OpLoad, typ, 0, nil, "argptr", "mem"),
......
...@@ -16,8 +16,8 @@ func TestWriteBarrierStoreOrder(t *testing.T) { ...@@ -16,8 +16,8 @@ func TestWriteBarrierStoreOrder(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("sp", OpSP, types.TypeInvalid, 0, nil), Valu("sp", OpSP, c.config.Types.Uintptr, 0, nil),
Valu("v", OpConstNil, ptrType, 0, nil), Valu("v", OpConstNil, ptrType, 0, nil),
Valu("addr1", OpAddr, ptrType, 0, nil, "sb"), Valu("addr1", OpAddr, ptrType, 0, nil, "sb"),
Valu("wb2", OpStore, types.TypeMem, 0, ptrType, "addr1", "v", "wb1"), Valu("wb2", OpStore, types.TypeMem, 0, ptrType, "addr1", "v", "wb1"),
...@@ -40,8 +40,8 @@ func TestWriteBarrierPhi(t *testing.T) { ...@@ -40,8 +40,8 @@ func TestWriteBarrierPhi(t *testing.T) {
fun := c.Fun("entry", fun := c.Fun("entry",
Bloc("entry", Bloc("entry",
Valu("start", OpInitMem, types.TypeMem, 0, nil), Valu("start", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, types.TypeInvalid, 0, nil), Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Valu("sp", OpSP, types.TypeInvalid, 0, nil), Valu("sp", OpSP, c.config.Types.Uintptr, 0, nil),
Goto("loop")), Goto("loop")),
Bloc("loop", Bloc("loop",
Valu("phi", OpPhi, types.TypeMem, 0, nil, "start", "wb"), Valu("phi", OpPhi, types.TypeMem, 0, nil, "start", "wb"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment