]> Cypherpunks repositories - gostls13.git/commit
cmd/compile, cmd/internal/obj/ppc64: use LR for indirect calls
authorCherry Zhang <cherryyz@google.com>
Mon, 28 Oct 2019 04:49:13 +0000 (00:49 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 7 Nov 2019 19:20:03 +0000 (19:20 +0000)
commit24e549a717d1e083e7bef9003bce124294e9e975
treef44b6013f28eadab4ad4b29b7ec461dc0af78d46
parenta96cfa75c6d0733fc96c5b6318351090b2acc52d
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>
src/cmd/compile/internal/ppc64/ssa.go
src/cmd/internal/obj/ppc64/obj9.go