Callee-saved registers

Christian Wimmer christian.wimmer at oracle.com
Wed Sep 18 13:07:30 PDT 2013



On 09/18/2013 12:22 PM, D.Sturm wrote:
> I saw that AMD64 has some (dead) code there in the FrameContext, but for
> large numbers of registers that can be pretty inefficient, especially
> for smaller methods (the official ARM Aarch64 ABI specifies 20
> callee-saved registers, so that'd be a lot of possibly unnecessary
> save/restore.. and also blow up the stack frame excessively).
 >
> I assume I could use caller-saved registers only (and make the easy
> optimization for external calls to save only the necessary subset), but
> with the large number of registers available that doesn't seem too
> efficient, although with enough inlining it probably wouldn't matter too
> much.

The ABI that HotSpot uses internally has nothing to do with the 
"official" ABI for an architecture or platform. So you have to check 
what HotSpot expects you to do - since you certainly do not want to make 
changes to the HotSpot runtime.

> Would it be possible to insert a LIRNode in the prologue that stores all
> callee-saved registers in an array with @Alive annotation and do the
> same for all epilogue instructions? Wouldn't that cause the
> RegisterAllocator to spill the registers if necessary?

No, there is currently no support in the register allocator for things 
like that. Basically, you need to find out if a register is used at all, 
and only spill it then in the prologue/epilogue. It shouldn't be 
difficult to find out if a register was ever used, but it is not 
implemented yet.

-Christian


More information about the graal-dev mailing list