[ast-optimizer-branch] Goto/Break/Continue/Switch elimination
Daniel Berlin
dberlin@dberlin.org
Thu May 2 11:08:00 GMT 2002
On Thu, 2 May 2002, Sebastian Pop wrote:
> On Thu, May 02, 2002 at 10:23:41AM -0700, Richard Henderson wrote:
> > On Thu, May 02, 2002 at 05:16:12PM +0100, Sebastian Pop wrote:
> > > Further, this allows to work cleanly on the rest of optimizations
> > > since we no longer have to handle LABEL_STMTs nor GOTO_STMTs.
> >
> > So what happens when you can't eliminate all the gotos? Do we
> > suddenly lose the ability to perform any optimizations?
> >
>
> You mean that it is unsafe to use the goto-free version for extracting
> information that we will use in the rest of the compiler ?
No, he's saying it's impossible to make it goto-free in some cases.
At least, that's my impression
Particularly, in the presence of a GCC extension called computed gotos.
In them, the GOTO_DESTINATION can be an arbitrary expression, rather than
just a label.
*usually*, they are expressions that index into a table of some sort (or
the result of indexing into a table of some sort).
Those can be converted into switches.
However, they can be any old thing that can be cast to a void pointer.
For those that are really truly variable, we can't eliminate them.
More information about the Gcc-patches
mailing list