LWN.net Logo

Who is the best inliner of all?

Who is the best inliner of all?

Posted Jan 16, 2009 19:16 UTC (Fri) by giraffedata (subscriber, #1954)
In reply to: Who is the best inliner of all? by kpfleming
Parent article: Who is the best inliner of all?

In the kernel, this means that the only functions that will ever be inlined are those defined in header files,

What about the the functions in the same .c file as their callers? There are plenty of those in the kernel.

Does -combine totally combine, like #including all the files into a master file, or does it keep them properly modular? I hate having inline functions in header files because the problems of interference between the header file and the file into which it is #included limits what the inline function can do. But if -combine solves that problem, I can see having usable source code libraries.


(Log in to post comments)

Who is the best inliner of all?

Posted Jan 16, 2009 21:02 UTC (Fri) by kpfleming (subscriber, #23250) [Link]

Sorry, I was unclear there: I should have said that the only functions *except those in the same source file*.

Regarding -combine, essentially what happens is that each source file is run through cpp separately, then the results are concatenated and fed to the compiler. This avoids preprocessor-level conflicts.

However, keep in mind that -combine alone, while it does provide some benefit, doesn't accomplish most of the desired result. -fwhole-program does that, because when there are multiple source modules, most of the functions will *not* be 'static', as they are cross-module references, and this can interfere with optimization and (especially) inlining. -fwhole-program overrides this, and forces everything to be 'static' scope except those items that are marked with the 'externally_visible' attribute. To gain the most benefits, you need to use both.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds