This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Gimple Statement
> "Mradul Maheshwari" <mradul@cse.iitb.ac.in> writes:
>
>> I am trying to deduce the original statement from the set of gimple
>> statements. For eg.
>> These statement are in gimple
>>
>> x.0_1 = x;
>>
>> a.1_2 = (int) &a;
>>
>> *x.0_1 = a.1_2;
>>
>> their equivalent statement in c in *x = &a;
>>
>> how can I deduce this statement from these gimple statement?
>
> In what sense do you want to deduce the statement? If you want to
> deduce precisely "*x = &a", you can't. GIMPLE does not preserve all the
> information which is in the source code. There could have been
> temporary variables which have been discarded, or this assignment could
> be part of a conditional or other statement, etc. But you can see
> pretty clearly that the effect of the three GIMPLE statements you list
> above is indeed *x = &a.
>
> Ian
>
I want to deduce that the effect of these 3 statement is - that in the lhs
we are having x with 1 DEREFERENCING involved and the rhs is 'a' with
ADDRESOF involved. I want to store this information in some data structure
and then print it in a file.
This information precisely means that
-----lhs = x, dereferencing = 1, addressof = 0-----
-----rhs = a, dereferencing = 0, addressof = 1-----
I am trying to use some macros SSA_NAME_DEF_STMT and
SSA_NAME_IMM_USE_NODE. But still not able to figure out how to use them.
Mradul Maheshwari