Commit eaa198f3 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: stop generating block successor vars in rewrite rules

They are left over from the days before
we had BlockKindFirst and swapSuccessors.

Change-Id: I9259d53ac2821ca4d5de5dd520ca4b78f52ecad4
Reviewed-on: https://go-review.googlesource.com/41206
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent db8437eb
...@@ -277,14 +277,6 @@ func genRules(arch arch) { ...@@ -277,14 +277,6 @@ func genRules(arch arch) {
} }
} }
// assign successor names
succs := s[2:]
for i, a := range succs {
if a != "_" {
fmt.Fprintf(w, "%s := b.Succs[%d]\n", a, i)
}
}
if cond != "" { if cond != "" {
fmt.Fprintf(w, "if !(%s) {\nbreak\n}\n", cond) fmt.Fprintf(w, "if !(%s) {\nbreak\n}\n", cond)
} }
...@@ -294,6 +286,7 @@ func genRules(arch arch) { ...@@ -294,6 +286,7 @@ func genRules(arch arch) {
newsuccs := t[2:] newsuccs := t[2:]
// Check if newsuccs is the same set as succs. // Check if newsuccs is the same set as succs.
succs := s[2:]
m := map[string]bool{} m := map[string]bool{}
for _, succ := range succs { for _, succ := range succs {
if m[succ] { if m[succ] {
...@@ -333,9 +326,6 @@ func genRules(arch arch) { ...@@ -333,9 +326,6 @@ func genRules(arch arch) {
} }
fmt.Fprintln(w, "b.swapSuccessors()") fmt.Fprintln(w, "b.swapSuccessors()")
} }
for i := 0; i < len(succs); i++ {
fmt.Fprintf(w, "_ = %s\n", newsuccs[i])
}
if *genLog { if *genLog {
fmt.Fprintf(w, "logRule(\"%s\")\n", rule.loc) fmt.Fprintf(w, "logRule(\"%s\")\n", rule.loc)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -23705,13 +23705,9 @@ func rewriteBlockgeneric(b *Block) bool { ...@@ -23705,13 +23705,9 @@ func rewriteBlockgeneric(b *Block) bool {
break break
} }
cond := v.Args[0] cond := v.Args[0]
yes := b.Succs[0]
no := b.Succs[1]
b.Kind = BlockIf b.Kind = BlockIf
b.SetControl(cond) b.SetControl(cond)
b.swapSuccessors() b.swapSuccessors()
_ = no
_ = yes
return true return true
} }
// match: (If (ConstBool [c]) yes no) // match: (If (ConstBool [c]) yes no)
...@@ -23723,15 +23719,11 @@ func rewriteBlockgeneric(b *Block) bool { ...@@ -23723,15 +23719,11 @@ func rewriteBlockgeneric(b *Block) bool {
break break
} }
c := v.AuxInt c := v.AuxInt
yes := b.Succs[0]
no := b.Succs[1]
if !(c == 1) { if !(c == 1) {
break break
} }
b.Kind = BlockFirst b.Kind = BlockFirst
b.SetControl(nil) b.SetControl(nil)
_ = yes
_ = no
return true return true
} }
// match: (If (ConstBool [c]) yes no) // match: (If (ConstBool [c]) yes no)
...@@ -23743,16 +23735,12 @@ func rewriteBlockgeneric(b *Block) bool { ...@@ -23743,16 +23735,12 @@ func rewriteBlockgeneric(b *Block) bool {
break break
} }
c := v.AuxInt c := v.AuxInt
yes := b.Succs[0]
no := b.Succs[1]
if !(c == 0) { if !(c == 0) {
break break
} }
b.Kind = BlockFirst b.Kind = BlockFirst
b.SetControl(nil) b.SetControl(nil)
b.swapSuccessors() b.swapSuccessors()
_ = no
_ = yes
return true return true
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment