Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!netnews.upenn.edu!dsinc!spool.mu.edu!howland.reston.ans.net!agate!ames!olivea!charnel!xmission!u.cc.utah.edu!cs.weber.edu!terry From: terry@cs.weber.edu (Terry Lambert) Newsgroups: comp.os.386bsd.development Subject: Re: Gnu Inline Assembly question Date: 16 Apr 1994 07:21:02 GMT Organization: Weber State University, Ogden, UT Lines: 36 Message-ID: <2oo3ku$2vi@u.cc.utah.edu> References: <2n76gvINNbjn@uwm.edu> <2na79i$iuk@u.cc.utah.edu> <2oerglINN2hu@bonnie.sax.de> NNTP-Posting-Host: cs.weber.edu In article <2oerglINN2hu@bonnie.sax.de> j@uriah.sax.de (J Wunsch) writes: ]>My personal take on this would be to write a small C function and cc -S it, ]>and then build a .s file for it using the assembly source file from the cc ]>as a template to make it easy on yourself. ] ]But you might be surprised that there's not much more to optimize in ]the code:-), at least given you've used all the optimization features ]of the compiler... It was a suggestion about how to deal with inlining, so the function would be to get the preamble, postamble, and parameter passing mechanisms for a C/assembly interface, not to provide code that would then be hand optimized. Even so, hand optimizations, unless you are running callee pops (something that won't work without mods to at least 6 functions in the -current kernel) can save some pushing and popping and allow use of particular assembly constructs which while potentially inefficient, are "the right way to do things". Other than that, I still think there are programmers who are smarter than compiler writers (or we'd have interprocedural optimization and inter-module typechecking on linking, and near and far memory reference would be hidden behind linker resolved memory pseudo-ops, as in Fred Fish's 88k compiler, and I'd never have to think about segments ever again). This type of "inlining" also has the benefit of isolating the assembly (machine dependent) from the C (theoretically machine-independent) parts to allow a better breakdown in the source. "Real" inlining makes the whole module machine dependent. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.