Skip to content

Commit c99b4c0

Browse files
mdempskypull[bot]
authored andcommitted
cmd/compile/internal/ssa: rename ssagen.TypeOK as CanSSA
No need to indirect through Frontend for this. Change-Id: I5812eb4dadfda79267cabc9d13aeab126c1479e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/526517 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Matthew Dempsky <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 6244341 commit c99b4c0

File tree

11 files changed

+94
-113
lines changed

11 files changed

+94
-113
lines changed

src/cmd/compile/internal/dwarfgen/dwarf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
204204
if c == '.' || n.Type().IsUntyped() {
205205
continue
206206
}
207-
if n.Class == ir.PPARAM && !ssagen.TypeOK(n.Type()) {
207+
if n.Class == ir.PPARAM && !ssa.CanSSA(n.Type()) {
208208
// SSA-able args get location lists, and may move in and
209209
// out of registers, so those are handled elsewhere.
210210
// Autos and named output params seem to get handled

src/cmd/compile/internal/liveness/arg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func ArgLiveness(fn *ir.Func, f *ssa.Func, pp *objw.Progs) (blockIdx, valueIdx m
116116
}
117117

118118
// We spill address-taken or non-SSA-able value upfront, so they are always live.
119-
alwaysLive := func(n *ir.Name) bool { return n.Addrtaken() || !f.Frontend().CanSSA(n.Type()) }
119+
alwaysLive := func(n *ir.Name) bool { return n.Addrtaken() || !ssa.CanSSA(n.Type()) }
120120

121121
// We'll emit the smallest offset for the slots that need liveness info.
122122
// No need to include a slot with a lower offset if it is always live.

src/cmd/compile/internal/ssa/_gen/generic.rules

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -704,15 +704,15 @@
704704
(Store {t2} p2 _
705705
mem:(Zero [n] p3 _)))
706706
&& o1 >= 0 && o1+t1.Size() <= n && isSamePtr(p1, p3)
707-
&& fe.CanSSA(t1)
707+
&& CanSSA(t1)
708708
&& disjoint(op, t1.Size(), p2, t2.Size())
709709
=> @mem.Block (Load <t1> (OffPtr <op.Type> [o1] p3) mem)
710710
(Load <t1> op:(OffPtr [o1] p1)
711711
(Store {t2} p2 _
712712
(Store {t3} p3 _
713713
mem:(Zero [n] p4 _))))
714714
&& o1 >= 0 && o1+t1.Size() <= n && isSamePtr(p1, p4)
715-
&& fe.CanSSA(t1)
715+
&& CanSSA(t1)
716716
&& disjoint(op, t1.Size(), p2, t2.Size())
717717
&& disjoint(op, t1.Size(), p3, t3.Size())
718718
=> @mem.Block (Load <t1> (OffPtr <op.Type> [o1] p4) mem)
@@ -722,7 +722,7 @@
722722
(Store {t4} p4 _
723723
mem:(Zero [n] p5 _)))))
724724
&& o1 >= 0 && o1+t1.Size() <= n && isSamePtr(p1, p5)
725-
&& fe.CanSSA(t1)
725+
&& CanSSA(t1)
726726
&& disjoint(op, t1.Size(), p2, t2.Size())
727727
&& disjoint(op, t1.Size(), p3, t3.Size())
728728
&& disjoint(op, t1.Size(), p4, t4.Size())
@@ -734,7 +734,7 @@
734734
(Store {t5} p5 _
735735
mem:(Zero [n] p6 _))))))
736736
&& o1 >= 0 && o1+t1.Size() <= n && isSamePtr(p1, p6)
737-
&& fe.CanSSA(t1)
737+
&& CanSSA(t1)
738738
&& disjoint(op, t1.Size(), p2, t2.Size())
739739
&& disjoint(op, t1.Size(), p3, t3.Size())
740740
&& disjoint(op, t1.Size(), p4, t4.Size())
@@ -848,28 +848,28 @@
848848
(StructSelect [2] (StructMake4 _ _ x _)) => x
849849
(StructSelect [3] (StructMake4 _ _ _ x)) => x
850850

851-
(Load <t> _ _) && t.IsStruct() && t.NumFields() == 0 && fe.CanSSA(t) =>
851+
(Load <t> _ _) && t.IsStruct() && t.NumFields() == 0 && CanSSA(t) =>
852852
(StructMake0)
853-
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 1 && fe.CanSSA(t) =>
853+
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 1 && CanSSA(t) =>
854854
(StructMake1
855855
(Load <t.FieldType(0)> (OffPtr <t.FieldType(0).PtrTo()> [0] ptr) mem))
856-
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 2 && fe.CanSSA(t) =>
856+
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 2 && CanSSA(t) =>
857857
(StructMake2
858858
(Load <t.FieldType(0)> (OffPtr <t.FieldType(0).PtrTo()> [0] ptr) mem)
859859
(Load <t.FieldType(1)> (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] ptr) mem))
860-
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 3 && fe.CanSSA(t) =>
860+
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 3 && CanSSA(t) =>
861861
(StructMake3
862862
(Load <t.FieldType(0)> (OffPtr <t.FieldType(0).PtrTo()> [0] ptr) mem)
863863
(Load <t.FieldType(1)> (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] ptr) mem)
864864
(Load <t.FieldType(2)> (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] ptr) mem))
865-
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 4 && fe.CanSSA(t) =>
865+
(Load <t> ptr mem) && t.IsStruct() && t.NumFields() == 4 && CanSSA(t) =>
866866
(StructMake4
867867
(Load <t.FieldType(0)> (OffPtr <t.FieldType(0).PtrTo()> [0] ptr) mem)
868868
(Load <t.FieldType(1)> (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] ptr) mem)
869869
(Load <t.FieldType(2)> (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] ptr) mem)
870870
(Load <t.FieldType(3)> (OffPtr <t.FieldType(3).PtrTo()> [t.FieldOff(3)] ptr) mem))
871871

872-
(StructSelect [i] x:(Load <t> ptr mem)) && !fe.CanSSA(t) =>
872+
(StructSelect [i] x:(Load <t> ptr mem)) && !CanSSA(t) =>
873873
@x.Block (Load <v.Type> (OffPtr <v.Type.PtrTo()> [t.FieldOff(int(i))] ptr) mem)
874874

875875
(Store _ (StructMake0) mem) => mem
@@ -911,9 +911,9 @@
911911
(StructSelect [0] (IData x)) => (IData x)
912912

913913
// un-SSAable values use mem->mem copies
914-
(Store {t} dst (Load src mem) mem) && !fe.CanSSA(t) =>
914+
(Store {t} dst (Load src mem) mem) && !CanSSA(t) =>
915915
(Move {t} [t.Size()] dst src mem)
916-
(Store {t} dst (Load src mem) (VarDef {x} mem)) && !fe.CanSSA(t) =>
916+
(Store {t} dst (Load src mem) (VarDef {x} mem)) && !CanSSA(t) =>
917917
(Move {t} [t.Size()] dst src (VarDef {x} mem))
918918

919919
// array ops
@@ -922,7 +922,7 @@
922922
(Load <t> _ _) && t.IsArray() && t.NumElem() == 0 =>
923923
(ArrayMake0)
924924

925-
(Load <t> ptr mem) && t.IsArray() && t.NumElem() == 1 && fe.CanSSA(t) =>
925+
(Load <t> ptr mem) && t.IsArray() && t.NumElem() == 1 && CanSSA(t) =>
926926
(ArrayMake1 (Load <t.Elem()> ptr mem))
927927

928928
(Store _ (ArrayMake0) mem) => mem

src/cmd/compile/internal/ssa/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ type Logger interface {
143143
type Frontend interface {
144144
Logger
145145

146-
// CanSSA reports whether variables of type t are SSA-able.
147-
CanSSA(t *types.Type) bool
148-
149146
// StringData returns a symbol pointing to the given string's contents.
150147
StringData(string) *obj.LSym
151148

src/cmd/compile/internal/ssa/expand_calls.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ type expandState struct {
177177
f *Func
178178
abi1 *abi.ABIConfig
179179
debug int // odd values log lost statement markers, so likely settings are 1 (stmts), 2 (expansion), and 3 (both)
180-
canSSAType func(*types.Type) bool
181180
regSize int64
182181
sp *Value
183182
typs *Types
@@ -211,7 +210,7 @@ func (x *expandState) intPairTypes(et types.Kind) (tHi, tLo *types.Type) {
211210
// so this is all aggregate types -- small struct and array, complex, interface, string, slice, and 64-bit
212211
// integer on 32-bit).
213212
func (x *expandState) isAlreadyExpandedAggregateType(t *types.Type) bool {
214-
if !x.canSSAType(t) {
213+
if !CanSSA(t) {
215214
return false
216215
}
217216
return t.IsStruct() || t.IsArray() || t.IsComplex() || t.IsInterface() || t.IsString() || t.IsSlice() ||
@@ -426,7 +425,7 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64,
426425

427426
} else {
428427
leafType := removeTrivialWrapperTypes(leaf.Type)
429-
if x.canSSAType(leafType) {
428+
if CanSSA(leafType) {
430429
pt := types.NewPtr(leafType)
431430
// Any selection right out of the arg area/registers has to be same Block as call, use call as mem input.
432431
// Create a "mem" for any loads that need to occur.
@@ -1195,7 +1194,6 @@ func expandCalls(f *Func) {
11951194
f: f,
11961195
abi1: f.ABI1,
11971196
debug: f.pass.debug,
1198-
canSSAType: f.fe.CanSSA,
11991197
regSize: f.Config.RegSize,
12001198
sp: sp,
12011199
typs: &f.Config.Types,

src/cmd/compile/internal/ssa/export_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,3 @@ func init() {
120120
typecheck.InitUniverse()
121121
testTypes.SetTypPtrs()
122122
}
123-
124-
func (d TestFrontend) DerefItab(sym *obj.LSym, off int64) *obj.LSym { return nil }
125-
126-
func (d TestFrontend) CanSSA(t *types.Type) bool {
127-
// There are no un-SSAable types in test land.
128-
return true
129-
}

src/cmd/compile/internal/ssa/rewritePPC64latelower.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)