This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ping] Change static chain to r11 on aarch64


Hi,

>> On 12 Dec 2018, at 18:21, Richard Earnshaw (lists) <Richard.Earnshaw@arm.com> wrote:
>
>>  However, that introduces an issue that that
>> code is potentially used across multiple versions of gcc, with
>> potentially different choices of the static chain register.  Hmm, this
>> might need some more careful thought....

The static chain is only used inside nested functions, so it's not an ABI but a
function-local agreement. Although it looks like you can take the address of
a nested function, I think you cannot ever export it in a way that exposes a
different static chain given each address-taken nested function would emit
its own trampoline on the stack.

In fact the trampoline implementation is broken by design since the stack
should not be executable by default.

>> I'm also not keen on the fact that we are now seriously eating into the
>> space of call clobbered registers; what's the argument behind your
>> selection of r11 as opposed to any other register?

The static chain register is only used on entry to a nested function. That's why
I suggested using x9 given x8 is the last argument register.

> suggested r9, then I discovered that r9 and r10 were used
> by the stack probing mechanism, so I just picked the following
> one that didn't seem to be used for other purposes already.

We could rename those temporaries if we think x9 is better than x11.

Wilco

    

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]