Yes I understand. I'm trying to give multiple options to the users in
order to either have this enabled or not actually.

I'm running into one issue. In order for this to work, it would be
better if I could keep the top of the frame and the stack pointer in
two separate registers. This way, whatever happens, I know where to
find the top of the frame.

I have set HARD_FRAME_POINTER_REGNUM and I have, after I store the
hard_frame_pointer on the stack and update the stack pointer generated
:

        /* Update HARD_FRAME_POINTER_REGNUM */
        insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
        RTX_FRAME_RELATED_P (insn) = 1;


At the end of the function, I load back the hard_frame_pointer and set
back the stack pointer.

However, in O3, the compiler sometimes decides that my instruction is
useless. For debugging purposes this is not good since I put the stack
pointer and the return address in fixed places relative to this frame
pointer and not the stack pointer (since the stack can move around
depending on variable arguments, it's better to use that register).

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.

Any ideas ?

Thank you very much for your input,
Jc

On Wed, Nov 4, 2009 at 11:45 AM, Ian Lance Taylor <i...@google.com> wrote:
> Jean Christophe Beyler <jean.christophe.bey...@gmail.com> writes:
>
>>> You can force your writes to the stack to not be removed by making
>>> them use UNSPEC_VOLATILE.  You would write special define_insns for
>>> this.
>>
>> Is there an architecture port that has done this already ?
>
> No, because, when given the choice, gcc prefers faster execution over
> more reliable debugging at high optimization levels.
>
> Ian
>

Reply via email to