This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question on Gimple Tree


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]