On Mon, 17 Dec 2018, Wilco Dijkstra wrote: > H-P: > > 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.
JFTR, in gcc, it's treated as call-saved, AFAICS, with no special-casing (other than being STATIC_CHAIN_REGNUM, which by itself has no other effect). Is that a bug or deliberate? If deliberate, a comment at CALL_USED_REGISTERS would have cleared that question. The document you refer to seems to be on the fence regarding whether a compiler should treat it as call-clobbered. > 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. Sure. For one, it would avoid the bug with STATIC_CHAIN_REGNUM being call-saved. :) brgds, H-P