Vladimir Makarov wrote:
> On 07/18/2011 04:14 PM, Richard Henderson wrote:
>> On 07/18/2011 12:15 PM, Georg-Johann Lay wrote:
>>>> However, what you've done is try very hard to work around reload
>>>> doing the Right Thing with constant spilling, namely re-generate
>>>> the constant rather than spill and restore it.  I cannot believe
>>>> that's the right way to proceed.
>>> You mean that with a clobber reload will rematerialize the constant
>>> if there are not enough registers instead of spilling it?
>>> And with an ordinary move like
>>>     (set (reg) (const_int))
>>> reload will not see that it can reaterialize it and spill it to
>>> the stack?
>> Well, it certainly didn't use to.
>>
>> Vlad, do you know what the current state of the register allocator
>> is wrt this sort of rematerialization?
>>
> Rematerialization is done in reload.  So it is the same as it was before
> IRA.
> 
> Reload should definitely rematerialize constants and I saw it many times
> when I analyzed the code generated by IRA+reload.
> 
> It will also do rematerialization of 'a hard reg + const'.

If I understand you correctly, a pre-reload split has no disadvantage
compared to a post-reload split? As oulined in
  http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01422.html

The first split is pre-reload and generates a pseudo to load the constant.
The second split is post-reload and uses a clobber reg.

The question is what's best if the constant is used more than once, e.g. used
again in similar insn.  Is one approach better than the other? Or does it not
matter at all?

The whole patch is here:
  http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01411.html

Johann

Reply via email to