This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: loops problem
- From: Ian Lance Taylor <iant at google dot com>
- To: Abdul Wahid Memon <engrwahidmemon at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 18 May 2011 17:28:45 -0700
- Subject: Re: loops problem
- References: <BANLkTinpu8n4GKAhJBwW0v_g0HUj9QAXTQ@mail.gmail.com>
Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
> I am facing some problem at obtaining the number of loops in the source program.
> I am trying to use a function number_of_loops defined in cfgloop.h
> with the help of plugin.
>
> I have tried to capture this at both GIMPLE level after copy headers
> pass where I always get the value of 0,
> because the condition if (!current_loops) return 0; is (I think)
> always becoming true and the same thing happens
> at RTL after 'loop2_init' pass but I get the value of 1 even in the
> presence or in the absence of any loop.
>
> This is the first time I am playing with GCC plugins. Please help me
> out with this issue.
>
> PS: The passes after which I am puting my passes are definitely
> producing the information about the loops as
> can be seen from the dumps produced by copy headers pass and loop
> initialization.
If you want to call number_of_loops you need to call loop_optimizer_init
at the start of your pass and loop_optimizer_finalize at the end of it.
Ian