Re: How to tell reload to properly store a register?

2011-05-02 Thread Georg-Johann Lay
H.J. Lu schrieb:
> On Sat, Apr 30, 2011 at 6:18 AM, Georg-Johann Lay  wrote:
>> H.J. Lu schrieb:
>>> My target needs a scratch register to store a register in one register
>>> class
>>> and it needs to use memory to copy from one register class to another.
>>> I have store and reload_out patterns for those registers.  When reload
>>> tries to copy data from one register class to another, it just stores the
>>> register without using the proper reload_out pattern which has a scratch
>>> register.
>>>
>>> How can I tell reload to always use a scratch register when storing a
>>> register?
>> Did you define the TARGET_SECONDARY_RELOAD hook?
>>
> 
> I did. I have
> 
>   if (!in_p && MEM_P (x))
> {
>   sri->icode = direct_optab_handler (reload_out_optab, mode);
>   return NO_REGS;
> }
> 
> 
> Somehow, it isn't used when reloading
> 
> set (regclass1:SF) (regclass2:SF)

But in that case MEM_P is false, these are two REG_Ps.

> Reload just calls emit_move_insn directly to store regclass2.

Johann



Re: How to tell reload to properly store a register?

2011-04-30 Thread H.J. Lu
On Sat, Apr 30, 2011 at 6:18 AM, Georg-Johann Lay  wrote:
> H.J. Lu schrieb:
>>
>> My target needs a scratch register to store a register in one register
>> class
>> and it needs to use memory to copy from one register class to another.
>> I have store and reload_out patterns for those registers.  When reload
>> tries to copy data from one register class to another, it just stores the
>> register without using the proper reload_out pattern which has a scratch
>> register.
>>
>> How can I tell reload to always use a scratch register when storing a
>> register?
>
> Did you define the TARGET_SECONDARY_RELOAD hook?
>

I did. I have

  if (!in_p && MEM_P (x))
{
  sri->icode = direct_optab_handler (reload_out_optab, mode);
  return NO_REGS;
}


Somehow, it isn't used when reloading

set (regclass1:SF) (regclass2:SF)

Reload just calls emit_move_insn directly to store regclass2.


-- 
H.J.


Re: How to tell reload to properly store a register?

2011-04-30 Thread Georg-Johann Lay

H.J. Lu schrieb:

My target needs a scratch register to store a register in one register class
and it needs to use memory to copy from one register class to another.
I have store and reload_out patterns for those registers.  When reload
tries to copy data from one register class to another, it just stores the
register without using the proper reload_out pattern which has a scratch
register.

How can I tell reload to always use a scratch register when storing a
register?


Did you define the TARGET_SECONDARY_RELOAD hook?



Thanks.