This is the mail archive of the gcc@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: Help with reloading


On 20 December 2010 19:30, Jeff Law <law@redhat.com> wrote:
> On 12/20/10 01:47, Mohamed Shafi wrote:
>>
>>
>>> I think this is a case where you're going to need a secondary reload to
>>> force the immediate into a register if the destination is a non-symbolic
>>> MEM
>>> or a pseudo without a hard reg and its equivalent address is
>>> non-symbolic.
>>>
>> ? ? I am not sure how i should be implementing this.
>> ? ? Currently in define_expand for move i have code to force the
>> immediate value into a register if the destination is not a symbolic
>> address. If i understand correctly this is the only place where i can
>> decide what to do with the source depending on the destination. right?
>
> Just changing the movxx expander is not sufficient since for this case you
> do not know until reload time whether or not a particular insn needs an
> extra register to implement the move. ? That's the whole point of the
> secondary reload mechanism -- to allow you to allocate a scratch register
> during reloading to handle oddball cases like this.
>
>
> In your secondary reload code you'll need to check for the case where the
> destination is a MEM and the source is an unallocated pseudo with a constant
> equivalent and return a suitable register class for that case.
>
   Jeff, thanks for the reply.
   I didn't know that you could do that in TARGET_SECONDARY_RELOAD
hook. Can you point me to some target that does this - figuring out
what the destination is based on the source or vice versa. In my case
only the address operand comes into TARGET_SECONDARY_RELOAD hook
during the reload pass. I am not sure how to find out the source for
the pattern which has this particular address as the destination.

Sorry for the trouble.

Shafi


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