summaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/pass.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-08-27 23:34:32 +0000
committerBryan C. Mills <bcmills@google.com>2020-08-28 02:10:13 +0000
commit26ad27bb026a34149ad0b1d7d56723c8b5dee3d7 (patch)
tree3d20422f8e65669919ac9980c0868d6508d8f544 /src/cmd/internal/obj/pass.go
parent42fd1306cea2dc2ff91bd5208d9593721ab5a30f (diff)
downloadgo-git-26ad27bb026a34149ad0b1d7d56723c8b5dee3d7.tar.gz
Revert "cmd/compile,cmd/asm: simplify recording of branch targets"
This reverts CL 243318. Reason for revert: Seems to be crashing some builders. Change-Id: I2ffc59bc5535be60b884b281c8d0eff4647dc756 Reviewed-on: https://go-review.googlesource.com/c/go/+/251169 Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/internal/obj/pass.go')
-rw-r--r--src/cmd/internal/obj/pass.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cmd/internal/obj/pass.go b/src/cmd/internal/obj/pass.go
index 09d520b4e9..4f156d969b 100644
--- a/src/cmd/internal/obj/pass.go
+++ b/src/cmd/internal/obj/pass.go
@@ -36,8 +36,8 @@ package obj
// In the case of an infinite loop, brloop returns nil.
func brloop(p *Prog) *Prog {
c := 0
- for q := p; q != nil; q = q.To.Target() {
- if q.As != AJMP || q.To.Target() == nil {
+ for q := p; q != nil; q = q.Pcond {
+ if q.As != AJMP || q.Pcond == nil {
return q
}
c++
@@ -132,6 +132,8 @@ func linkpatch(ctxt *Link, sym *LSym, newprog ProgAlloc) {
continue
}
if p.To.Val != nil {
+ // TODO: Remove To.Val.(*Prog) in favor of p->pcond.
+ p.Pcond = p.To.Val.(*Prog)
continue
}
@@ -156,7 +158,8 @@ func linkpatch(ctxt *Link, sym *LSym, newprog ProgAlloc) {
p.To.Type = TYPE_NONE
}
- p.To.SetTarget(q)
+ p.To.Val = q
+ p.Pcond = q
}
if !ctxt.Flag_optimize {
@@ -165,12 +168,12 @@ func linkpatch(ctxt *Link, sym *LSym, newprog ProgAlloc) {
// Collapse series of jumps to jumps.
for p := sym.Func.Text; p != nil; p = p.Link {
- if p.To.Target() == nil {
+ if p.Pcond == nil {
continue
}
- p.To.SetTarget(brloop(p.To.Target()))
- if p.To.Target() != nil && p.To.Type == TYPE_BRANCH {
- p.To.Offset = p.To.Target().Pc
+ p.Pcond = brloop(p.Pcond)
+ if p.Pcond != nil && p.To.Type == TYPE_BRANCH {
+ p.To.Offset = p.Pcond.Pc
}
}
}