C++ User's Guide

-xinline=f[,...f]

Inlines specified routines.


Note -

This option does not affect C++ inline functions and is not related to the +d option.


This option instructs the optimizer to inline the user-written functions and subroutines specified in a comma-separated list. Inlining is an optimization technique whereby the compiler effectively replaces a function call with the actual subprogram code itself. Inlining often provides the optimizer more opportunities to produce efficient code.

The following restrictions apply--no warning is issued:

Examples


demo% cat example.cc
static int twice ( int i ) { return 2*i; }
int main() {return twice( 3 ); }
demo% CC -compat=4 -O example.cc
demo% nm -C a.out | grep twice[37]  |  68068|	8|FUNC		|LOCL		|0		|7		|twice(int)							  [__0FFtwicei]
demo% CC -compat=4 -O -xinline=__0FFtwicei example.cc

Interactions

If a function specified in the list is not declared as extern "C", the function name should be mangled. You can use the nm command on the executable file to find the mangled function names. For functions declared as extern "C", the names are not mangled by the compiler.

The -xinline option has no effect for optimization levels below -xO3. At -xO4, the optimizer decides which functions should be inlined, and does so without the -xinline option being specified. At -xO4, the compiler also attempts to determine which functions will improve performance if they are inlined. If you force inlining of a function with -xinline, you might actually diminish performance.

See also

nm(1), +d