Callee-saved registers
Christian Wimmer
christian.wimmer at oracle.com
Wed Sep 18 11:50:15 PDT 2013
When you define callee-saved registers in your calling convention, the
method prologue/epilogue code (the FrameContext.enter/leave) methods do
the spilling and reloading. Not overly efficient, but it should work.
HotSpot (at least on x86) does not use callee saved registers to
simplify the internal systems, so are you sure you really need them?
-Christian
On 09/18/2013 11:17 AM, D.Sturm wrote:
> What is the best way to handle callee saved registers in the backend? This
> doesn't seem to be handled by the register allocator already (since AMD64
> declares all registers caller saved and SPARC has its handy register
> windows).
>
> The easiest solution seems to introduce a placeholder LIR instruction in
> the prologue and make sure to spill all destroyed registers there on the
> stack and then restore them at the exit points. But that is obviously not
> especially efficient if there's more than one exit point (I'd have to
> save/restore all potentially destroyed registers).
>
>
> So is there some way to get the register allocator to spill callee-saved
> registers before using them and then restoring them at the end?
>
> -Daniel
>
More information about the graal-dev
mailing list