| United States-English |
|
|
|
![]() |
Exemplar Fortran 77, Exemplar C: Exemplar C and Fortran 77 Programmer's Guide > Chapter 1 IntroductionStandard HP compiler information |
|
This section discusses some of the standard HP compiler options that are referenced later in this book. However, this book is a supplement to the standard HP compiler documentation. See the cc(1) and f77(1) man pages for:
See the section “Associated documents” for a list of additional documentation.
Optimization level +O0 is the default optimization level. Your code compiles fastest at this level, but with little optimization. Code development and debugging should be done at this level. At optimization level +O0, the optimizations in Table 1-1 “Optimizations performed at +O0” are performed. Table 1-1 Optimizations performed at +O0
The transformations performed at +O1 are local to small subsections of code and, therefore, are performed quickly and with little runtime storage required by the compiler. Use +O1 when some optimization is desired, but when compile-time performance is more important than runtime performance. At optimization level +O1, the optimizations listed in Table 1-2 “Optimizations performed at +O1” are performed. Table 1-2 Optimizations performed at +O1
You can use either -O or +O2 to enable the +O2 optimizations. Transformations at +O2 are performed over the scope of each procedure. If you use this optimization level, the compiler uses more memory than at +O1 and takes longer to process your program. Optimizing procedures of more than 1,000 lines at this level takes considerably longer than at +O1. At optimization level +O2, the optimizations in Table 1-3 “Optimizations performed at +O2” are performed. Table 1-3 Optimizations performed at +O2
At optimization level +O3, the following optimizations are made:
At this level, optimization occurs at link time, allowing the optimizer to analyze all files compiled with the +O4 option at once. Because analysis is done when linking, the compile time is generally shorter than at lower optimization levels, but linking takes more time. At optimization level +O4, the following optimizations are made:
The +O[no]aggressive option enables optimizations that can result in significant performance improvement, but that can change a program's behavior. These optimizations include those invoked by the following advanced options (which are described in the cc(1) and f77(1) man pages):
The default is +Onoaggressive. The +O[no]aggressive option can be used at +O2 and above. The +Oall option applies maximum optimization to achieve the best runtime performance. This option is equivalent to specifying +Oaggressive and +Onolimit on the same command line. The +Oall option implies +O4. The default is +Onoall. The +Ofail_safe option allows a compilation with internal optimization errors to continue, rather than abort. If internal optimization errors are found, the compiler issues a warning message, then restarts the compilation at +O0. When using +Onofail_safe, compilation aborts if internal optimization errors occur. This option can be used at +01 or higher. The default is +Ofail_safe. The +O[no]info option displays [does not display] feedback information about the optimization process (for example, cloning and inlining). Currently, this option is useful only at +O3 and above. The default is +Onoinfo. For information on a related option, see the section “+O[no]report[=report_type]”. In +Oinline_budget=n, n is an integer in the range 1 to 1000000 that specifies the level of aggressiveness, as follows:
The default is +Oinline_budget=100. The +Onolimit and +Osize options also affect inlining. Specifying the +Onolimit option implies specifying +Oinline_budget=200. The +Osize option implies +Oinline_budget=1. Note, however, that the +Oinline_budget option takes precedence over both of these options. This means that you can override the effects on inlining of the +Onolimit and +Osize options by specifying the +Oinline_budget option on the same command line. The +Oinline_budget=n option is valid at +O3 and above. The +O[no]limit option suppresses [does not suppress] optimizations that significantly increase compile-time or consume large amounts of memory. Specifying +Onolimit implies specifying +Oinline_budget=200. (See the section "+Oinline_budget=n" above for additional information.) This option can be used at +O2 and above. The default is +Olimit. The +O[no]loop_transform option transforms [does not transform] eligible loops for improved cache performance. The transforms include loop distribution, loop interchange, loop blocking, loop unroll, loop unroll and jam (in C V2.0), and loop fusion. This option can be used at +O3 and above. The default is +Oloop_transform. This option unrolls [does not unroll] program loops by a factor of n. For example, specifying +Oloop_unroll=4 requests the optimizer to replicate the loop body four times. This option can be used at +O2 and above. The default is +Oloop_unroll=4. The +Osize option suppresses optimizations that significantly increase code size. Specifying +Osize implies specifying +Oinline_budget=1. See the section “+Oinline_budget=n” for additional information. The +Onosize option does not prevent optimizations that can increase code size. The +O[no]size option can be used at +O2, +O3, or +O4. The default is +Onosize. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||