aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/ssa/export_test.go')
-rw-r--r--src/cmd/compile/internal/ssa/export_test.go53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go
index eeb1fceb7a..b04702d279 100644
--- a/src/cmd/compile/internal/ssa/export_test.go
+++ b/src/cmd/compile/internal/ssa/export_test.go
@@ -19,11 +19,11 @@ var Copyelim = copyelim
var TestCtxt = obj.Linknew(&x86.Linkamd64)
func testConfig(t testing.TB) *Config {
- return NewConfig("amd64", TestCtxt, true)
+ return NewConfig("amd64", dummyTypes, TestCtxt, true)
}
func testConfigS390X(t testing.TB) *Config {
- return NewConfig("s390x", obj.Linknew(&s390x.Links390x), true)
+ return NewConfig("s390x", dummyTypes, obj.Linknew(&s390x.Links390x), true)
}
// DummyFrontend is a test-only frontend.
@@ -52,27 +52,27 @@ func (DummyFrontend) Auto(t Type) GCNode {
return &DummyAuto{t: t, s: "aDummyAuto"}
}
func (d DummyFrontend) SplitString(s LocalSlot) (LocalSlot, LocalSlot) {
- return LocalSlot{s.N, d.TypeBytePtr(), s.Off}, LocalSlot{s.N, d.TypeInt(), s.Off + 8}
+ return LocalSlot{s.N, dummyTypes.BytePtr, s.Off}, LocalSlot{s.N, dummyTypes.Int, s.Off + 8}
}
func (d DummyFrontend) SplitInterface(s LocalSlot) (LocalSlot, LocalSlot) {
- return LocalSlot{s.N, d.TypeBytePtr(), s.Off}, LocalSlot{s.N, d.TypeBytePtr(), s.Off + 8}
+ return LocalSlot{s.N, dummyTypes.BytePtr, s.Off}, LocalSlot{s.N, dummyTypes.BytePtr, s.Off + 8}
}
func (d DummyFrontend) SplitSlice(s LocalSlot) (LocalSlot, LocalSlot, LocalSlot) {
return LocalSlot{s.N, s.Type.ElemType().PtrTo(), s.Off},
- LocalSlot{s.N, d.TypeInt(), s.Off + 8},
- LocalSlot{s.N, d.TypeInt(), s.Off + 16}
+ LocalSlot{s.N, dummyTypes.Int, s.Off + 8},
+ LocalSlot{s.N, dummyTypes.Int, s.Off + 16}
}
func (d DummyFrontend) SplitComplex(s LocalSlot) (LocalSlot, LocalSlot) {
if s.Type.Size() == 16 {
- return LocalSlot{s.N, d.TypeFloat64(), s.Off}, LocalSlot{s.N, d.TypeFloat64(), s.Off + 8}
+ return LocalSlot{s.N, dummyTypes.Float64, s.Off}, LocalSlot{s.N, dummyTypes.Float64, s.Off + 8}
}
- return LocalSlot{s.N, d.TypeFloat32(), s.Off}, LocalSlot{s.N, d.TypeFloat32(), s.Off + 4}
+ return LocalSlot{s.N, dummyTypes.Float32, s.Off}, LocalSlot{s.N, dummyTypes.Float32, s.Off + 4}
}
func (d DummyFrontend) SplitInt64(s LocalSlot) (LocalSlot, LocalSlot) {
if s.Type.IsSigned() {
- return LocalSlot{s.N, d.TypeInt32(), s.Off + 4}, LocalSlot{s.N, d.TypeUInt32(), s.Off}
+ return LocalSlot{s.N, dummyTypes.Int32, s.Off + 4}, LocalSlot{s.N, dummyTypes.UInt32, s.Off}
}
- return LocalSlot{s.N, d.TypeUInt32(), s.Off + 4}, LocalSlot{s.N, d.TypeUInt32(), s.Off}
+ return LocalSlot{s.N, dummyTypes.UInt32, s.Off + 4}, LocalSlot{s.N, dummyTypes.UInt32, s.Off}
}
func (d DummyFrontend) SplitStruct(s LocalSlot, i int) LocalSlot {
return LocalSlot{s.N, s.Type.FieldType(i), s.Off + s.Type.FieldOff(i)}
@@ -101,21 +101,24 @@ func (d DummyFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t
func (d DummyFrontend) Debug_checknil() bool { return false }
func (d DummyFrontend) Debug_wb() bool { return false }
-func (d DummyFrontend) TypeBool() Type { return TypeBool }
-func (d DummyFrontend) TypeInt8() Type { return TypeInt8 }
-func (d DummyFrontend) TypeInt16() Type { return TypeInt16 }
-func (d DummyFrontend) TypeInt32() Type { return TypeInt32 }
-func (d DummyFrontend) TypeInt64() Type { return TypeInt64 }
-func (d DummyFrontend) TypeUInt8() Type { return TypeUInt8 }
-func (d DummyFrontend) TypeUInt16() Type { return TypeUInt16 }
-func (d DummyFrontend) TypeUInt32() Type { return TypeUInt32 }
-func (d DummyFrontend) TypeUInt64() Type { return TypeUInt64 }
-func (d DummyFrontend) TypeFloat32() Type { return TypeFloat32 }
-func (d DummyFrontend) TypeFloat64() Type { return TypeFloat64 }
-func (d DummyFrontend) TypeInt() Type { return TypeInt64 }
-func (d DummyFrontend) TypeUintptr() Type { return TypeUInt64 }
-func (d DummyFrontend) TypeString() Type { panic("unimplemented") }
-func (d DummyFrontend) TypeBytePtr() Type { return TypeBytePtr }
+var dummyTypes = Types{
+ Bool: TypeBool,
+ Int8: TypeInt8,
+ Int16: TypeInt16,
+ Int32: TypeInt32,
+ Int64: TypeInt64,
+ UInt8: TypeUInt8,
+ UInt16: TypeUInt16,
+ UInt32: TypeUInt32,
+ UInt64: TypeUInt64,
+ Float32: TypeFloat32,
+ Float64: TypeFloat64,
+ Int: TypeInt64,
+ Uintptr: TypeUInt64,
+ String: nil,
+ BytePtr: TypeBytePtr,
+}
+
func (d DummyFrontend) DerefItab(sym *obj.LSym, off int64) *obj.LSym { return nil }
func (d DummyFrontend) CanSSA(t Type) bool {