public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on Gimple Tree
       [not found] <8f14e1ab0912221838t19438b3es6092755c3838d389@mail.gmail.com>
@ 2009-12-23 10:40 ` Srinivas Pasupuleti
  2009-12-23 16:13   ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pasupuleti @ 2009-12-23 10:40 UTC (permalink / raw)
  To: gcc-help

Hello,

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.

Please provide your comments. It will be greatly helpful.

Thanks,
Srinivas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question on Gimple Tree
  2009-12-23 10:40 ` Question on Gimple Tree Srinivas Pasupuleti
@ 2009-12-23 16:13   ` Ian Lance Taylor
  2009-12-23 16:15     ` Srinivas Pasupuleti
       [not found]     ` <8f14e1ab0912230809g367b3202ka8123b83ddc2ca93@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2009-12-23 16:13 UTC (permalink / raw)
  To: Srinivas Pasupuleti; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question on Gimple Tree
  2009-12-23 16:13   ` Ian Lance Taylor
@ 2009-12-23 16:15     ` Srinivas Pasupuleti
       [not found]     ` <8f14e1ab0912230809g367b3202ka8123b83ddc2ca93@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Srinivas Pasupuleti @ 2009-12-23 16:15 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Thanks Ian for your prompt response.

So, what is the alternate way to do memory read/write profiling....I'm
aware of CIL source transformation package which allows to log memory
reads and memory writes..

Is something similar possible to do in GCC... Do I have to work on AST
level instead of GIMPLE and include statements to log all memory reads
and writes? Please suggest.

Thanks,
Srinivas

On Wed, Dec 23, 2009 at 10:16 AM, Ian Lance Taylor <iant@google.com> wrote:
> 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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question on Gimple Tree
       [not found]     ` <8f14e1ab0912230809g367b3202ka8123b83ddc2ca93@mail.gmail.com>
@ 2009-12-24  7:07       ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2009-12-24  7:07 UTC (permalink / raw)
  To: Srinivas Pasupuleti; +Cc: gcc-help

Srinivas Pasupuleti <vaasu1234@gmail.com> writes:

> So, what is the alternate way to do memory read/write profiling....I'm
> aware of CIL (http://hal.cs.berkeley.edu/cil/)  source transformation
> package which allows to log memory reads and memory writes..
>
> Is something similar possible to do in GCC... Do I have to work on AST
> level instead of GIMPLE and include statements to log all memory reads
> and writes? Please suggest.

I think it depends on what you mean by memory reads and writes.  If
you want to track every single memory read and write, you will need to
work at the RTL level.  If you want to track all changes to user
variables, then do that at the GIMPLE level; I don't think of a user
variable as a GIMPLE variable.

Ian

> On Wed, Dec 23, 2009 at 10:16 AM, Ian Lance Taylor <iant@google.com> wrote:
>> 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
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-23 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <8f14e1ab0912221838t19438b3es6092755c3838d389@mail.gmail.com>
2009-12-23 10:40 ` Question on Gimple Tree Srinivas Pasupuleti
2009-12-23 16:13   ` Ian Lance Taylor
2009-12-23 16:15     ` Srinivas Pasupuleti
     [not found]     ` <8f14e1ab0912230809g367b3202ka8123b83ddc2ca93@mail.gmail.com>
2009-12-24  7:07       ` Ian Lance Taylor

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).