aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-11-24 22:09:57 -0500
committerRuss Cox <rsc@golang.org>2020-11-25 04:35:29 +0000
commit9e0e43d84d1bb653a74ccc7f90a80dfa9c665fbf (patch)
tree551b8baa8a488ffb59bc47ba904b88a6c2178ecb /src/cmd/compile/internal/ssa
parent4a6b4fd13965fe8428c9177bdd824a48dff553c0 (diff)
downloadgo-9e0e43d84d1bb653a74ccc7f90a80dfa9c665fbf.tar.gz
go-9e0e43d84d1bb653a74ccc7f90a80dfa9c665fbf.zip
[dev.regabi] cmd/compile: remove uses of dummy
Per https://developers.google.com/style/inclusive-documentation, since we are editing some of this code anyway and it is easier to put the cleanup in a separate CL. Change-Id: Ib6b851f43f9cc0a57676564477d4ff22abb1cee5 Reviewed-on: https://go-review.googlesource.com/c/go/+/273106 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa')
-rw-r--r--src/cmd/compile/internal/ssa/export_test.go92
-rw-r--r--src/cmd/compile/internal/ssa/poset.go54
-rw-r--r--src/cmd/compile/internal/ssa/regalloc.go2
3 files changed, 74 insertions, 74 deletions
diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go
index b4c3e5cfdf..bfe94ff160 100644
--- a/src/cmd/compile/internal/ssa/export_test.go
+++ b/src/cmd/compile/internal/ssa/export_test.go
@@ -36,10 +36,10 @@ func testConfigArch(tb testing.TB, arch string) *Conf {
tb.Fatalf("unknown arch %s", arch)
}
if ctxt.Arch.PtrSize != 8 {
- tb.Fatal("dummyTypes is 64-bit only")
+ tb.Fatal("testTypes is 64-bit only")
}
c := &Conf{
- config: NewConfig(arch, dummyTypes, ctxt, true),
+ config: NewConfig(arch, testTypes, ctxt, true),
tb: tb,
}
return c
@@ -53,108 +53,108 @@ type Conf struct {
func (c *Conf) Frontend() Frontend {
if c.fe == nil {
- c.fe = DummyFrontend{t: c.tb, ctxt: c.config.ctxt}
+ c.fe = TestFrontend{t: c.tb, ctxt: c.config.ctxt}
}
return c.fe
}
-// DummyFrontend is a test-only frontend.
+// TestFrontend is a test-only frontend.
// It assumes 64 bit integers and pointers.
-type DummyFrontend struct {
+type TestFrontend struct {
t testing.TB
ctxt *obj.Link
}
-type DummyAuto struct {
+type TestAuto struct {
t *types.Type
s string
}
-func (d *DummyAuto) Typ() *types.Type {
+func (d *TestAuto) Typ() *types.Type {
return d.t
}
-func (d *DummyAuto) String() string {
+func (d *TestAuto) String() string {
return d.s
}
-func (d *DummyAuto) StorageClass() StorageClass {
+func (d *TestAuto) StorageClass() StorageClass {
return ClassAuto
}
-func (d *DummyAuto) IsSynthetic() bool {
+func (d *TestAuto) IsSynthetic() bool {
return false
}
-func (d *DummyAuto) IsAutoTmp() bool {
+func (d *TestAuto) IsAutoTmp() bool {
return true
}
-func (DummyFrontend) StringData(s string) *obj.LSym {
+func (TestFrontend) StringData(s string) *obj.LSym {
return nil
}
-func (DummyFrontend) Auto(pos src.XPos, t *types.Type) GCNode {
- return &DummyAuto{t: t, s: "aDummyAuto"}
+func (TestFrontend) Auto(pos src.XPos, t *types.Type) GCNode {
+ return &TestAuto{t: t, s: "aTestAuto"}
}
-func (d DummyFrontend) SplitString(s LocalSlot) (LocalSlot, LocalSlot) {
- return LocalSlot{N: s.N, Type: dummyTypes.BytePtr, Off: s.Off}, LocalSlot{N: s.N, Type: dummyTypes.Int, Off: s.Off + 8}
+func (d TestFrontend) SplitString(s LocalSlot) (LocalSlot, LocalSlot) {
+ return LocalSlot{N: s.N, Type: testTypes.BytePtr, Off: s.Off}, LocalSlot{N: s.N, Type: testTypes.Int, Off: s.Off + 8}
}
-func (d DummyFrontend) SplitInterface(s LocalSlot) (LocalSlot, LocalSlot) {
- return LocalSlot{N: s.N, Type: dummyTypes.BytePtr, Off: s.Off}, LocalSlot{N: s.N, Type: dummyTypes.BytePtr, Off: s.Off + 8}
+func (d TestFrontend) SplitInterface(s LocalSlot) (LocalSlot, LocalSlot) {
+ return LocalSlot{N: s.N, Type: testTypes.BytePtr, Off: s.Off}, LocalSlot{N: s.N, Type: testTypes.BytePtr, Off: s.Off + 8}
}
-func (d DummyFrontend) SplitSlice(s LocalSlot) (LocalSlot, LocalSlot, LocalSlot) {
+func (d TestFrontend) SplitSlice(s LocalSlot) (LocalSlot, LocalSlot, LocalSlot) {
return LocalSlot{N: s.N, Type: s.Type.Elem().PtrTo(), Off: s.Off},
- LocalSlot{N: s.N, Type: dummyTypes.Int, Off: s.Off + 8},
- LocalSlot{N: s.N, Type: dummyTypes.Int, Off: s.Off + 16}
+ LocalSlot{N: s.N, Type: testTypes.Int, Off: s.Off + 8},
+ LocalSlot{N: s.N, Type: testTypes.Int, Off: s.Off + 16}
}
-func (d DummyFrontend) SplitComplex(s LocalSlot) (LocalSlot, LocalSlot) {
+func (d TestFrontend) SplitComplex(s LocalSlot) (LocalSlot, LocalSlot) {
if s.Type.Size() == 16 {
- return LocalSlot{N: s.N, Type: dummyTypes.Float64, Off: s.Off}, LocalSlot{N: s.N, Type: dummyTypes.Float64, Off: s.Off + 8}
+ return LocalSlot{N: s.N, Type: testTypes.Float64, Off: s.Off}, LocalSlot{N: s.N, Type: testTypes.Float64, Off: s.Off + 8}
}
- return LocalSlot{N: s.N, Type: dummyTypes.Float32, Off: s.Off}, LocalSlot{N: s.N, Type: dummyTypes.Float32, Off: s.Off + 4}
+ return LocalSlot{N: s.N, Type: testTypes.Float32, Off: s.Off}, LocalSlot{N: s.N, Type: testTypes.Float32, Off: s.Off + 4}
}
-func (d DummyFrontend) SplitInt64(s LocalSlot) (LocalSlot, LocalSlot) {
+func (d TestFrontend) SplitInt64(s LocalSlot) (LocalSlot, LocalSlot) {
if s.Type.IsSigned() {
- return LocalSlot{N: s.N, Type: dummyTypes.Int32, Off: s.Off + 4}, LocalSlot{N: s.N, Type: dummyTypes.UInt32, Off: s.Off}
+ return LocalSlot{N: s.N, Type: testTypes.Int32, Off: s.Off + 4}, LocalSlot{N: s.N, Type: testTypes.UInt32, Off: s.Off}
}
- return LocalSlot{N: s.N, Type: dummyTypes.UInt32, Off: s.Off + 4}, LocalSlot{N: s.N, Type: dummyTypes.UInt32, Off: s.Off}
+ return LocalSlot{N: s.N, Type: testTypes.UInt32, Off: s.Off + 4}, LocalSlot{N: s.N, Type: testTypes.UInt32, Off: s.Off}
}
-func (d DummyFrontend) SplitStruct(s LocalSlot, i int) LocalSlot {
+func (d TestFrontend) SplitStruct(s LocalSlot, i int) LocalSlot {
return LocalSlot{N: s.N, Type: s.Type.FieldType(i), Off: s.Off + s.Type.FieldOff(i)}
}
-func (d DummyFrontend) SplitArray(s LocalSlot) LocalSlot {
+func (d TestFrontend) SplitArray(s LocalSlot) LocalSlot {
return LocalSlot{N: s.N, Type: s.Type.Elem(), Off: s.Off}
}
-func (d DummyFrontend) SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot {
+func (d TestFrontend) SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot {
return LocalSlot{N: parent.N, Type: t, Off: offset}
}
-func (DummyFrontend) Line(_ src.XPos) string {
+func (TestFrontend) Line(_ src.XPos) string {
return "unknown.go:0"
}
-func (DummyFrontend) AllocFrame(f *Func) {
+func (TestFrontend) AllocFrame(f *Func) {
}
-func (d DummyFrontend) Syslook(s string) *obj.LSym {
+func (d TestFrontend) Syslook(s string) *obj.LSym {
return d.ctxt.Lookup(s)
}
-func (DummyFrontend) UseWriteBarrier() bool {
+func (TestFrontend) UseWriteBarrier() bool {
return true // only writebarrier_test cares
}
-func (DummyFrontend) SetWBPos(pos src.XPos) {
+func (TestFrontend) SetWBPos(pos src.XPos) {
}
-func (d DummyFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) }
-func (d DummyFrontend) Log() bool { return true }
+func (d TestFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) }
+func (d TestFrontend) Log() bool { return true }
-func (d DummyFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t.Fatalf(msg, args...) }
-func (d DummyFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t.Logf(msg, args...) }
-func (d DummyFrontend) Debug_checknil() bool { return false }
+func (d TestFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t.Fatalf(msg, args...) }
+func (d TestFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t.Logf(msg, args...) }
+func (d TestFrontend) Debug_checknil() bool { return false }
-func (d DummyFrontend) MyImportPath() string {
+func (d TestFrontend) MyImportPath() string {
return "my/import/path"
}
-var dummyTypes Types
+var testTypes Types
func init() {
// Initialize just enough of the universe and the types package to make our tests function.
@@ -198,12 +198,12 @@ func init() {
t.Align = uint8(typ.width)
types.Types[typ.et] = t
}
- dummyTypes.SetTypPtrs()
+ testTypes.SetTypPtrs()
}
-func (d DummyFrontend) DerefItab(sym *obj.LSym, off int64) *obj.LSym { return nil }
+func (d TestFrontend) DerefItab(sym *obj.LSym, off int64) *obj.LSym { return nil }
-func (d DummyFrontend) CanSSA(t *types.Type) bool {
- // There are no un-SSAable types in dummy land.
+func (d TestFrontend) CanSSA(t *types.Type) bool {
+ // There are no un-SSAable types in test land.
return true
}
diff --git a/src/cmd/compile/internal/ssa/poset.go b/src/cmd/compile/internal/ssa/poset.go
index f5a2b3a8c2..1e04b48ba4 100644
--- a/src/cmd/compile/internal/ssa/poset.go
+++ b/src/cmd/compile/internal/ssa/poset.go
@@ -136,13 +136,13 @@ type posetNode struct {
// Most internal data structures are pre-allocated and flat, so for instance adding a
// new relation does not cause any allocation. For performance reasons,
// each node has only up to two outgoing edges (like a binary tree), so intermediate
-// "dummy" nodes are required to represent more than two relations. For instance,
+// "extra" nodes are required to represent more than two relations. For instance,
// to record that A<I, A<J, A<K (with no known relation between I,J,K), we create the
// following DAG:
//
// A
// / \
-// I dummy
+// I extra
// / \
// J K
//
@@ -223,7 +223,7 @@ func (po *poset) addchild(i1, i2 uint32, strict bool) {
po.setchr(i1, e2)
po.upush(undoSetChr, i1, 0)
} else {
- // If n1 already has two children, add an intermediate dummy
+ // If n1 already has two children, add an intermediate extra
// node to record the relation correctly (without relating
// n2 to other existing nodes). Use a non-deterministic value
// to decide whether to append on the left or the right, to avoid
@@ -231,27 +231,27 @@ func (po *poset) addchild(i1, i2 uint32, strict bool) {
//
// n1
// / \
- // i1l dummy
+ // i1l extra
// / \
// i1r n2
//
- dummy := po.newnode(nil)
+ extra := po.newnode(nil)
if (i1^i2)&1 != 0 { // non-deterministic
- po.setchl(dummy, i1r)
- po.setchr(dummy, e2)
- po.setchr(i1, newedge(dummy, false))
+ po.setchl(extra, i1r)
+ po.setchr(extra, e2)
+ po.setchr(i1, newedge(extra, false))
po.upush(undoSetChr, i1, i1r)
} else {
- po.setchl(dummy, i1l)
- po.setchr(dummy, e2)
- po.setchl(i1, newedge(dummy, false))
+ po.setchl(extra, i1l)
+ po.setchr(extra, e2)
+ po.setchl(i1, newedge(extra, false))
po.upush(undoSetChl, i1, i1l)
}
}
}
// newnode allocates a new node bound to SSA value n.
-// If n is nil, this is a dummy node (= only used internally).
+// If n is nil, this is an extra node (= only used internally).
func (po *poset) newnode(n *Value) uint32 {
i := po.lastidx + 1
po.lastidx++
@@ -380,9 +380,9 @@ func (po *poset) newconst(n *Value) {
case higherptr != 0:
// Higher bound only. To record n < higher, we need
- // a dummy root:
+ // an extra root:
//
- // dummy
+ // extra
// / \
// root \
// / n
@@ -395,11 +395,11 @@ func (po *poset) newconst(n *Value) {
if r2 != po.roots[0] { // all constants should be in root #0
panic("constant not in root #0")
}
- dummy := po.newnode(nil)
- po.changeroot(r2, dummy)
- po.upush(undoChangeRoot, dummy, newedge(r2, false))
- po.addchild(dummy, r2, false)
- po.addchild(dummy, i, false)
+ extra := po.newnode(nil)
+ po.changeroot(r2, extra)
+ po.upush(undoChangeRoot, extra, newedge(r2, false))
+ po.addchild(extra, r2, false)
+ po.addchild(extra, i, false)
po.addchild(i, i2, true)
}
@@ -612,7 +612,7 @@ func (po *poset) findroot(i uint32) uint32 {
panic("findroot didn't find any root")
}
-// mergeroot merges two DAGs into one DAG by creating a new dummy root
+// mergeroot merges two DAGs into one DAG by creating a new extra root
func (po *poset) mergeroot(r1, r2 uint32) uint32 {
// Root #0 is special as it contains all constants. Since mergeroot
// discards r2 as root and keeps r1, make sure that r2 is not root #0,
@@ -1004,7 +1004,7 @@ func (po *poset) setOrder(n1, n2 *Value, strict bool) bool {
case !f1 && f2:
// n1 is not in any DAG but n2 is. If n2 is a root, we can put
// n1 in its place as a root; otherwise, we need to create a new
- // dummy root to record the relation.
+ // extra root to record the relation.
i1 = po.newnode(n1)
if po.isroot(i2) {
@@ -1020,17 +1020,17 @@ func (po *poset) setOrder(n1, n2 *Value, strict bool) bool {
// Re-parent as follows:
//
- // dummy
+ // extra
// r / \
// \ ===> r i1
// i2 \ /
// i2
//
- dummy := po.newnode(nil)
- po.changeroot(r, dummy)
- po.upush(undoChangeRoot, dummy, newedge(r, false))
- po.addchild(dummy, r, false)
- po.addchild(dummy, i1, false)
+ extra := po.newnode(nil)
+ po.changeroot(r, extra)
+ po.upush(undoChangeRoot, extra, newedge(r, false))
+ po.addchild(extra, r, false)
+ po.addchild(extra, i1, false)
po.addchild(i1, i2, strict)
case f1 && f2:
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go
index 0339b073ae..4ed884c3e7 100644
--- a/src/cmd/compile/internal/ssa/regalloc.go
+++ b/src/cmd/compile/internal/ssa/regalloc.go
@@ -104,7 +104,7 @@
// If b3 is the primary predecessor of b2, then we use x3 in b2 and
// add a x4:CX->BX copy at the end of b4.
// But the definition of x3 doesn't dominate b2. We should really
-// insert a dummy phi at the start of b2 (x5=phi(x3,x4):BX) to keep
+// insert an extra phi at the start of b2 (x5=phi(x3,x4):BX) to keep
// SSA form. For now, we ignore this problem as remaining in strict
// SSA form isn't needed after regalloc. We'll just leave the use
// of x3 not dominated by the definition of x3, and the CX->BX copy