Developer Guide and Reference

Contents

Developer Directed Inline Expansion of User Functions

In addition to the options that support compiler directed inline expansion of user functions, the compiler also provides compiler options and
pragmas
that allow you to more precisely direct when and if inline function expansion should occur.
The compiler measures the relative size of a routine in an abstract value of intermediate language units, which is approximately equivalent to the number of instructions that will be generated. The compiler uses the intermediate language unit estimates to classify routines and functions as relatively small, medium, or large functions. The compiler then uses the estimates to determine when to inline a function; if the minimum criteria for inlining is met and all other things are equal, the compiler has an affinity for inlining relatively small functions and not inlining relative large functions.
Typically, the compiler targets functions that have been marked for inlining based on the following:
  • Inlining keywords:
    indicates to the compiler to inline the specified function. For example,
    __inline
    ,
    __forceinline
    .
  • Procedure-specific inlining
    pragmas
    :
    indicates to the compiler to inline calls within the targeted procedure if it is legal to do so. For example,
    #pragma inline
    or
    #pragma forceinline
    .
  • GCC function attributes for inlining:
    indicates to the compiler to inline the function even when no optimization level is specified. For example,
    __attribute__((always_inline))
    .
The following developer directed inlining options and
pragmas
provide the ability to change the boundaries used by the inliner to distinguish between small and large functions.
In general, you should use the
[Q]inline-factor
option before using the individual inlining options listed below; this single option effectively controls several other upper-limit options.
If your code hits an inlining limit, the compiler issues a warning at the highest warning level. The warning specifies which of the inlining limits have been hit, and the compiler option and/or
pragmas
needed to get a full report.
For example, you could get a message as follows: