On 07.04.2014 11:49, Peter Maydell wrote: > On 7 April 2014 09:03, Claudio Fontana <claudio.font...@huawei.com> wrote: >> On 03.04.2014 21:56, Richard Henderson wrote: >>> It's obviously call-clobbered, but is otherwise unused. >>> Repurpose it as the TCG temporary. > >> Giving one last chance to the ARM guys to speak up about repurposing LR. > > Can you clarify what you think the issue is with using LR? > I think you said before but I forget :-( > My doubt was about the AAPCS64 (Procedure Call standard for the ARM 64-bit Architecture), and what the platforms in our case dictate regarding FP and LR use.
I think that LR should be ok to use, because basically the whole generated code from the prologue to the end can be seen as a single big subroutine, and there does not seem to be a clear mandate to keep LR's special significance inside subroutines at all times. The role of the registers is described in 5.1.1, where it is mentioned that "in all variants of the pcs, registers r16,r17,r29 and r30 have special roles" [...] The standard says at 5.2.3 that "conforming code" shall construct a linked list of stack frames, [...] A platform shall mandate the minimum level of conformance[...]. Options are: * It may require the frame pointer to address a valid frame record at all times, except that small subroutines which do not modify the link register may elect not to create a frame record * It may require the frame pointer to address a valid frame record at all times, except that any subroutine may elect not to create a frame record * It may permit the frame pointer register to be used as a general-purpose callee-saved register, but provide a platform-specific mechanism for external agents to reliably detect this condition * It may elect not to maintain a frame chain and to use the frame pointer register as a general-purpose callee-saved register. I think however that since the latest version of RH's patches do not repurpose FP, this is not that relevant anymore, but I think that the general question remains topical, ie, which of these options do our platforms dictate? Thanks, Claudio