[LLVMdev] inlining hint

Duncan Sands baldrick at free.fr
Fri Aug 28 00:05:21 PDT 2009


Hi Óscar,

> `inline' as a hint saying "I'll like this to be inlined, but no hard
> feelings if you don't" reflects either a shortcoming on the compiler or
> a personality trait on the user. On what scenario it is useful to hint
> the compiler about candidates for inlining, instead of requiring it?

the Ada frontend to gcc will do cross-unit inlining, but only if the
inline keyword is present.  In C terms what it does is: when compiling
"a.c", if in an included header file it sees a function declaration F
with the inline keyword, then it finds the file "b.c" in which F is
defined (in Ada it knows where this is), grabs the definition of F out
of "b.c" and (if it thinks it is worthwhile) inlines it into "a.c".
This is an expensive operation, so it only does it if the inline keyword
is present and the optimization level is high enough (and the feature is
turned on).

Ciao,

Duncan.



More information about the llvm-dev mailing list