mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: replace ir.Node with *ir.Name in Liveness
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>
This commit is contained in:
parent
133b03e1c3
commit
b75f51c645
1 changed files with 10 additions and 9 deletions
|
|
@ -103,8 +103,8 @@ type BlockEffects struct {
|
||||||
type Liveness struct {
|
type Liveness struct {
|
||||||
fn *ir.Func
|
fn *ir.Func
|
||||||
f *ssa.Func
|
f *ssa.Func
|
||||||
vars []ir.Node
|
vars []*ir.Name
|
||||||
idx map[ir.Node]int32
|
idx map[*ir.Name]int32
|
||||||
stkptrsize int64
|
stkptrsize int64
|
||||||
|
|
||||||
be []BlockEffects
|
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
|
// getvariables returns the list of on-stack variables that we need to track
|
||||||
// and a map for looking up indices by *Node.
|
// and a map for looking up indices by *Node.
|
||||||
func getvariables(fn *ir.Func) ([]ir.Node, map[ir.Node]int32) {
|
func getvariables(fn *ir.Func) ([]*ir.Name, map[*ir.Name]int32) {
|
||||||
var vars []ir.Node
|
var vars []*ir.Name
|
||||||
for _, n := range fn.Dcl {
|
for _, n := range fn.Dcl {
|
||||||
if livenessShouldTrack(n) {
|
if livenessShouldTrack(n) {
|
||||||
vars = append(vars, 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 {
|
for i, n := range vars {
|
||||||
idx[n] = int32(i)
|
idx[n] = int32(i)
|
||||||
}
|
}
|
||||||
|
|
@ -276,13 +276,14 @@ func (lv *Liveness) valueEffects(v *ssa.Value) (int32, liveEffect) {
|
||||||
return -1, 0
|
return -1, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nn := n.(*ir.Name)
|
||||||
// AllocFrame has dropped unused variables from
|
// AllocFrame has dropped unused variables from
|
||||||
// lv.fn.Func.Dcl, but they might still be referenced by
|
// lv.fn.Func.Dcl, but they might still be referenced by
|
||||||
// OpVarFoo pseudo-ops. Ignore them to prevent "lost track of
|
// OpVarFoo pseudo-ops. Ignore them to prevent "lost track of
|
||||||
// variable" ICEs (issue 19632).
|
// variable" ICEs (issue 19632).
|
||||||
switch v.Op {
|
switch v.Op {
|
||||||
case ssa.OpVarDef, ssa.OpVarKill, ssa.OpVarLive, ssa.OpKeepAlive:
|
case ssa.OpVarDef, ssa.OpVarKill, ssa.OpVarLive, ssa.OpKeepAlive:
|
||||||
if !n.Name().Used() {
|
if !nn.Name().Used() {
|
||||||
return -1, 0
|
return -1, 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -305,7 +306,7 @@ func (lv *Liveness) valueEffects(v *ssa.Value) (int32, liveEffect) {
|
||||||
return -1, 0
|
return -1, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if pos, ok := lv.idx[n]; ok {
|
if pos, ok := lv.idx[nn]; ok {
|
||||||
return pos, effect
|
return pos, effect
|
||||||
}
|
}
|
||||||
return -1, 0
|
return -1, 0
|
||||||
|
|
@ -356,7 +357,7 @@ type livenessFuncCache struct {
|
||||||
// Constructs a new liveness structure used to hold the global state of the
|
// 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
|
// liveness computation. The cfg argument is a slice of *BasicBlocks and the
|
||||||
// vars argument is a slice of *Nodes.
|
// 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{
|
lv := &Liveness{
|
||||||
fn: fn,
|
fn: fn,
|
||||||
f: f,
|
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
|
// Generates live pointer value maps for arguments and local variables. The
|
||||||
// this argument and the in arguments are always assumed live. The vars
|
// this argument and the in arguments are always assumed live. The vars
|
||||||
// argument is a slice of *Nodes.
|
// 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++ {
|
for i := int32(0); ; i++ {
|
||||||
i = liveout.Next(i)
|
i = liveout.Next(i)
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue