Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: defeating the optimiser (was Ambiguous C?) Message-ID: <891@twwells.uucp> Date: 30 Apr 89 14:16:12 GMT References: <111@ssp1.idca.tds.philips.nl> <17133@mimsy.UUCP> <10136@smoke.BRL.MIL> <17195@mimsy.UUCP> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 42 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <17195@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: : Sun provide : a program called `inline' that uses this approach, and (I presume) : also tries to avoid unnecessary pushes and pops, changing something : like : : pea a4@(12) : jsr _readlong : movl #10,d1 : btst d1,d0 | btst cannot test bit 10 directly : : plus : : _readlong: : movl sp@(4),a0 : movl a0@,d0 : rts : : into : : lea a4@(12),a0 : movl a0@,d0 : movl #10,d1 : btst d1,d0 : : or even (if smart enough) merging the lea+movl into one movl. If this is what I think it is, I was reading about this (it's in the floating point manual, an obvious place, right?) some time ago. What is described there are .il files, which you use by naming them on your cc command. The .il files contain assembly code which the compiler inserts in line for you. The manual gives some instructions on how to write the functions in such a way that the optimizer will remove the function call overhead. It's a neat trick if you need inline assembly. And avoids nonportables like the asm keyword. (I think I got this right. It's been a while.) --- Bill { uunet | novavax } !twwells!bill