diff options
| author | Keith Randall <khr@golang.org> | 2020-07-17 12:12:59 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2020-08-27 22:35:45 +0000 |
| commit | 8247da36621986a282c96b2abc236bbda2fdef41 (patch) | |
| tree | 2d475415cda6cd9f8532bb6ad45664ac677a5099 /src/cmd/internal/obj/util.go | |
| parent | 5c2c6d3fbf4f0a1299b5e41463847d242eae19ca (diff) | |
| download | go-8247da36621986a282c96b2abc236bbda2fdef41.tar.xz | |
cmd/compile,cmd/asm: simplify recording of branch targets
We currently use two fields to store the targets of branches.
Some phases use p.To.Val, some use p.Pcond. Rewrite so that
every branch instruction uses p.To.Val.
p.From.Val is also used in rare instances.
Introduce a Pool link for use by arm/arm64, instead of
repurposing Pcond.
This is a cleanup CL in preparation for some stack frame CLs.
Change-Id: I9055bf0a1d986aff421e47951a1dedc301c846f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/243318
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal/obj/util.go')
| -rw-r--r-- | src/cmd/internal/obj/util.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go index d020026445..a30ccf0564 100644 --- a/src/cmd/internal/obj/util.go +++ b/src/cmd/internal/obj/util.go @@ -251,10 +251,8 @@ func WriteDconv(w io.Writer, p *Prog, a *Addr) { case TYPE_BRANCH: if a.Sym != nil { fmt.Fprintf(w, "%s(SB)", a.Sym.Name) - } else if p != nil && p.Pcond != nil { - fmt.Fprint(w, p.Pcond.Pc) - } else if a.Val != nil { - fmt.Fprint(w, a.Val.(*Prog).Pc) + } else if a.Target() != nil { + fmt.Fprint(w, a.Target().Pc) } else { fmt.Fprintf(w, "%d(PC)", a.Offset) } |
