This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,AVR]: Fix PR36467, PR49687 (better widening mul)


Vladimir Makarov wrote:
> On 07/19/2011 04:13 AM, Georg-Johann Lay wrote:
>> 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
>>
> It is hard to me to say it.  Only the experiment on several targets can
> show it and efforts of achieving this.
> 
> GCC is an old compiler.  More generally speaking, I believe in classic
> approach that at this stage (1st insn scheduling, RA) RTL insns should
> be as close as possible to real target insns.

That's what I tried with the pre-reload split:
as close as possible to real instructions.

> The splitting mechanism is mostly a consequence of an outdated method of
> partial code selection (combiner).  Moving to the classical approach is
> a huge job and might be too difficult to implement it.
>> 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.
> Again it is hard to say definitely for me.  To remove second constant
> load, reload has inheritance mechanism.  In post-reload passes, there is
> gcse for this.

Inside reloas it cannot work because the alternative to pre-reload split
is a clobber. And as the reg is inside a clobber, it cannot be reused.

It could reused after post-reload split, but as Richard mentioned post-reload
CSE runs before post-reload split. So that cannot work either.

> reload pass can combine such reloads for one insn.  But again i think
> you should try if you wan to know, reload is too complicated to
> definitely affirm something.

At least it cannot work for clobbers as explained above.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]