• Cherry Zhang's avatar
    cmd/compile, cmd/internal/obj/ppc64: use LR for indirect calls · 24e549a7
    Cherry Zhang authored
    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: default avatarKeith Randall <khr@golang.org>
    24e549a7
ssa.go 37.6 KB