public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vaibhav Shrimali <vaibhav.shrimali@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: how to set some value at a memory location in stack
Date: Tue, 13 Apr 2010 06:20:00 -0000	[thread overview]
Message-ID: <t2ocf2132031004122319s82a3daa6wb57babd92d7cb214@mail.gmail.com> (raw)

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

             reply	other threads:[~2010-04-13  6:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13  6:20 Vaibhav Shrimali [this message]
2010-04-14  0:21 ` Ian Lance Taylor
2010-04-14  4:08   ` Vaibhav Shrimali
2010-04-14  5:10     ` Ian Lance Taylor
2010-04-14 11:17       ` Vaibhav Shrimali
2010-04-14 15:53         ` Ian Lance Taylor
2010-04-15  4:57           ` Vaibhav Shrimali
2010-04-15  8:03             ` Ian Lance Taylor
2010-04-15  8:36               ` Vaibhav Shrimali
2010-04-15 15:41                 ` Ian Lance Taylor
2010-04-16  5:44                   ` Vaibhav Shrimali
2010-04-16  8:35                     ` Ian Lance Taylor
2010-04-16  8:46                       ` Vaibhav Shrimali
2010-04-16 10:01                         ` Vaibhav Shrimali
2010-04-16 19:57                           ` Ian Lance Taylor
2010-04-16 16:19                         ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=t2ocf2132031004122319s82a3daa6wb57babd92d7cb214@mail.gmail.com \
    --to=vaibhav.shrimali@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).