Help with reloading FP + offset addressing mode

Joern Rennecke joern.rennecke@embecosm.com
Sat Oct 30 00:15:00 GMT 2010


Quoting Mohamed Shafi <shafitvm@gmail.com>:

> On 29 October 2010 00:06, Joern Rennecke <joern.rennecke@embecosm.com> wrote:
>> Quoting Mohamed Shafi <shafitvm@gmail.com>:
>>
>>> Hi,
>>>
>>> I am doing a port in GCC 4.5.1. For the port
>>>
>>> 1. there is only (reg + offset) addressing mode only when reg is SP.
>>> Other base registers are not allowed
>>> 2. FP cannot be used as a base register. (FP based addressing is done
>>> by copying it into a base register)
>>> In order to take advantage of FP elimination (this will create SP +
>>> offset addressing), what i did the following
>>>
>>> 1. Created a new register class (address registers + FP) and used this
>>> new class as the BASE_REG_CLASS
>>
>> Stop right there.  You need to distinguish between FRAME_POINTER_REGNUM
>> and HARD_FRAME_POINTER_REGNUM.
>>
>
> From the description given in the internals, i am not able to
> understand why you suggested this. Could you please explain this?

In order to trigger reloading of the address, you have to have a register
elimination, even if the stack pointer is not a suitable destinatination
for the elimination.  Also, if you want to reload do the work for you,
you must not lie to it about the addressing capabilities of an actual hard
register.  Hence, you need separate hard and soft frame pointers.

If you have them, but conflate them when you describe what you are doing
in your port, you are not only likely to confuse the listener/reader,
but also your documentation, your code, and ultimately yourself.



More information about the Gcc mailing list