I actually already did put it as a fixed register using the
FIXED_REGISTER macro. However, I have not yet tested the EPILOGUE_USES
because it said that : "The stack and frame pointer are already
assumed to be used as needed".

My current port defines a different FRAME_POINTER_REGNUM from the
HARD_FRAME_POINTER_REGNUM. I have this because before register
allocation it is not possible to know the offset as it is said in the
Internals.

Basically, my code looks like this:

move stack pointer down
conditional trap on stack pointer

store on stack the return address
store on stack the frame pointer HARD_FRAME_POINTER_REGNUM (it's the
old one so that we know where it started)
mov HARD_FRAME_POINTER_REGNUM, stack_pointer

... Function code ...

restore return address
restore HARD_FRAME_POINTER_REGNUM
mov stack_pointer, HARD_FRAME_POINTER_REGNUM

This seemed like the simplest solution but it seems to be that,
because I restore it in the epilogue, it considers the move as being
useless since it doesn't realize it is needed by subsequent function
calls in the function code.

Thanks for any input,
Jc

On Mon, Nov 9, 2009 at 10:40 AM, Ian Lance Taylor <i...@google.com> wrote:
> Jean Christophe Beyler <jean.christophe.bey...@gmail.com> writes:
>
>> How can I force the prologue to keep this instruction. It is useless
>> only in the case that there is no function call or no alloca. But I
>> have a case where there is a function call and it is still removed.
>
> Make the hard frame pointer register a fixed register, or add it to
> EPILOGUE_USES.
>
> Ian
>

Reply via email to