Does IRA support spilling to registers instead of stack?

Vladimir Makarov vmakarov@redhat.com
Tue Jul 19 15:45:00 GMT 2011


On 07/19/2011 11:21 AM, Jeff Law wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 07/19/11 07:33, Vladimir Makarov wrote:
>> On 07/18/2011 05:20 PM, dpadgett_mail-000@yahoo.com wrote:
>>> Hello,
>>>
>>> Does gcc IRA provide a mechanism to support spilling to registers
>>> instead of the stack?  For the particular target I'm looking at, there
>>> are some non-general-purpose registers that can be copied to and from
>>> more quickly than the stack, so would be preferable to use as a form
>>> of shareable spill slot in some cases.  One limitation, which is
>>> perhaps a significant one, is that these registers are not callee
>>> save, so one would only want to save to and restore from them when
>>> there is no intervening function call. If there is no current support
>>> for such a mechanism, any opinions on the value and practicality of
>>> adding one would be much appreciated.
>>>
>>> Thanks, Don
>> It might work for new IRA without cover classes.
>>
>> Pseudos will have classes containing usual registers and these special
>> registers because they are really less costly than memory.  If a pseudo
>> crosses a call, the special registers could be more costly than memory.
>>
>> All you need is to define the right costs for register and memory move
>> cost hooks to achieve better costs for regular registers, worse costs
>> for the special registers, and the worst cost for memory.  If the pseudo
>> intersects the call, the worst cost should be for the special
>> registers.  It can be achieved by right definition of move cost between
>> special registers and memory.
> Note that if these registers are not available for other operations such
> as arithmetic, logicals, etc, then they won't be used for spilling where
> the range of the pseudo contains such operations.  So merely getting the
> costs right is only part of the solution, the other part is to
> intelligently split the range of the pseudo.
As I understood, the special registers are needed to keep pseudo 
values.  IRA could assign the special registers if all regular registers 
are assigned to more important pseudos.  Reload could reload them to 
regular registers (it probably needs spilling one or two regular 
registers).  That is still better than usage of memory for them.

If special registers should be used only for keeping pseudo values for 
some its live ranges, than some splitting is necessary.

It is hard for me to say now what is better approach: spilling only + 
inheritance (as reload does) or just splitting.  There are cons and pros 
of each approach.  LRA now uses the 1st approach but it could be 
modified with moderate efforts to 2nd one (or even mix of the both).

You are definitely right that caller-saves task is much easy in the 2nd 
approach.  It is just a natural subtask for live range splitting.



More information about the Gcc mailing list