IBM Z and LinuxONE - Languages - Group home

Use inlining compiler options and function attributes correctly

  

The XL C and XL C/C++ compilers support the following compiler options and function attributes that control function inlining:

  • The noinline function attribute (IBM extension): prevents the function to which it is applied from being inlined.
  • The always_inline function attribute (IBM extension): instructs the compiler to inline a function.
  • The -qinline compiler option: attempts to inline functions instead of generating calls to those functions, for improved performance.
  • The -qinline+<function_name> option: specifies that the named function must be inlined.
  • The -qinline-<function_name> option: specifies that the named function must not be inlined.
  • The -qnoinline option disables all inlining, including that achieved by the high-level optimizer with the -qipa option, and functions declared with the inline keyword.

 

To use these options and function attributes correctly, we must understand the following precedence relationships:

  • The noinline function attribute takes precedence over the inlining compiler options (-qinline, -qinline+), the inline keyword, and the always_inline function attribute.
  • The -qinline-<function_name> option takes higher precedence than the always_inline attribute.
  • The always_inline attribute takes precedence over the -qnoinline option.