how to set some value at a memory location in stack
Vaibhav Shrimali
vaibhav.shrimali@gmail.com
Tue Apr 13 06:20:00 GMT 2010
I wanted to know : how to set some value at a particular memory
location on the stack.
Suppose I want to set a value stored in a rtx type variable to a
memory location.
Is the following code correct?
I need to read a particular memory location, then XOR it with the hard
frame pointer and then store it back in its place.
will this code work?
Note: Here at (argument pointer - 8) location, I am pushing a copy of
return address earlier and after that the hard_frame_pointer is
pushed.
Now, I want to XOR the duplicate return address with the new
hard_frame_pointer_rtx generated after pushing the frame pointer on
the stack.
I wanted to know that will this code work to do the task?
arg_ptr = cfun->machine->force_align_arg_pointer;
r = gen_rtx_PLUS (Pmode, arg_ptr, -8);
r = gen_rtx_MEM (Pmode, r);
m = force_reg(Pmode,r); // OR : m = copy_to_mode_reg(Pmode, r);
m1 = simplify_binary_operation(XOR, Pmode, m, hard_frame_pointer_rtx);
set1 = emit_insn(gen_rtx_SET (Pmode,r, m1));
RTX_FRAME_RELATED_P (set1) = 1;
If not, please guide me with some solution that would allow me to
write a rtx variable value to a particular memory location.
Thank You
Waiting for an urgent reply from the community.
Thank You again.
Regards
--
Vaibhav Shrimali
BTech(ICT), DA-IICT
Gandhinagar
More information about the Gcc-help
mailing list