func_spec must be one of the following values.
Table A–34 The -xinline Values
Value |
Meaning |
---|---|
%auto |
Enable automatic inlining at optimization levels -xO4 or higher. This argument tells the optimizer that it can inline functions of its choosing. Note that without the %auto specification, automatic inlining is normally turned off when explicit inlining is specified on the command line by -xinline=[no%]func_name... |
func_name |
Strongly request that the optimizer inline the function. If the function is not declared as extern "C", the value of func_name must 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. |
no%func_name |
When you prefix the name of a routine on the list with no%, the inlining of that routine is inhibited. The rule about mangled names for func_name applies to no%func_name as well. |
Only routines in the file being compiled are considered for inlining unless you use -xcrossfile[=1]. The optimizer decides which of these routines are appropriate for inlining.
If the -xinline option is not specified, the compiler assumes -xinline=%auto.
If -xinline= is specified with no arguments, no functions are inlined, regardless of the optimization level.
To enable automatic inlining while disabling inlining of the function declared int foo(), use
example% CC -xO5 -xinline=%auto,no%__1cDfoo6F_i_ -c a.cc |
To strongly request the inlining of the function declared as int foo(), and to make all other functions as the candidates for inlining, use
example% CC -xO5 -xinline=%auto,__1cDfoo6F_i_ -c a.cc |
To strongly request the inlining of the function declared as int foo(), and to not allow inlining of any other functions, use
example% CC -xO5 -xinline=__1cDfoo6F_i_ -c a.cc |
The -xinline option has no effect for optimization levels below -xO3. At -xO4 and higher, the optimizer decides which functions should be inlined, and does so without the -xinline option being specified. At -xO4 and higher, the compiler also attempts to determine which functions will improve performance if they are inlined.
A routine is not inlined if any of the following conditions apply. No warnings will be omitted.
Optimization is less than -xO3
The routine cannot be found
Inlining it is not profitable or safe
The source is not in the file being compiled, or, if you use -xcrossfile[=1], the source is not in the files named on the command line
If you force the inlining of a function with -xinline, you might actually diminish performance.