This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ast-optimizer-branch] Goto/Break/Continue/Switch elimination
- From: Sebastian Pop <m1sp at csc dot liv dot ac dot uk>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: Sebastian Pop <m1sp at csc dot liv dot ac dot uk>, dnovillo at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 May 2002 17:16:12 +0100
- Subject: Re: [ast-optimizer-branch] Goto/Break/Continue/Switch elimination
- References: <20020502134838.A18764@linux18.lxfarm.csc.liv.ac.uk> <20020502155154.GA1649@codesourcery.com>
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/