public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Sandeep K Chaudhary <babbusandy2006@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: GIMPLE pass - Assignment evaluation
Date: Tue, 02 Jul 2013 05:44:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.10.1307020740130.3919@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <CAEEAEzWhzF=4hQ-CNybsHSENWvGTEDXtmCGaMy1YC8DN9GXuOA@mail.gmail.com>

On Mon, 1 Jul 2013, Sandeep K Chaudhary wrote:

> 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?

-O1 (or higher) enables the CCP pass which propagates the constants. Note 
that only the last value will be left after that. If you need the 
intermediate ones for some reason, maybe you could look into the CCP pass 
and modify it for your needs?

-- 
Marc Glisse

  reply	other threads:[~2013-07-02  5:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02  3:24 Sandeep K Chaudhary
2013-07-02  5:44 ` Marc Glisse [this message]
2013-07-02 17:09   ` Sandeep K Chaudhary
2013-07-10  8:18     ` Sandeep K Chaudhary
2013-12-09 23:05 Sandeep K Chaudhary
2013-12-16 21:10 Sandeep K Chaudhary
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

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=alpine.DEB.2.10.1307020740130.3919@laptop-mg.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --cc=babbusandy2006@gmail.com \
    --cc=gcc-help@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).