This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Some optimization thoughts (and thanks!)


On Tue, 1 May 2001 At150bogomips@aol.com wrote:

> Here are some optimization suggestions:
>
> * Inlining of all functions with a single caller: This would presumably
>   be done after short-function inlining (to allow wrapper functions to
>   be inlined into their callers, such wrappers are likely have condition
>   checks and such which can be simplified if inlined into the more basic
>   caller; but if the function that a wrapper calls is inlined first, the
>   resulting function may be too large to inline for multiple basic
>   callers).  This removes the performance penalty of breaking code into
>   graspable portions.  Unlike regular inlining, this reduces code size
>   (by removing call/return overhead).  This should not be that difficult
>   to implement, nor add much to compile time, particularly if the
>   call-tree for a program is retained between compilings and partially
>   updated after source modification.
>

And for all rules, there is an exception.. I seem to remember Linus
Torvalds flaming here a couple of years ago when GCC did start to do this
for static functions with only a single caller.

In the linux kernel, certain rare (exceptional) cases were factored into
seperate static functions, in order to make the mainline code more
compact.


Scott


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]