how to set some value at a memory location in stack

Ian Lance Taylor iant@google.com
Thu Apr 15 15:41:00 GMT 2010


Vaibhav Shrimali <vaibhav.shrimali@gmail.com> writes:

> Thanks for all your help so far. I now think I am closer to my goal.
> In order to execute :
> XOR [EBP+4], [EBP]
> after executing :
> PUSH EBP
>
> in the prologue, I need to use : emit_insn (gen_xorsi3 (DESTREG, SRC1, SRC2));
> So I checked and I can generate a register such that:
> rtx ebp_reg = gen_rtx_REG(Pmode, BP_REG);
> this would be a hard register.
> rtx ebp_plus = gen_rtx_PLUS(Pmode, ebp_reg, 4);
>
> so now executing :-
>
> emit_insn (gen_xorsi3 (ebp_plus, ebp_plus, ebp_reg));
>
> I dont know if ebp_plus would be converted to [XOR+4] or not, although
> it is derived from the hard register ebp_reg.
>
> If I am wrong in this approach, please correct me.

At some point you have to try it and see what happens.  The dump files
will show you the generated RTL.

Ian



More information about the Gcc-help mailing list