public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Extracting operand name and value from GIMPLE assignment statements
@ 2013-12-09 23:05 Sandeep K Chaudhary
  2013-12-10  2:14 ` Ian Lance Taylor
  0 siblings, 1 reply; 8+ messages in thread
From: Sandeep K Chaudhary @ 2013-12-09 23:05 UTC (permalink / raw)
  To: gcc-help

Hi Guys,

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. I can't find anything
similar in

http://gcc.gnu.org/onlinedocs/gccint/Manipulating-GIMPLE-statements.html

Thanks a lot !

Regards,
Sandeep K Chaudhary.

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Extracting operand name and value from GIMPLE assignment statements
@ 2013-06-26  1:08 Sandeep K Chaudhary
  0 siblings, 0 replies; 8+ messages in thread
From: Sandeep K Chaudhary @ 2013-06-26  1:08 UTC (permalink / raw)
  To: gcc-help

Hi Guys,

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. I can't find anything
similar in

http://gcc.gnu.org/onlinedocs/gccint/Manipulating-GIMPLE-statements.html

Thanks a lot !

Regards,
Sandeep K Chaudhary.

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

end of thread, other threads:[~2013-12-10 22:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 23:05 Extracting operand name and value from GIMPLE assignment statements Sandeep K Chaudhary
2013-12-10  2:14 ` Ian Lance Taylor
2013-12-10  2:38   ` Sandeep K Chaudhary
     [not found]   ` <CAEEAEzXYNvovf4SPqJqBWFx96+qX1DQ2RHY5q5i+iDXNiBgzrQ@mail.gmail.com>
2013-12-10  6:06     ` Ian Lance Taylor
2013-12-10  8:21       ` Sandeep K Chaudhary
2013-12-10 16:28         ` Ian Lance Taylor
2013-12-10 22:39           ` Sandeep K Chaudhary
  -- strict thread matches above, loose matches on Subject: below --
2013-06-26  1:08 Sandeep K Chaudhary

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