inline

Date:

01-09-2012

NAME

inline_enable, INLINE, inline_disable, NOINLINE, inline_reset RESETINLINE - directs the compiler to attempt, avoid, or reset inline functions at call sites

SYNOPSIS

#pragma _CRI inline_enable
#pragma _CRI inline_disable
#pragma _CRI inline_reset
!DIR$ INLINE
!DIR$ NOINLINE
!DIR$ RESETINLINE

IMPLEMENTATION

Cray Linux Environment (CLE)

DESCRIPTION

The inlining directives behave similarly in both C/C++ and Fortran. The C/C++ directive names are used below to explain their behaviors.

The inline_enable, inline_disable, and inline_reset directives control whether inlining is attempted over a range of code. Inlining replaces calls to user-defined functions with the code that represents the function. This can improve performance by saving the expense of the function call overhead. It also increases the possibility of additional code optimization. Inlining may increase object code size.

The inline_enable directive tells the compiler to attempt to inline functions at call sites.

The inline_disable directive tells the compiler to not inline functions at call sites.

The inline_reset directive returns the inlining state to the state specified on the command line (-h ipan or -O ipan).

The inline_enable and inline_disable directives remain in effect until the opposite directive is encountered, until the inline_reset directive is encountered, or until the end of the program unit.

EXAMPLES

Example 1: Using the inline_enable, inline_disable, and inline_reset directives in C/C++

To compile the file displayed in this example, enter the following commands:

% cc -hipa4 b.c
% cat b.c
void qux(int x)
{
void bar(void);
int a = 1;

  x = a+a+a+a+a+a+a+a+a+a+a+a;
  bar();
}

void foo(void)
{
int j = 1;

#pragma inline_enable /* enable inlining at all call sites here forward */
 qux(j);
 qux(j);
#pragma inline_disable /* disable inlining at all call sites here forward */
 qux(j);
#pragma inline_reset /* reset control to the command line -hipa4 */
 qux(j);
}

Example 2: Using inline_reset in C/C++

The following code fragment shows how the #pragma _CRI inline_reset directive would affect code compiled with the -h ipa3 option:

{
void f1()
#pragma _CRI inline_disable  /* No inlining will be done in f1;
  ...
}


void f2()
{
#pragma _CRI inline_disable  /* turn off all inlining to the end of
the routine or another directive is encountered.
  ...

#pragma _CRI inline_reset  /* The inlining state is -h ipa3
for the remainder of f2;
  ...
}

SEE ALSO

inline_always(7), intro_directives(7)