1
0
mirror of https://github.com/golang/go synced 2024-11-23 22:00:11 -07:00

[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 <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2020-12-06 12:02:22 -08:00
parent 1a98ab0e2d
commit dcec658f6c
7 changed files with 9 additions and 10 deletions

View File

@ -6078,7 +6078,7 @@ func (s *state) addNamedValue(n ir.Node, v *ssa.Value) {
if n.Class() == ir.PAUTO && n.Offset() != 0 { if n.Class() == ir.PAUTO && n.Offset() != 0 {
s.Fatalf("AUTO var with offset %v %d", n, n.Offset()) 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] values, ok := s.f.NamedValues[loc]
if !ok { if !ok {
s.f.Names = append(s.f.Names, loc) s.f.Names = append(s.f.Names, loc)
@ -6979,9 +6979,8 @@ func (e *ssafn) StringData(s string) *obj.LSym {
return data return data
} }
func (e *ssafn) Auto(pos src.XPos, t *types.Type) ir.Node { func (e *ssafn) Auto(pos src.XPos, t *types.Type) *ir.Name {
n := tempAt(pos, e.curfn, t) // Note: adds new auto to e.curfn.Func.Dcl list return tempAt(pos, e.curfn, t) // Note: adds new auto to e.curfn.Func.Dcl list
return n
} }
func (e *ssafn) SplitString(name ssa.LocalSlot) (ssa.LocalSlot, ssa.LocalSlot) { func (e *ssafn) SplitString(name ssa.LocalSlot) (ssa.LocalSlot, ssa.LocalSlot) {

View File

@ -139,7 +139,7 @@ type Frontend interface {
// Auto returns a Node for an auto variable of the given type. // Auto returns a Node for an auto variable of the given type.
// The SSA compiler uses this function to allocate space for spills. // 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 // Given the name for a compound type, returns the name we should use
// for the parts of that compound type. // for the parts of that compound type.

View File

@ -380,7 +380,7 @@ func BuildFuncDebug(ctxt *obj.Link, f *Func, loggingEnabled bool, stackOffset fu
for _, b := range f.Blocks { for _, b := range f.Blocks {
for _, v := range b.Values { for _, v := range b.Values {
if v.Op == OpVarDef || v.Op == OpVarKill { if v.Op == OpVarDef || v.Op == OpVarKill {
n := v.Aux.(ir.Node) n := v.Aux.(*ir.Name)
if ir.IsSynthetic(n) { if ir.IsSynthetic(n) {
continue continue
} }

View File

@ -68,7 +68,7 @@ type TestFrontend struct {
func (TestFrontend) StringData(s string) *obj.LSym { func (TestFrontend) StringData(s string) *obj.LSym {
return nil 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 := ir.NewNameAt(pos, &types.Sym{Name: "aFakeAuto"})
n.SetClass(ir.PAUTO) n.SetClass(ir.PAUTO)
return n return n

View File

@ -60,7 +60,7 @@ func (r *Register) GCNum() int16 {
// { N: len, Type: int, Off: 0, SplitOf: parent, SplitOffset: 8} // { N: len, Type: int, Off: 0, SplitOf: parent, SplitOffset: 8}
// parent = &{N: s, Type: string} // parent = &{N: s, Type: string}
type LocalSlot struct { 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 Type *types.Type // type of slot
Off int64 // offset of slot in N Off int64 // offset of slot in N

View File

@ -22,7 +22,7 @@ func TestSizeof(t *testing.T) {
}{ }{
{Value{}, 72, 112}, {Value{}, 72, 112},
{Block{}, 164, 304}, {Block{}, 164, 304},
{LocalSlot{}, 32, 48}, {LocalSlot{}, 28, 40},
{valState{}, 28, 40}, {valState{}, 28, 40},
} }

View File

@ -157,7 +157,7 @@ func (s *stackAllocState) stackalloc() {
if v.Aux == nil { if v.Aux == nil {
f.Fatalf("%s has nil Aux\n", v.LongString()) 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 { if f.pass.debug > stackDebug {
fmt.Printf("stackalloc %s to %s\n", v, loc) fmt.Printf("stackalloc %s to %s\n", v, loc)
} }