Developer Guide and Reference

  • 2021.2
  • 04/07/2021
  • Public Content
  • Download as PDF
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:
    Tells the compiler to inline the specified function. For example,
    __inline
    ,
    __forceinline
    .
  • Procedure-specific inlining
    pragmas
    :
    Tells 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:
    Tells the compiler to inline the function even when no optimization level is specified. For example,
    __attribute__((always_inline))
    .
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.
Messages in the report refer directly to the command line options or
pragmas
that can be used to overcome the limits.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.