This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Help with reloading
On 20 December 2010 10:56, Jeff Law <law@redhat.com> wrote:
> On 12/15/10 07:14, Mohamed Shafi wrote:
>>
>> Hi,
>>
>> I am doing a port in GCC 4.5.1.
>> The target supports storing immediate values into memory location
>> represented by a symbolic address. So in the move pattern i have given
>> constraints to represent this.
>
> Presumably the target does not support storing an immediate value into other
> MEMs? ?ie, the only store-immediate is to a symbolic memory operand, right?
>
yes you are right.
> 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?
Moreover for the pattern
(insn 27 25 33 4 pr23848-3.c:12 (set (mem/s/j:QI (reg/f:PQI 12 as0
[69]) [0 S1 A32])
(reg:QI 93)) 7 {movqi_op} (expr_list:REG_DEAD (reg/f:PQI 12 as0 [69])
(expr_list:REG_EQUAL (const_int 0 [0x0])
(nil))))
destination is the src operand gets converted by
/* This is equivalent to calling find_reloads_toplev.
The code is duplicated for speed.
When we find a pseudo always equivalent to a constant,
we replace it by the constant. We must be sure, however,
that we don't try to replace it in the insn in which it
is being set. */
int regno = REGNO (recog_data.operand[i]);
if (reg_equiv_constant[regno] != 0
&& (set == 0 || &SET_DEST (set) != recog_data.operand_loc[i]))
{
/* Record the existing mode so that the check if constants are
allowed will work when operand_mode isn't specified. */
if (operand_mode[i] == VOIDmode)
operand_mode[i] = GET_MODE (recog_data.operand[i]);
substed_operand[i] = recog_data.operand[i]
= reg_equiv_constant[regno];
}
and since the destination is already selected for reload
/* If the address was already reloaded,
we win as well. */
else if (MEM_P (operand)
&& address_reloaded[i] == 1)
win = 1;
the reload phase never reaches secondary reload.
So i do not understand your answer. Could you explain it briefly.
Regards,
Shafi