Re: Address rejected by TARGET_LEGITIMATE_ADDRESS_P recreated in post reload CSE pass at -O2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23 May 2012 01:24, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:

>> It is exactly as you said.  I fixed my predicate for that instruction.
>>  So what was earlier a general_operand now checks for general_operand
>> and in addition, it checks for the operand to be a MEM (PLUS (MULT
>> (REG  CONST_INT))  SYMBOL_REF) and rejects those operands.
>
> I'm not sure I understand this, because it sounds like that MEM is
> already invalid and therefore not a general_operand.  When
> general_operand sees a MEM, it checks that the address satisfies the
> legitimate_address_p target hook, and I thought you indicated that such
> an address would fail that hook.

Oh! Yes, it didn't occur to me.  The routine
memory_address_addr_space_p() does that.

>> However, I still get the same problem.  What I noticed is that the
>> address conversion from using a REG instead of a SYMBOL_REF happens at
>> the IRA stage.  I presume it is having register pressure and since the
>> register that contains the SYMBOL_REF is used only for these kind of
>> addresses, it knocks off the REG and replaces it with the SYMBOL_REF
>> itself.  But the problem is how to make it not do so.  Does it check
>> the instruction predicates when it does this transformation in the
>> IRA?  I feel it doesn't.  It just looks at the REG_EQUIV and REG_EQUAL
>> expression lists and carries out the transformation based on that.
>
> That is what it does for the transformation, yes, but it only commits
> the transformation back to the RTL if it is valid.  At least that is how
> it is supposed to work.

Somehow, it doesn't do that.  In fact, a hint to such a possibility is
given in the comment para that immediately precedes the function
find_reload_address() in reload.c.  And again in the function
find_reloads() in reload.c around line 2770 (in version 4.5.3) wherein
it says the following:

<quote>
     Also here any references to pseudo regs that didn't get hard regs
     but are equivalent to constants get replaced in the insn itself
     with those constants.  Nobody will ever see them again.
<unquote>

I resolved this by implementing the target hook
LEGITIMIZE_RELOAD_ADDRESS wherein I check for a symbolic reference in
the two parts of a PLUS address and if I find so, I do a push_reload()
of that.  The code is not complete though since it does not handle the
many other types of addresses that might end up having a symbolic
reference.  But for now, it works.

Thanks for your help.
Regards
Ayonam



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux