Download Blue Gene/L: Application Development

Transcript
In addition, the optimal basic blocks remove dependencies between computations, so that
the compiler sees each statement as entirely independent. You can construct a basic block
as a series of independent statements or as a loop that repeatedly computes the same basic
block with different arguments.
If you specify the -qhot=simd compilation option, along with a minimum optimization level of
-O2, the compiler can then vectorize these loops by applying various transformations, such as
unrolling and software pipelining. See 5.9, “Removing possibilities for aliasing (C/C++)” on
page 48, for additional strategies for removing data dependencies.
5.8 Using inline functions
An inline function is expanded in any context in which it is called. This expansion avoids the
normal performance overhead associated with the branching for a function call, and it allows
functions to be included in basic blocks. The XL C/C++ and Fortran compilers provide several
options for inlining. The following options instruct the compiler to automatically inline all
functions it deems appropriate:
򐂰 XL C/C++
– -O through -O5
– -qipa
򐂰 XL Fortran
– -O4 or -O5
– -qipa
The following options allow you to select or name functions to be inlined:
򐂰 XL C/C++
– -qinline
– -Q
򐂰 XL Fortran
– -Q
In C/C++, you can also use the standard inline function specifier or the
__attribute__(always_inline) extension in your code to mark a function for inlining.
Important: Do not overuse inlining, because there are limits on how much inlining will be
done. Mark the most important functions.
For more information about the various compiler options for controlling function inlining, see
the following publications.
򐂰 XL Fortran User Guide
http://www-306.ibm.com/software/awdtools/fortran/xlfortran/library/
򐂰 XL C/C++ Compiler Reference
http://www-306.ibm.com/software/awdtools/xlcpp/library/
Also available from this Web address, refer to the XL C/C++ Language Reference for
information about the different variations of the inline keyword supported by XL C and
C++, as well as the inlining function attribute extensions.
Chapter 5. Developing applications with IBM XL compilers
47