GIMPLE pass - Assignment evaluation

Sandeep K Chaudhary babbusandy2006@gmail.com
Wed Jul 10 08:18:00 GMT 2013


Hi everyone,

Can someone please help me with this?

To briefly reiterate my issue (referring to my original post), how can
I get the calculations on RHS in GIMPLE pass using some optimizations
if possible? I tried to use the optimization flags as suggested by
Marc but it does not work.

Thanks and regards,
Sandeep.

On Tue, Jul 2, 2013 at 1:09 PM, Sandeep K Chaudhary
<babbusandy2006@gmail.com> wrote:
> 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.



-- 
Thanks and regards,
Sandeep K Chaudhary.



More information about the Gcc-help mailing list