-qinline

Description

Attempts to inline functions instead of generating calls to those functions. Inlining is performed if possible but, depending on which optimizations are performed, some functions might not be inlined.

Syntax

Read syntax diagramSkip visual syntax diagram        .-noinline-----------------------.
>>- -q--+-inline--+--------------------+-+---------------------><
                  +-=threshold=num-----+
                  |          .-:-----. |
                  |          V       | |
                  '-+- + -+----names-+-'
                    '- - -'

C only The following -qinline options apply in the C language:

-qinline The compiler attempts to inline all appropriate functions with 20 executable source statements or fewer, subject to any other settings of the suboptions to the -qinline option. If -qinline is specified last, all functions are inlined.
-qinline=threshold=num Sets a size limit on the functions to be inlined. The number of executable statements must be less than or equal to num for the function to be inlined. num must be a positive integer. The default value is 20. Specifying a threshold value of 0 causes no functions to be inlined except those functions marked with the __inline, _Inline, or _inline keywords.

The num value applies to logical C statements. Declarations are not counted, as you can see in the example below:

increment()
{
  int a, b, i;
   for (i=0; i<10; i++) /* statement 1 */
   { 
      a=i;              /* statement 2 */ 
      b=i;              /* statement 3 */
   } 
}
-qinline-names The compiler does not inline functions listed by names. Separate each name with a colon (:). All other appropriate functions are inlined. The option implies -qinline.

For example:

-qinline-salary:taxes:expenses:benefits

causes all functions except those named salary, taxes, expenses, or benefits to be inlined if possible.

A warning message is issued for functions that are not defined in the source file.

-qinline+names Attempts to inline the functions listed by names and any other appropriate functions. Each name must be separated by a colon (:). The option implies -qinline.

For example,

-qinline+food:clothes:vacation

causes all functions named food, clothes, or vacation to be inlined if possible, along with any other functions eligible for inlining.

A warning message is issued for functions that are not defined in the source file or that are defined but cannot be inlined.

This suboption overrides any setting of the threshold value. You can use a threshold value of zero along with -qinline+names to inline specific functions. For example:

-qinline=threshold=0

followed by:

-qinline+salary:taxes:benefits

causes only the functions named salary, taxes, or benefits to be inlined, if possible, and no others.

-qnoinline Does not inline any functions. If -qnoinline is specified last, no functions are inlined.

C++ only The following -qinline options apply to the C++ language:

-qinline Compiler inlines all functions that it can.
-qnoinline Compiler does not inline any functions.

Default

The default is to treat inline specifications as a hint to the compiler, and the result depends on other options that you select:

Notes

The -qinline option is functionally equivalent to the -Q option.

If you specify the -g option (to generate debug information), inlining may be affected. See the information for the -g compiler option.

Because inlining does not always improve runtime performance, you should test the effects of this option on your code. Do not attempt to inline recursive or mutually recursive functions.

Normally, application performance is optimized if you request optimization (-O option), and compiler performance is optimized if you do not request optimization.

To maximize inlining, specify optimization (-O) and also specify the appropriate -qinline options.

The XL C/C++ keywords inline, _inline, _Inline, and __inline override all -qinline options except -qnoinline. The compiler tries to inline functions marked with these keywords regardless of other -qinline option settings.

See "The inline function specifier" for more information.

Example

To compile myprogram.C so that no functions are inlined, enter:

xlc++ myprogram.C -O -qnoinline

To compile myprogram.c so that the compiler attempts to inline functions of fewer than 12 lines, enter:

xlc myprogram.c -O -qinline=12

Related information