This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Extracting operand name and value from GIMPLE assignment statements
- From: Sandeep K Chaudhary <babbusandy2006 at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 9 Dec 2013 21:38:41 -0500
- Subject: Re: Extracting operand name and value from GIMPLE assignment statements
- Authentication-results: sourceware.org; auth=none
- References: <CAEEAEzV+ALbhUr2PkmQX7qdr3HQskVLZ7uKguLN4QTjhhbmCKw at mail dot gmail dot com> <CAKOQZ8zOPpDDLKM2GvrDOR+WnsSJEo1WAEWbmJ11tygcu=Mtkg at mail dot gmail dot com>
Hi Ian,
Thanks for the reply !
I mean that I am interested in knowing the name of variables from the
code. For example - if there is a statement in the C code like this -
"VAR_A = 100;"
I would like to know the name of the variable i.e. "VAR_A" in the
GIMPLE statement. Please let me know how this can be achieved.
Thanks and regards,
Sandeep.
On Mon, Dec 9, 2013 at 9:13 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Mon, Dec 9, 2013 at 3:05 PM, Sandeep K Chaudhary
> <babbusandy2006@gmail.com> wrote:
>>
>> I am writing a GCC plugin in which I need to extract the variable name
>> and the assigned value from the statements.
>>
>> I am able to get the three operands from GIMPLE statements like this
>>
>> if(is_gimple_assign(stmt)) {
>> tree lhsop = gimple_assign_lhs(stmt);
>> tree rhsop1 = gimple_assign_rhs1(stmt);
>> tree rhsop2 = gimple_assign_rhs2(stmt);
>> }
>>
>> I want to get the exact variable name from lhsop and value from rhsop1
>> (for statements such as
>> "var = value;", rhsop2 is 0 for such statements.). Some pointers to
>> example code or documentation would be great.
>
> Can you expand on what you mean by the variable name? GCC freely
> introduces and discards variables in GIMPLE. Many GIMPLE variables do
> not have any meaningful name.
>
> Ian
--
Thanks and regards,
Sandeep K Chaudhary.