]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: change LocalSlot.N to *ir.Name
authorMatthew Dempsky <mdempsky@google.com>
Sun, 6 Dec 2020 20:02:22 +0000 (12:02 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 8 Dec 2020 01:46:40 +0000 (01:46 +0000)
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>

src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/debug.go
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/location.go
src/cmd/compile/internal/ssa/sizeof_test.go
src/cmd/compile/internal/ssa/stackalloc.go

index 95650328b1c55d572c8f0b4f1a961fa2ac1593eb..2378ea7711b9526b3f3d00af7bc996ace3656b7d 100644 (file)
@@ -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) {
index eeabd81d0391b6e5cfcbb641e1fb7f0700ee0b3e..8dc2ee8213bda1bd62559bf7bb126a76876a43c3 100644 (file)
@@ -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.
index 44e91270fad472f98990d9fc27b9cda97262eb94..6123978e55ca94ac2214727a96cc439f1ed918ce 100644 (file)
@@ -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
                                }
index 55fce3108800886256bc49c3646a93f43f46885c..644baa8548e72b4d88d84792237d0adc49484a1d 100644 (file)
@@ -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
index 3dc3a817039848a683f5c51994bd28280012f688..69f90d9ab4107df3338f36077b0cdf7b86c040de 100644 (file)
@@ -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
 
index 60ada011e3e0b7dc552383442226509d3b883710..a27002ee3ac3b26a557decab61d33de604665398 100644 (file)
@@ -22,7 +22,7 @@ func TestSizeof(t *testing.T) {
        }{
                {Value{}, 72, 112},
                {Block{}, 164, 304},
-               {LocalSlot{}, 32, 48},
+               {LocalSlot{}, 28, 40},
                {valState{}, 28, 40},
        }
 
index 5257d44cfeaf007b04f4a085923a9db9e47f5873..68a6f08a2a9b23faefa7bb6dd2f0a4641ef33fa7 100644 (file)
@@ -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)
                }