diff options
author | Cherry Zhang <cherryyz@google.com> | 2019-10-28 00:49:13 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2019-11-07 19:20:03 +0000 |
commit | 24e549a717d1e083e7bef9003bce124294e9e975 (patch) | |
tree | f44b6013f28eadab4ad4b29b7ec461dc0af78d46 /src/cmd/compile/internal/ppc64 | |
parent | a96cfa75c6d0733fc96c5b6318351090b2acc52d (diff) | |
download | go-24e549a717d1e083e7bef9003bce124294e9e975.tar.gz go-24e549a717d1e083e7bef9003bce124294e9e975.zip |
cmd/compile, cmd/internal/obj/ppc64: use LR for indirect calls
On PPC64, indirect calls can be made through LR or CTR. Currently
both are used. This CL changes it to always use LR.
For async preemption, to return from the injected call, we need
an indirect jump back to the PC we preeempted. This jump can be
made through LR or CTR. So we'll have to clobber either LR or CTR.
Currently, LR is used more frequently. In particular, for a leaf
function, LR is live throughout the function. We don't want to
make leaf functions nonpreemptible. So we choose CTR for the call
injection. For code sequences that use CTR, if it is ok to use
another register, change it to.
Plus, it is a call so it will clobber LR anyway. It doesn't need
to also clobber CTR (even without preemption).
Change-Id: I07bd0e93b94a1a3aa2be2cd465801136165d8ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/203822
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ppc64')
-rw-r--r-- | src/cmd/compile/internal/ppc64/ssa.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ppc64/ssa.go b/src/cmd/compile/internal/ppc64/ssa.go index 4af6e9d5ed..73d1d9d3a0 100644 --- a/src/cmd/compile/internal/ppc64/ssa.go +++ b/src/cmd/compile/internal/ppc64/ssa.go @@ -1239,14 +1239,14 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { p.From.Type = obj.TYPE_REG p.From.Reg = v.Args[0].Reg() p.To.Type = obj.TYPE_REG - p.To.Reg = ppc64.REG_CTR + p.To.Reg = ppc64.REG_LR if v.Args[0].Reg() != ppc64.REG_R12 { v.Fatalf("Function address for %v should be in R12 %d but is in %d", v.LongString(), ppc64.REG_R12, p.From.Reg) } pp := s.Call(v) - pp.To.Reg = ppc64.REG_CTR + pp.To.Reg = ppc64.REG_LR if gc.Ctxt.Flag_shared { // When compiling Go into PIC, the function we just |