Re: Loop Optimizations and Gotos

cdg@nullstone.com (Christopher Glaeser)
Mon, 13 Nov 1995 18:53:55 GMT

          From comp.compilers

Related articles
Loop Optimizations and Gotos jra@gensym.com (1995-11-08)
Re: Loop Optimizations and Gotos burley@cygnus.com (1995-11-12)
Loop Optimizations and Gotos dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-11-12)
Re: Loop Optimizations and Gotos cliffc@ami.sps.mot.com (1995-11-13)
Re: Loop Optimizations and Gotos cdg@nullstone.com (1995-11-13)
Re: Loop Optimizations and Gotos faiman@zko.dec.com (1995-11-16)
Re: Loop Optimizations and Gotos hrubin@stat.purdue.edu (1995-11-17)
Re: Loop Optimizations and Gotos j-grout@glibm9.cen.uiuc.edu (1995-11-17)
Re: Loop Optimizations and Gotos baynes@ukpsshp1.serigate.philips.nl (1995-11-20)
Re: Loop Optimizations and Gotos plong@perf.com (Paul Long) (1995-11-21)
Re: Loop Optimizations and Gotos preston@tera.com (1995-11-21)
[6 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: cdg@nullstone.com (Christopher Glaeser)
Keywords: C, optimize
Organization: Compilers Central
References: 95-11-076
Date: Mon, 13 Nov 1995 18:53:55 GMT

Jim Allard <jra@gensym.com> writes:


> With some work we can identify these
> loops by a pattern matching scheme that will get most of the commonly
> used loop idioms and then translate those as FOR or WHILE loops.
>
> We've had a debate here about whether this work is worth it.


It really depends on the compiler and the structure of the loops.


For example, are the trip counts compile-time constants or run-time
expressions? Are the loop increments 1? Are the increments a constant?
Are the increments positive? Is there control flow inside the loop such
as an IF, early loop termination, or more complex control flow? What is the
type and storage class of the loop control variable? Are there any
aliasing issues, such as a pointer could point to and modify the loop
control variable?


Depending on the compiler, all these and other factors will likely affect
the efficiency of the generated code.


Before you implement this goto-to-loop translator, you should probably
compile a few sample loops (that have similar structure to the output
of your translator on your application) to make sure you get the
optimizations you want.


Regards,
Christopher Glaeser cdg@nullstone.com
Nullstone Corporation
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.