public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* loops problem
@ 2011-05-18 15:48 Abdul Wahid Memon
  2011-05-19  0:39 ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Abdul Wahid Memon @ 2011-05-18 15:48 UTC (permalink / raw)
  To: gcc-help

Hello everyone

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.

Regards

Abdul

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-18 15:48 loops problem Abdul Wahid Memon
@ 2011-05-19  0:39 ` Ian Lance Taylor
  2011-05-19 15:58   ` Abdul Wahid Memon
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2011-05-19  0:39 UTC (permalink / raw)
  To: Abdul Wahid Memon; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19  0:39 ` Ian Lance Taylor
@ 2011-05-19 15:58   ` Abdul Wahid Memon
  2011-05-19 17:16     ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Abdul Wahid Memon @ 2011-05-19 15:58 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Thanks alot. Its working well at GIMPLE but for RTL, it is again
posing a problem of internal compiler error.

Regards

Abdul

On Thu, May 19, 2011 at 2:28 AM, Ian Lance Taylor <iant@google.com> wrote:
> 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
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19 15:58   ` Abdul Wahid Memon
@ 2011-05-19 17:16     ` Ian Lance Taylor
  2011-05-19 17:27       ` Abdul Wahid Memon
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2011-05-19 17:16 UTC (permalink / raw)
  To: Abdul Wahid Memon; +Cc: gcc-help

Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:

> Thanks alot. Its working well at GIMPLE but for RTL, it is again
> posing a problem of internal compiler error.

loop_optimizer_init does work for RTL passes, so you are going to have
to debug what is going wrong.

Ian

> On Thu, May 19, 2011 at 2:28 AM, Ian Lance Taylor <iant@google.com> wrote:
>> 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
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19 17:16     ` Ian Lance Taylor
@ 2011-05-19 17:27       ` Abdul Wahid Memon
  2011-05-19 17:29         ` Abdul Wahid Memon
  2011-05-19 18:03         ` Ian Lance Taylor
  0 siblings, 2 replies; 10+ messages in thread
From: Abdul Wahid Memon @ 2011-05-19 17:27 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Thanks alot Ian. Actually it is working but when there is only once
function in the source file. What to do when there are more than one
functions.
Thanks

Abdul

On Thu, May 19, 2011 at 6:59 PM, Ian Lance Taylor <iant@google.com> wrote:
> Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
>
>> Thanks alot. Its working well at GIMPLE but for RTL, it is again
>> posing a problem of internal compiler error.
>
> loop_optimizer_init does work for RTL passes, so you are going to have
> to debug what is going wrong.
>
> Ian
>
>> On Thu, May 19, 2011 at 2:28 AM, Ian Lance Taylor <iant@google.com> wrote:
>>> 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
>>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19 17:27       ` Abdul Wahid Memon
@ 2011-05-19 17:29         ` Abdul Wahid Memon
  2011-05-19 18:03         ` Ian Lance Taylor
  1 sibling, 0 replies; 10+ messages in thread
From: Abdul Wahid Memon @ 2011-05-19 17:29 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Actually the error is following:
hello.c:17:1: internal compiler error: in calc_dfs_tree, at dominance.c:394

Thanks

Abdul

On Thu, May 19, 2011 at 7:08 PM, Abdul Wahid Memon
<engrwahidmemon@gmail.com> wrote:
> Thanks alot Ian. Actually it is working but when there is only once
> function in the source file. What to do when there are more than one
> functions.
> Thanks
>
> Abdul
>
> On Thu, May 19, 2011 at 6:59 PM, Ian Lance Taylor <iant@google.com> wrote:
>> Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
>>
>>> Thanks alot. Its working well at GIMPLE but for RTL, it is again
>>> posing a problem of internal compiler error.
>>
>> loop_optimizer_init does work for RTL passes, so you are going to have
>> to debug what is going wrong.
>>
>> Ian
>>
>>> On Thu, May 19, 2011 at 2:28 AM, Ian Lance Taylor <iant@google.com> wrote:
>>>> 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
>>>>
>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19 17:27       ` Abdul Wahid Memon
  2011-05-19 17:29         ` Abdul Wahid Memon
@ 2011-05-19 18:03         ` Ian Lance Taylor
  2011-05-19 19:27           ` Abdul Wahid Memon
  1 sibling, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2011-05-19 18:03 UTC (permalink / raw)
  To: Abdul Wahid Memon; +Cc: gcc-help

Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:

> Thanks alot Ian. Actually it is working but when there is only once
> function in the source file. What to do when there are more than one
> functions.

An RTL pass will normally be invoked once for each function.

Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19 18:03         ` Ian Lance Taylor
@ 2011-05-19 19:27           ` Abdul Wahid Memon
  2011-05-20  0:15             ` Abdul Wahid Memon
  0 siblings, 1 reply; 10+ messages in thread
From: Abdul Wahid Memon @ 2011-05-19 19:27 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Yes I got your point that it will be invoked per function but it poses
an error when there are 2 or more functions in the source file. Is
there any thing that I am missing. If things are working even for both
the functions at GIMPLE level, then why not at RTL?

Regards

On Thu, May 19, 2011 at 7:29 PM, Ian Lance Taylor <iant@google.com> wrote:
> Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
>
>> Thanks alot Ian. Actually it is working but when there is only once
>> function in the source file. What to do when there are more than one
>> functions.
>
> An RTL pass will normally be invoked once for each function.
>
> Ian
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-19 19:27           ` Abdul Wahid Memon
@ 2011-05-20  0:15             ` Abdul Wahid Memon
  2011-05-20 18:46               ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Abdul Wahid Memon @ 2011-05-20  0:15 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Actually, the problem is that when a function is called and the
function returns a value, an error pops up at RTL.
internal compiler error: in calc_dfs_tree, at dominance.c:394

Regards



On Thu, May 19, 2011 at 9:02 PM, Abdul Wahid Memon
<engrwahidmemon@gmail.com> wrote:
> Yes I got your point that it will be invoked per function but it poses
> an error when there are 2 or more functions in the source file. Is
> there any thing that I am missing. If things are working even for both
> the functions at GIMPLE level, then why not at RTL?
>
> Regards
>
> On Thu, May 19, 2011 at 7:29 PM, Ian Lance Taylor <iant@google.com> wrote:
>> Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
>>
>>> Thanks alot Ian. Actually it is working but when there is only once
>>> function in the source file. What to do when there are more than one
>>> functions.
>>
>> An RTL pass will normally be invoked once for each function.
>>
>> Ian
>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: loops problem
  2011-05-20  0:15             ` Abdul Wahid Memon
@ 2011-05-20 18:46               ` Jonathan Wakely
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Wakely @ 2011-05-20 18:46 UTC (permalink / raw)
  To: Abdul Wahid Memon; +Cc: gcc-help

I see that you've sent a mail to the gcc-bugs list - that's usually a
waste of time, that list is for emails generated automatically by
bugzilla, so although a few people read it, you're unlikely to get a
reply.

If you think there's a bug, open a bugzilla report instead of emailing
gcc-bugs.  If you just want to ask questions instead of reporting a
bug, this is the right list (gcc-help)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-05-20 12:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 15:48 loops problem Abdul Wahid Memon
2011-05-19  0:39 ` Ian Lance Taylor
2011-05-19 15:58   ` Abdul Wahid Memon
2011-05-19 17:16     ` Ian Lance Taylor
2011-05-19 17:27       ` Abdul Wahid Memon
2011-05-19 17:29         ` Abdul Wahid Memon
2011-05-19 18:03         ` Ian Lance Taylor
2011-05-19 19:27           ` Abdul Wahid Memon
2011-05-20  0:15             ` Abdul Wahid Memon
2011-05-20 18:46               ` Jonathan Wakely

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).