HP C/aC++ for PA-RISC Software manual Noinline Pragma

Models: C/aC++ for PA-RISC Software

1 230
Download 230 pages 50.97 Kb
Page 104
Image 104

This pragma informs the compiler that the specified functions may enable floating-point trap handling. When the compiler is so informed, it will not perform loop invariant code motion (LICM) on floating-point operations in the functions named in the pragma. This pragma is required for proper code generation when floating-point traps are enabled.

NOTE: This pragma is not supported in C++. It is deprecated for HP C and C++ C-mode. You should use#pragma STDC FENV_ACCESS ON instead.

For example,

#pragma FLOAT_TRAPS_ON xyz,abc

informs the compiler and optimizer that xyz and abc have floating-point traps turned on and therefore LICM optimization should not be performed. A dummy name _ALL represents all functions.

[NO]INLINE Pragma

#pragma [NO]INLINE sym[,sym]

The [NO]INLINE pragma enables[disables] inlining for all functions or specified function names.

For example, to specify inlining of the two subprograms checkstat and getinput, use:

#pragma INLINE checkstat, getinput

To specify that an infrequently called routine (opendb, for example) should not be inlined when compiling at optimization level 3 or 4, use:

#pragma NOINLINE opendb

Usage Notes for C++:

Use the unmangled name of the function.

All overloaded versions of the function will be affected.

The pragma can affect "inline functions"---class member functions defined in the class definition; these have the same treatment as functions declared with the inline keyword.

Usage Notes for both C and C++:

The pragma can be used without a function name, in which case it affects all functions until the next instance of the pragma or the end of the module. Consider the following:

#pragma NOINLINE foo #pragma INLINE

[foo will be inlined here]

Inline functions (those declared with the inline keyword or as described above for C++), can be affected by #pragma NOLINLINE, which overrides the keyword.

The inline keyword indicates a recommendation to the compiler that the function be inlined; the compiler can then make a profitability decision whether or not to perform the inlining.

The [NO]INLINE pragma and +O[no]inlineoption are treated as directives to the compiler; the compiler obeys the pragma or option without performing profitability analysis.

There are some cases that are not valid to inline. In these cases, the pragma or option is silently ignored.

NO_INLINE Pragma

#pragma NO_INLINE

This is equivalent to #pragma NOINLINE. The NO_INLINE pragma disables inlining for all functions or specified function names.

104 Pragma Directives and Attributes

Page 104
Image 104
HP C/aC++ for PA-RISC Software manual Noinline Pragma