Re: how to set some value at a memory location in stack

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

 



Vaibhav Shrimali <vaibhav.shrimali@xxxxxxxxx> writes:

> now I have stored the memory location, where I need to insert my
> value, in the EDX register. I am not using force_reg() now.
> I have stored the value to be inserted in a rtx type register.
> But how do I set the value of memory location in EDX with the value
> stored in a rtx type register?
> Is there any library function which will allow me to do so?
>
> Here is my code:
>
>   if (frame_pointer_needed)
>     { rtx r, set1,m1,edx,insn,temp;
>       //Here hard frame pointer is pushed onto the stack
>       insn = emit_insn (gen_push (hard_frame_pointer_rtx));
>       RTX_FRAME_RELATED_P (insn) = 1;
>       //Here hard frame pointer is updated
>       insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
>       RTX_FRAME_RELATED_P (insn) = 1;
>
>       //my code starts from here.
>       r = cfun->machine->force_align_arg_pointer;
>       r = gen_rtx_PLUS (Pmode, r, -8);
>       r = gen_rtx_MEM (Pmode, r);
>       edx = gen_rtx_REG (Pmode, DX_REG);
>       emit_move_insn(edx,r);
>       //EDX now contains the memory location
>
>       //Here I have stored the return address pushed on the stack in ret_addr
>       //So the following code generates a rtx variable
>       //which has the value ret_addr XOR hard_frame_pointer
>
>       m1 = simplify_binary_operation(XOR, Pmode, ret_addr,
> hard_frame_pointer_rtx);
>      //now how to set memory location in edx with value m1??? Is there
> any function
>      //to do so.If not, please suggest me some other way of doing so.
>
>     }

You need to put the result of m1 somewhere.  There isn't really any
need to call simplify_binary_operation here.  To make this work, you
should know precisely which instructions you are doing to generate.
You can just generate them.  E.g.,
    emit_insn (gen_xorsi3 (DESTREG, SRC1, SRC2));

Ian

[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