From dcec658f6c9798b226d2f1e72a7b22b613e95c00 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Sun, 6 Dec 2020 12:02:22 -0800 Subject: [dev.regabi] cmd/compile: change LocalSlot.N to *ir.Name This was already documented as always being an ONAME, so it just needed a few type assertion changes. Passes buildall w/ toolstash -cmp. Updates #42982. Change-Id: I61f4b6ebd57c43b41977f4b37b81fe94fb11a723 Reviewed-on: https://go-review.googlesource.com/c/go/+/275757 Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Cuong Manh Le Reviewed-by: Russ Cox Trust: Matthew Dempsky --- src/cmd/compile/internal/gc/ssa.go | 7 +++---- src/cmd/compile/internal/ssa/config.go | 2 +- src/cmd/compile/internal/ssa/debug.go | 2 +- src/cmd/compile/internal/ssa/export_test.go | 2 +- src/cmd/compile/internal/ssa/location.go | 2 +- src/cmd/compile/internal/ssa/sizeof_test.go | 2 +- src/cmd/compile/internal/ssa/stackalloc.go | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 95650328b1..2378ea7711 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -6078,7 +6078,7 @@ func (s *state) addNamedValue(n ir.Node, v *ssa.Value) { if n.Class() == ir.PAUTO && n.Offset() != 0 { s.Fatalf("AUTO var with offset %v %d", n, n.Offset()) } - loc := ssa.LocalSlot{N: n, Type: n.Type(), Off: 0} + loc := ssa.LocalSlot{N: n.Name(), Type: n.Type(), Off: 0} values, ok := s.f.NamedValues[loc] if !ok { s.f.Names = append(s.f.Names, loc) @@ -6979,9 +6979,8 @@ func (e *ssafn) StringData(s string) *obj.LSym { return data } -func (e *ssafn) Auto(pos src.XPos, t *types.Type) ir.Node { - n := tempAt(pos, e.curfn, t) // Note: adds new auto to e.curfn.Func.Dcl list - return n +func (e *ssafn) Auto(pos src.XPos, t *types.Type) *ir.Name { + return tempAt(pos, e.curfn, t) // Note: adds new auto to e.curfn.Func.Dcl list } func (e *ssafn) SplitString(name ssa.LocalSlot) (ssa.LocalSlot, ssa.LocalSlot) { diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index eeabd81d03..8dc2ee8213 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -139,7 +139,7 @@ type Frontend interface { // Auto returns a Node for an auto variable of the given type. // The SSA compiler uses this function to allocate space for spills. - Auto(src.XPos, *types.Type) ir.Node + Auto(src.XPos, *types.Type) *ir.Name // Given the name for a compound type, returns the name we should use // for the parts of that compound type. diff --git a/src/cmd/compile/internal/ssa/debug.go b/src/cmd/compile/internal/ssa/debug.go index 44e91270fa..6123978e55 100644 --- a/src/cmd/compile/internal/ssa/debug.go +++ b/src/cmd/compile/internal/ssa/debug.go @@ -380,7 +380,7 @@ func BuildFuncDebug(ctxt *obj.Link, f *Func, loggingEnabled bool, stackOffset fu for _, b := range f.Blocks { for _, v := range b.Values { if v.Op == OpVarDef || v.Op == OpVarKill { - n := v.Aux.(ir.Node) + n := v.Aux.(*ir.Name) if ir.IsSynthetic(n) { continue } diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go index 55fce31088..644baa8548 100644 --- a/src/cmd/compile/internal/ssa/export_test.go +++ b/src/cmd/compile/internal/ssa/export_test.go @@ -68,7 +68,7 @@ type TestFrontend struct { func (TestFrontend) StringData(s string) *obj.LSym { return nil } -func (TestFrontend) Auto(pos src.XPos, t *types.Type) ir.Node { +func (TestFrontend) Auto(pos src.XPos, t *types.Type) *ir.Name { n := ir.NewNameAt(pos, &types.Sym{Name: "aFakeAuto"}) n.SetClass(ir.PAUTO) return n diff --git a/src/cmd/compile/internal/ssa/location.go b/src/cmd/compile/internal/ssa/location.go index 3dc3a81703..69f90d9ab4 100644 --- a/src/cmd/compile/internal/ssa/location.go +++ b/src/cmd/compile/internal/ssa/location.go @@ -60,7 +60,7 @@ func (r *Register) GCNum() int16 { // { N: len, Type: int, Off: 0, SplitOf: parent, SplitOffset: 8} // parent = &{N: s, Type: string} type LocalSlot struct { - N ir.Node // an ONAME *gc.Node representing a stack location. + N *ir.Name // an ONAME *ir.Name representing a stack location. Type *types.Type // type of slot Off int64 // offset of slot in N diff --git a/src/cmd/compile/internal/ssa/sizeof_test.go b/src/cmd/compile/internal/ssa/sizeof_test.go index 60ada011e3..a27002ee3a 100644 --- a/src/cmd/compile/internal/ssa/sizeof_test.go +++ b/src/cmd/compile/internal/ssa/sizeof_test.go @@ -22,7 +22,7 @@ func TestSizeof(t *testing.T) { }{ {Value{}, 72, 112}, {Block{}, 164, 304}, - {LocalSlot{}, 32, 48}, + {LocalSlot{}, 28, 40}, {valState{}, 28, 40}, } diff --git a/src/cmd/compile/internal/ssa/stackalloc.go b/src/cmd/compile/internal/ssa/stackalloc.go index 5257d44cfe..68a6f08a2a 100644 --- a/src/cmd/compile/internal/ssa/stackalloc.go +++ b/src/cmd/compile/internal/ssa/stackalloc.go @@ -157,7 +157,7 @@ func (s *stackAllocState) stackalloc() { if v.Aux == nil { f.Fatalf("%s has nil Aux\n", v.LongString()) } - loc := LocalSlot{N: v.Aux.(ir.Node), Type: v.Type, Off: v.AuxInt} + loc := LocalSlot{N: v.Aux.(*ir.Name), Type: v.Type, Off: v.AuxInt} if f.pass.debug > stackDebug { fmt.Printf("stackalloc %s to %s\n", v, loc) } -- cgit v1.2.3-54-g00ecf