|Gotos firstname.lastname@example.org (1989-11-12)|
|Re: Gotos email@example.com (Preston Briggs) (1989-11-13)|
|Re: Gotos bright@dataio.Data-IO.COM (1989-11-17)|
|Date:||Mon, 13 Nov 89 12:08:47 CST|
|From:||Preston Briggs <firstname.lastname@example.org>|
|Organization:||Rice University, Houston|
In article <1989Nov12.email@example.com> you write:
>How much of an effect do gotos have on register and other optimization
>techniques? In particular, do C optimizing compilers take a simple minded
>view towards gotos or does data flow analysis actually follow goto paths?
>The reason I ask is, I know some compilers (WATCOM C compiler on IBM PCs I
>think is one) combine common endings:
"tail merging" or "cross jumping"
>But mine doesn't. So is it better to just let the code be duplicated or
>is it o.k. to use gotos to prevent the duplication:
Coloring register allocators don't have any special problem with goto's.
Generally, global (within a procedure) optimizations require data flow
analysis, and the point of the analysis is not to be confused by the
On the other hand, goto's can degrade the optimization.
In your example,
lowers the effectiveness of value numbering and constant propagation
on "zzz." Additionally, the register allocation may be slightly worse
since the graph could have become more contrained.
(If xxx and yyy define a register used in zzz, tail merging will
force the register allocator to use the same register in both
xxx and yyy. This doesn't sound too bad, but it's a loss and the
Basically, I would avoid tail-merging in the source (and goto's in general).
The only payoff is in code space and there's a speed penalty.
In a compiler, I would only do it at the last second (after register
allocation) if at all.
Do any of the IBM PC-class C compilers do global optimizations?
Global constant propagation? Graph coloring register allocation?
[The Metaware compilers are reputed to do graph coloring, though it's a
trick to make it work on something as asymmetrical as a 286. Also, I wonder
if one can do useful graph coloring without infringing IBM's patents. -John]
Return to the
Search the comp.compilers archives again.