Developer Guide and Reference

Contents

inline, noinline, forceinline

Specifies inlining of all calls in a statement. This also describes pragmas forceinline and noinline.

Syntax

#pragma inline [recursive]
#pragma forceinline [recursive]
#pragma noinline
Arguments
recursive
Indicates that the pragma applies to all of the calls that are called by these calls, recursively, down the call chain.
Description
These are statement-specific inlining pragmas. Each can be placed before a C/C++ statement, and it will then apply to all of the calls within a statement and all calls within statements nested within that statement.
The
forceinline
pragma indicates that the calls in question should be inlined whenever the compiler is capable of doing so.
The
inline
pragma is a hint to the compiler that the user prefers that the calls in question be inlined, but expects the compiler not to inline them if its heuristics determine that the inlining would be overly aggressive and might slow down the compilation of the source code excessively, create too large of an executable, or degrade performance.
The
noinline
pragma indicates that the calls in question should not be inlined.
These statement-specific pragmas take precedence over the corresponding function-specific pragmas.
Example: Using the
forceinline
recursive pragma
#include <stdio.h> static void fun(float a[100][100], float b[100][100]) {   inti , j;   for (i = 0; i < 100; i++) {     for (j = 0; j < 100; j++) {       a[i][j] = 2 * i;       b[i][j] = 4 * j;     }   } } static void sun(float a[100][100], float b[100][100]) {   int i, j;   for (i = 0; i < 100; i++) {     for (j = 0; j < 100; j++) {       a[i][j] = 2 * i;       b[i][j] = 4 * j;     }     fun(a, b);   } } static float a[100][100]; static float b[100][100]; extern int main() {   int i, j;   for (i = 0; i < 100; i++) {     for (j = 0; j < 100; j++) {       a[i][j] = i + j;       b[i][j] = i - j;     }   }   for (i = 0; i < 99; i++) {     fun(a, b); #pragma forceinline recursive     for (j = 0; j < 99; j++) {       sun(a, b);     }   }   fprintf(stderr, "%d %d\n", a[99][9], b[99][99]); }
The
forceinline recursive
pragma applies to the call 'sun(a,b)' as well as the call 'fun(a,b)' called inside 'sun(a,b)'.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804