public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Srinivas Pasupuleti <vaasu1234@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Question on Gimple Tree
Date: Wed, 23 Dec 2009 16:13:00 -0000	[thread overview]
Message-ID: <mcrk4wdoh4z.fsf@dhcp-172-17-9-151.mtv.corp.google.com> (raw)
In-Reply-To: <8f14e1ab0912221851s186a2aa4yf3fe63ccbba7be44@mail.gmail.com> (Srinivas Pasupuleti's message of "Tue\, 22 Dec 2009 21\:51\:48 -0500")

Srinivas Pasupuleti <vaasu1234@gmail.com> writes:

> I have written a pass to traverse gimple tree and include some print
> function calls with arguments as the LHS(lval) variable of every
> gimple modify statement. (this is part of my profiling work)
> I would like to know if it is possible to access the address of the
> gimple variables.
>
>  for e.g.,
>
> The following is a gimple statement (all are int variables):
> D.2629_17 = D.2629_27 + D.2629_22 ;
>
> In my pass I have added a print function call as below
> print(D.2629_17)
>
> The above works perfect
>
> I want to pass address of the gimple variable
> print(&D.2629_17)
>
> Is the above possible to do. If so, how to do it??
> I need to do for memory profiling and dynamic dependency testing.

You can't take the address of a gimple variable; think of a gimple
variable as a register in an imaginary machine.  You will have to
create a real, albeit temporary, variable and assign the gimple
variable to it.  If you want your function to change the value of the
variable, you will have to copy the value back as well.

Ian

  reply	other threads:[~2009-12-23 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8f14e1ab0912221838t19438b3es6092755c3838d389@mail.gmail.com>
2009-12-23 10:40 ` Srinivas Pasupuleti
2009-12-23 16:13   ` Ian Lance Taylor [this message]
2009-12-23 16:15     ` Srinivas Pasupuleti
     [not found]     ` <8f14e1ab0912230809g367b3202ka8123b83ddc2ca93@mail.gmail.com>
2009-12-24  7:07       ` 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=mcrk4wdoh4z.fsf@dhcp-172-17-9-151.mtv.corp.google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=vaasu1234@gmail.com \
    /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).