[comp.sys.amiga.tech] Amiga compiler optimizing test

jesup@cbmvax.UUCP (Randell Jesup) (03/09/89)

In article <462@laic.UUCP> darin@nova.UUCP (Darin Johnson) writes:
>In article <3839@tekig5.PEN.TEK.COM> brianr@tekig5.PEN.TEK.COM (Brian Rhodefer) writes:
>>Why would an optimizing compiler put `link a5, 0000' and 'unlnk a5'
>>instructions into a subroutine that needed no local variables?
...
>2) Because it's simple.  Otherwise compilers would have to backpatch
>the generated code.  If it was determined later that the routine
>didn't need a link/unlnk, then it would have to remove that instruction,
>shuffle things around, etc.  This isn't that difficult, but a lot of
>compilers don't do it.  I see this the most on UN*X systems, whose
>compilers were derived from PCC.  Usually, the code generated is something

	Lattice will not normally put in LINK #0,An's if the optimizer is
turned on.  Otherwise it will, for debugger support (debuggers usually use
LINKs to find the stack frames.)  However, there are some cases where LINK #0
will still be generated.

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup