]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: replace ir.Node with *ir.Name in Liveness
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 4 Dec 2020 04:07:25 +0000 (11:07 +0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 4 Dec 2020 20:55:36 +0000 (20:55 +0000)
Passes buildall w/ toolstash -cmp.

Updates #42982

Change-Id: Iad8df321adfd576da070c13ed16a9651d4e59ad8
Reviewed-on: https://go-review.googlesource.com/c/go/+/275352
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/plive.go

index f2555cc94160fb77cfbc01aaa928956e1658ac4c..06e423daa1b6317bc3a34358242fb96eb4323336 100644 (file)
@@ -103,8 +103,8 @@ type BlockEffects struct {
 type Liveness struct {
        fn         *ir.Func
        f          *ssa.Func
-       vars       []ir.Node
-       idx        map[ir.Node]int32
+       vars       []*ir.Name
+       idx        map[*ir.Name]int32
        stkptrsize int64
 
        be []BlockEffects
@@ -212,14 +212,14 @@ func livenessShouldTrack(n ir.Node) bool {
 
 // getvariables returns the list of on-stack variables that we need to track
 // and a map for looking up indices by *Node.
-func getvariables(fn *ir.Func) ([]ir.Node, map[ir.Node]int32) {
-       var vars []ir.Node
+func getvariables(fn *ir.Func) ([]*ir.Name, map[*ir.Name]int32) {
+       var vars []*ir.Name
        for _, n := range fn.Dcl {
                if livenessShouldTrack(n) {
                        vars = append(vars, n)
                }
        }
-       idx := make(map[ir.Node]int32, len(vars))
+       idx := make(map[*ir.Name]int32, len(vars))
        for i, n := range vars {
                idx[n] = int32(i)
        }
@@ -276,13 +276,14 @@ func (lv *Liveness) valueEffects(v *ssa.Value) (int32, liveEffect) {
                return -1, 0
        }
 
+       nn := n.(*ir.Name)
        // AllocFrame has dropped unused variables from
        // lv.fn.Func.Dcl, but they might still be referenced by
        // OpVarFoo pseudo-ops. Ignore them to prevent "lost track of
        // variable" ICEs (issue 19632).
        switch v.Op {
        case ssa.OpVarDef, ssa.OpVarKill, ssa.OpVarLive, ssa.OpKeepAlive:
-               if !n.Name().Used() {
+               if !nn.Name().Used() {
                        return -1, 0
                }
        }
@@ -305,7 +306,7 @@ func (lv *Liveness) valueEffects(v *ssa.Value) (int32, liveEffect) {
                return -1, 0
        }
 
-       if pos, ok := lv.idx[n]; ok {
+       if pos, ok := lv.idx[nn]; ok {
                return pos, effect
        }
        return -1, 0
@@ -356,7 +357,7 @@ type livenessFuncCache struct {
 // Constructs a new liveness structure used to hold the global state of the
 // liveness computation. The cfg argument is a slice of *BasicBlocks and the
 // vars argument is a slice of *Nodes.
-func newliveness(fn *ir.Func, f *ssa.Func, vars []ir.Node, idx map[ir.Node]int32, stkptrsize int64) *Liveness {
+func newliveness(fn *ir.Func, f *ssa.Func, vars []*ir.Name, idx map[*ir.Name]int32, stkptrsize int64) *Liveness {
        lv := &Liveness{
                fn:         fn,
                f:          f,
@@ -482,7 +483,7 @@ func onebitwalktype1(t *types.Type, off int64, bv bvec) {
 // Generates live pointer value maps for arguments and local variables. The
 // this argument and the in arguments are always assumed live. The vars
 // argument is a slice of *Nodes.
-func (lv *Liveness) pointerMap(liveout bvec, vars []ir.Node, args, locals bvec) {
+func (lv *Liveness) pointerMap(liveout bvec, vars []*ir.Name, args, locals bvec) {
        for i := int32(0); ; i++ {
                i = liveout.Next(i)
                if i < 0 {