Put your code... (was Re: gotos

Peter J Desnoyers peter at athena.mit.edu
Sat Apr 30 01:45:27 AEST 1988


In article <2800 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
+In article <1988Apr27.164212.12535 at utzoo.uucp> henry at utzoo.uucp (Henry
+Spencer) writes:
+
++It doesn't take much of an optimizer
++to notice that the instruction sequences preceding an unconditional control-
++flow merge are identical, and condense them into one by branching to the
++beginning of the sequence rather than the end.
+
+A peephole optimizer
+scans the code through a window of limited size, and rearranges code in
+that window so that the net effect of the window remains unchanged.  I
+don't think you can remove duplicate code in different places this
+way.
+-- 
+Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi

The Apollo C compiler performs this optimization. It makes debugging
at the source level tons of fun - you jump by some magic from one case
to another. I don't know how it does it - if I were given the task, I
would write a switch compress routine that compared each case
backwards (subject to constraints) and found the longest matches. 


				Peter Desnoyers
				peter at athena.mit.edu



More information about the Comp.lang.c mailing list