HP C/aC++ for PA-RISC Software Profile-Based Optimization, Limiting the Size of Optimized Code

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

1 230
Download 230 pages 50.97 Kb
Page 158
Image 158

Enabling Only Conservative Optimizations

You can enable only conservative optimizations at the second, third, or fourth optimization levels by using the +Ofltacc=strict +Ofenvaccess option, as follows:

aCC +O2 +Ofltacc=strict +Ofenvaccess sourcefile.C

or:

aCC +O3 +Ofltacc=strict +Ofenvaccess sourcefile.C

or:

aCC +O4 +Ofltacc=strict +Ofenvaccess sourcefile.C

This option disables all but the most conservative optimizations at each level. Conservative optimizations do not change the behavior of code, in most cases, even if the code does not conform to standards.

Use only conservative optimizations provided with level 2, 3, and 4 when your code is unstructured.

Removing Compilation Time Limits When Optimizing

You can remove optimization time restrictions at the second, third, or fourth optimization levels by using the +Onolimit option as follows:

aCC +O2 +Onolimit sourcefile.C

or:

aCC +O3 +Onolimit sourcefile.C

or:

aCC +O4 +Onolimit sourcefile.C

By default, the optimizer limits the amount of time spent optimizing large programs at levels 2, 3, and 4. Use this option if longer compile times are acceptable because you want additional optimizations to be performed.

Limiting the Size of Optimized Code

You can disable optimizations that expand code size at the second, third, and fourth optimization levels by using the +Osize suboption, as follows:

aCC +O2 +Osize sourcefile.C

or:

aCC +O3 +Osize sourcefile.C

or:

aCC +O4 +Osize sourcefile.C

Most optimizations improve execution speed and decrease executable code size. A few optimizations significantly increase code size to gain execution speed. The +Osize option disables these code-expanding optimizations.

Use this option if you have limited main memory, swap space, or disk space.

Combining Optimization Options

Optimization options that affect code size, (+Osize), compile-time (+Olimit), and the aggressiveness of the optimizations performed can be combined at any of the optimization levels 2 through 4.

Profile-Based Optimization

Profile-based optimization (PBO) is a set of performance-improving code transformations based on the runtime characteristics of your application.

158 Optimizing HP aC++ Programs

Page 158
Image 158
HP C/aC++ for PA-RISC Software manual Profile-Based Optimization, Enabling Only Conservative Optimizations