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
Subject: Re: GIMPLE pass - Assignment evaluation
Date: Tue, 02 Jul 2013 17:09:00 -0000	[thread overview]
Message-ID: <CAEEAEzXb0-EnPzgq-omz23K6k+Et=Eyo2AfMHW5WYH=70UwfWQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1307020740130.3919@laptop-mg.saclay.inria.fr>

Hi Marc ! Thanks for the reply.

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

Am I supposed to use "-O1" differently to invoke the CCP pass?

Regards,
Sandeep.

On Tue, Jul 2, 2013 at 1:44 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> 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



-- 
Thanks and regards,
Sandeep K Chaudhary.

  reply	other threads:[~2013-07-02 17:09 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
2013-07-02 17:09   ` Sandeep K Chaudhary [this message]
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='CAEEAEzXb0-EnPzgq-omz23K6k+Et=Eyo2AfMHW5WYH=70UwfWQ@mail.gmail.com' \
    --to=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).