Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Parallel Programming Guide for HP-UX Systems > Chapter 5 Loop and cross-module optimization features

Cross-module cloning

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Cloning is the replacement of a call to a routine by a call to a clone of that routine. The clone is optimized differently than the original routine. Cloning can expose additional opportunities for optimization across multiple source files.

Cloning at +O4 is performed across all procedures within the program, and is disabled by specifying the +Onoinline command-line option. This option is described on +O[no]inline[=namelist].

Global and static variable optimizations

Global and static variable optimizations look for ways to reduce the number of instructions required for accessing global and static variables (COMMON and SAVE variables in Fortran, and extern and static variables in C and C++).

The compiler normally generates two machine instructions when referencing global variables. Depending on the locality of the global variables, single machine instructions may sometimes be used to access these variables. The linker rearranges the storage location of global and static data to increase the number of variables that are referenced by single instructions.

Global variable optimization coding standards

Because this optimization rearranges the location and data alignment of global variables, follow the programming practices given below:

  • Do not make assumptions about the relative storage location of variables, such as generating a pointer by adding an offset to the address of another variable.

  • Do not rely on pointer or address comparisons between two different variables.

  • Do not make assumptions about the alignment of variables, such as assuming that a short integer is aligned the same as an integer.

Inlining across multiple source files

Inlining substitutes function calls with copies of the function’s object code. Only functions that meet the optimizer’s criteria are inlined. This may result in slightly larger executable files. However, this increase in size is offset by the elimination of time-consuming procedure calls and procedure returns. See the section “Inlining within a single source file” for an example of inlining.

Inlining at +O4 is performed across all procedures within the program. Inlining at +O3 is done within one file.

Inlining is affected by the +O[no]inline[=namelist] and +Oinline_budget=n command-line options. See Chapter 7 “Controlling optimization” for more information on these options.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.