Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!pyramid!leadsv!laic!nova!darin From: darin@nova.laic.uucp (Darin Johnson) Newsgroups: comp.sys.amiga Subject: Re: Amiga compiler optimizing test Message-ID: <462@laic.UUCP> Date: 7 Mar 89 01:17:23 GMT References: <3531@sdsu.UUCP> <3839@tekig5.PEN.TEK.COM> Sender: news@laic.UUCP Reply-To: darin@nova.UUCP (Darin Johnson) Organization: Lockheed AI Center, Menlo Park Lines: 28 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? 1) to support alloca type stuff? 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 like this: link a5, $T997 . . unlnk a5 $T997 equ 42 Remember, the words "optimizing compiler" doesn't mean much. If a simple peephole optimizer was thrown in, they can call it an optimizing compiler. (such as a few bigname UN*X machines, whose compilers got rid of the equ statements in the above example, but very little else in my tests. [1985ish]) Darin Johnson (leadsv!laic!darin@pyramid.pyramid.com) Can you "Spot the Looney"?