Breaking out - the ratfor approach

Geoff Kuenning geoff at desint.UUCP
Fri Nov 2 14:44:52 AEST 1984


In article <370 at petsd.UUCP> Joe Orost writes:

>>So tell me, folks:  do *you* have a global data flow analysis algorithm that
>>works in the presence of unrestricted goto's?
>>-- 
>>	Geoff Kuenning
>
>Yes, we have had one since 1978 in our FORTRAN VII O compiler.  Any decent
>global optimizer works on the program after all loops, block ifs, etc. have 
>been changed into GOTOs.  We even remove loop invarients from GOTO loops.

Um, oops.  I must be getting senile.  As Peter Honeyman also pointed out,
what Dijkstra was actually saying was that the unrestricted USE of GOTO's
made programs less optimizable.  For example, the sequence

		call destroyregisters (a, b)
		goto 200
	C	Top of  Loop
	100	continue
		... (a)
	200	continue
		... (b)
		if (loopmore) goto 100

cannot make any assumptions about the contents of temporary registers in
code section (b).  (I decided to use Fortran since I'm obviously senile.  The
proof is in the fact that I wrote Fortran using lowercase.)  This is a
much less serious problem.

Having egg on my face and having been shown that carefully-used goto's are
as optimizable as the funny break, I hereby withdraw all my objections and
come out in support of using goto's for this purpose.

I think I'll go punch some cards, just for old times' sake...
-- 

	Geoff Kuenning
	First Systems Corporation
	...!ihnp4!trwrb!desint!geoff



More information about the Comp.lang.c mailing list