diff options
author | Matthew Dempsky <mdempsky@google.com> | 2020-12-06 18:13:43 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2020-12-08 01:46:57 +0000 |
commit | 6db970e20acd7caeed268fdff458609570f21c90 (patch) | |
tree | 08ef0fd6bc8586b86ca96be6b7afd106bbd1e4ab /src/cmd/compile/internal/ssa/deadstore.go | |
parent | 1c8943a6add218f6ffd86c0952372fe54b0672a4 (diff) | |
download | go-6db970e20acd7caeed268fdff458609570f21c90.tar.gz go-6db970e20acd7caeed268fdff458609570f21c90.zip |
[dev.regabi] cmd/compile: rewrite Aux uses of ir.Node to *ir.Name [generated]
Now that the only remaining ir.Node implementation that is stored
(directly) into ssa.Aux, we can rewrite all of the conversions between
ir.Node and ssa.Aux to use *ir.Name instead.
rf doesn't have a way to rewrite the type switch case clauses, so we
just use sed instead. There's only a handful, and they're the only
times that "case ir.Node" appears anyway.
The next CL will move the tag method declarations so that ir.Node no
longer implements ssa.Aux.
Passes buildall w/ toolstash -cmp.
Updates #42982.
[git-generate]
cd src/cmd/compile/internal
sed -i -e 's/case ir.Node/case *ir.Name/' gc/plive.go */ssa.go
cd ssa
rf '
ex . ../gc {
import "cmd/compile/internal/ir"
var v *Value
v.Aux.(ir.Node) -> v.Aux.(*ir.Name)
var n ir.Node
var asAux func(Aux)
strict n # only match ir.Node-typed expressions; not *ir.Name
implicit asAux # match implicit assignments to ssa.Aux
asAux(n) -> n.(*ir.Name)
}
'
Change-Id: I3206ef5f12a7cfa37c5fecc67a1ca02ea4d52b32
Reviewed-on: https://go-review.googlesource.com/c/go/+/275789
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/deadstore.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/deadstore.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssa/deadstore.go b/src/cmd/compile/internal/ssa/deadstore.go index f3ef33d670..d0446a0311 100644 --- a/src/cmd/compile/internal/ssa/deadstore.go +++ b/src/cmd/compile/internal/ssa/deadstore.go @@ -147,7 +147,7 @@ func elimDeadAutosGeneric(f *Func) { switch v.Op { case OpAddr, OpLocalAddr: // Propagate the address if it points to an auto. - n, ok := v.Aux.(ir.Node) + n, ok := v.Aux.(*ir.Name) if !ok || n.Class() != ir.PAUTO { return } @@ -158,7 +158,7 @@ func elimDeadAutosGeneric(f *Func) { return case OpVarDef, OpVarKill: // v should be eliminated if we eliminate the auto. - n, ok := v.Aux.(ir.Node) + n, ok := v.Aux.(*ir.Name) if !ok || n.Class() != ir.PAUTO { return } @@ -174,7 +174,7 @@ func elimDeadAutosGeneric(f *Func) { // for open-coded defers from being removed (since they // may not be used by the inline code, but will be used by // panic processing). - n, ok := v.Aux.(ir.Node) + n, ok := v.Aux.(*ir.Name) if !ok || n.Class() != ir.PAUTO { return } @@ -303,7 +303,7 @@ func elimUnreadAutos(f *Func) { var stores []*Value for _, b := range f.Blocks { for _, v := range b.Values { - n, ok := v.Aux.(ir.Node) + n, ok := v.Aux.(*ir.Name) if !ok { continue } @@ -335,7 +335,7 @@ func elimUnreadAutos(f *Func) { // Eliminate stores to unread autos. for _, store := range stores { - n, _ := store.Aux.(ir.Node) + n, _ := store.Aux.(*ir.Name) if seen[n] { continue } |