This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ast-optimizer-branch] Goto/Break/Continue/Switch elimination


On Thu, May 02, 2002 at 08:51:54AM -0700, Zack Weinberg wrote:
> On Thu, May 02, 2002 at 01:48:38PM +0100, Sebastian Pop wrote:
> > Hi,
> > 
> > The following patch and newfiles.tar.gz implements a goto, break and continue 
> > elimination pass on SIMPLE trees. It uses the double linked statement chain 
> > (it is really much more simpler to implement transformations on trees when we 
> > can access the previous statement, and the code becomes much more readable).
> 
> Maybe I'm missing the point, but why is this a desirable optimization?
> It looks like it massively increases code size, and I don't see why
> the result would be any faster.
>

The most important thing is that we obtain a well structured program
with a regular control flow.

Quoting from Erosa's MSc. Thesis : http://citeseer.nj.nec.com/erosa94taming.html
"One important consequence is that C programs without gotos are compositional,
and therefore structured analyses techniques can be used to compute data flow 
information."

Now I agree that the code becomes verrrrrrrry huge, and even we loose some 
performances since we introduce lots of tests against temporaries if (T.1==0) ...,
but after the SSA we're able to delete a part of the unreachable code.

Further, this allows to work cleanly on the rest of optimizations
since we no longer have to handle LABEL_STMTs nor GOTO_STMTs.

Seb/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]