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 Hans-Peter,

> While the choice of static-chain register does not affect the
> ABI, it's the other way round: the choice of static-chain
> register matters, specifically it's call-clobberedness.

Agreed.

> It looks like the current aarch64 static-chain register R18 is
> call-saved but without special provisions to save and restore
> the static chain register, i.e. the port is broken wrt.
> trampolines but may appear to work (likely as-if you got the
> call-clobberedness wrong for a special case; I haven't
> investigated).  I understand the i386 port gets this right.
> The CRIS port does not, but attempts and adds another bug (you
> can't use the trampoline as a register-save area on return).

> So, changing from R18 to R11 for aarch64 seems right, as the
> latter is call-clobbered and the former is call-saved IIUC.

The AArch64 ABI defines x18 as platform specific:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf
On Linux it is call-clobbered, but it could be a fixed register on other
platforms (eg. a thread-local pointer). I don't think it's possible to make
it a callee-save. Still it is the wrong register to use since it already has
different uses. Using x9 would make its use as an extra argument clearer.

Wilco

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