public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sandeep K Chaudhary <babbusandy2006@gmail.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>, gcc@gcc.gnu.org
Subject: GIMPLE pass - Assignment evaluation
Date: Mon, 16 Dec 2013 21:10:00 -0000	[thread overview]
Message-ID: <CAEEAEzV9pkYX_fkH2R=gRSJvF6P2CdGmJuMktC31rvgu_jPuYg@mail.gmail.com> (raw)

Hi Guys,

I am writing a GIMPLE pass in which I need to inspect the assignments.
For example, for the below statements, I need to find the value of the
second and third assignments which are '2' and '7'.

VAR1 = 1;
VAR1++;
VAR1 = VAR1 + 5;

But the GIMPLE IR only has the following statements i.e. no optimization.

  VAR1_2 = 1;
  VAR1_3 = VAR1_2 + 1;
  VAR1_4 = VAR1_3 + 5;

How can I make it perform calculations on RHS? Are there some flags
that I can enable?

I tried -O1 and higher optimization levels but I don't see any
difference. This is how I am building and loading my plugin...

g++ -I`g++ -print-file-name=plugin`/include -fPIC -shared -O1
gimple_pass.c -o plugin.so
g++ -fplugin=/home/sandeep/myplugin/gimple/plugin.so -O1 -c test.c

Also, I thought of going with RTL passes but RTL IR seems too complex
for my use and also it's not suitable for high level optimizations.
Please suggest.

Thanks and regards,
Sandeep.

             reply	other threads:[~2013-12-16 21:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 21:10 Sandeep K Chaudhary [this message]
2013-12-17  1:33 ` David Malcolm
2013-12-17  6:24   ` Sandeep K Chaudhary
2013-12-17  6:41     ` Uday P. Khedker
2013-12-17  7:26       ` Sandeep K Chaudhary
  -- strict thread matches above, loose matches on Subject: below --
2013-12-09 23:05 Sandeep K Chaudhary
2013-07-02  3:24 Sandeep K Chaudhary
2013-07-02  5:44 ` Marc Glisse
2013-07-02 17:09   ` Sandeep K Chaudhary
2013-07-10  8:18     ` Sandeep K Chaudhary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEEAEzV9pkYX_fkH2R=gRSJvF6P2CdGmJuMktC31rvgu_jPuYg@mail.gmail.com' \
    --to=babbusandy2006@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).