mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: request r12 for indirect calls on ppc64le
On ppc64le, functions compiled with -shared expect r12 to hold the function's address for indirect calls. Previously this was enforced by generating a move instruction if the address wasn't already in r12. This change avoids that extra move by requesting r12 in the CALL ops that do indirect calls. As a result of adding support for plugins on ppc64le, it was discovered that there would be more cases where this extra move was needed, so this seemed like a better solution. Updates #20756 Change-Id: I6770885a46990f78c6d2902a715dcdaa822192a1 Reviewed-on: https://go-review.googlesource.com/62890 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
818353022e
commit
b74b43de68
4 changed files with 11 additions and 25 deletions
|
|
@ -562,12 +562,6 @@ func (s *regAllocState) init(f *Func) {
|
|||
if s.f.Config.ctxt.Framepointer_enabled && s.f.Config.FPReg >= 0 {
|
||||
s.allocatable &^= 1 << uint(s.f.Config.FPReg)
|
||||
}
|
||||
if s.f.Config.ctxt.Flag_shared {
|
||||
switch s.f.Config.arch {
|
||||
case "ppc64le": // R2 already reserved.
|
||||
s.allocatable &^= 1 << 12 // R12
|
||||
}
|
||||
}
|
||||
if s.f.Config.LinkReg != -1 {
|
||||
if isLeaf(f) {
|
||||
// Leaf functions don't save/restore the link register.
|
||||
|
|
@ -587,7 +581,7 @@ func (s *regAllocState) init(f *Func) {
|
|||
case "arm":
|
||||
s.allocatable &^= 1 << 9 // R9
|
||||
case "ppc64le": // R2 already reserved.
|
||||
s.allocatable &^= 1 << 12 // R12
|
||||
// nothing to do
|
||||
case "arm64":
|
||||
// nothing to do?
|
||||
case "386":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue