Alias:
SET-OPTIMIZATION-PROPERTIES
This option can be used to activate or deactivate some or all of the optimizations performed by the compiler.
For more details on the effects of optimization, see the section starting on "The optimization process (C/C++-Compiler, #49)".
MODIFY-OPTIMIZATION-PROPERTIES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
LEVEL = *UNCHANGED
The value specified in the last MODIFY-OPTIMIZATION-PROPERTIES statement applies.
LEVEL = *LOW
With this optimization level, no standard optimizations are performed, so debugging with AID is possible.
LEVEL=*LOW is automatically set instead of the *HIGH or *VERY-HIGH specification when the TEST-SUPPORT=*YES option has also been set.
LEVEL = *HIGH(...) / *VERY-HIGH(...)
If *HIGH or *VERY-HIGH is specified, all standard optimizations are performed (see “Standard optimizations (The optimization process )”). The only difference between these two levels is the fact that every optimization strategy is internally executed only once for *HIGH, but several times for *VERY-HIGH. Consequently, if the “highly-optimized” level *VERY-HIGH is set, the overall compile time is much greater than the compile time for the *HIGH optimization level.
The parameters of the *HIGH or *VERY-HIGH structure can be used to individually control the expansion of loops. Debugging with AID is not possible with this optimization level.
LOOP-UNROLLING = *UNCHANGED / *NO / *YES(FACTOR = 4 /<integer 1..100>...)
This option controls the expansion of loops. Multiple expansion of the body of a loop reduces the execution time for the iterations of the loop. Expanding the body of the loop provides an opportunity for further optimization; however, the repetition of code also implies an increase in the size of the generated object.
By default, the optimizer expands the body of a loop 4 times.
Where required, a separate expansion factor can be selected with <integer>. Specifying an expansion factor does not, however, ensure that the loop expansion will be carried out in all cases. In order to ensure that the expansion is carried out correctly, you should concentrate on optimizing the loop structure and the specified expansion factor.
Loop expansion can be suppressed with *NO.
For further details, see “Expansion of loops” (The optimization process ).
INLINING =
This option controls the inline substitution of user-defined functions. As in the case of the inline substitution of some C library functions from the standard library (see BUILTIN-FUNCTIONS), each call to an inline function is replaced by the corresponding function code. Consequently, no call and return code sequence is required, and better execution time is achieved. This optimization measure is, however, associated with an increase in the size of the generated module due to the repetition of code.
For further details, see the section on “Inline substitution of user-defined functions” (The optimization process ).
Standard settings of the compiler
If the INLINING option is not specified, the following default settings apply for the C and C++ language modes, respectively:
C modes (MODIFY-SOURCE-PROPERTIES LANGUAGE=*C):
INLINING=*NO
No inline substitution is performed.C++ modes (MODIFY-SOURCE-PROPERTIES LANGUAGE=*CPLUSPLUS):
INLINING=*YES(USER-FUNCTIONS=*BY-SOURCE)
Inline substitution is performed for all C++-specific inline functions (i.e. functions with theinline
attribute and member functions defined within classes).
INLINING = *UNCHANGED
The value specified in the last MODIFY-OPTIMIZATION-PROPERTIES statement applies.
INLINING = *NO
No user-defined functions are generated inline by the optimizer. *NO is the default setting in the C language modes if no INLINING option has been specified.
In addition, *NO is also automatically assumed by the compiler instead of *YES(...) values if the option TEST-SUPPORT=*YES has also been set.
INLINING = *YES(USER-FUNCTIONS = *UNCHANGED / list-poss: *STD / *BY-SOURCE / <c-string 1..255 with-low>)
*UNCHANGED
The value specified in the last MODIFY-OPTIMIZATION-PROPERTIES statement applies.
*STD
If only *STD is specified, the optimizer selects functions for inline substitution on the basis of its own criteria. *STD implies *BY-SOURCE, which means that even inline pragmas and C++-specific inline functions are considered by the optimizer when searching for suitable candidates to be inlined (see also *BY-SOURCE).
*STD is the default when INLINING=*YES is specified.
*BY-SOURCE
If only *BY-SOURCE is specified, only the following user-defined functions are substituted inline:
In the C modes: all C functions specified with the following
#pragma
directive:#pragma inline
function-name
The inline pragma is not supported in the C++ language modes.
See also section “inline pragma”.In the C++ modes: all C++ functions with the
inline
attribute and all C++ functions defined within classes.
*BY-SOURCE is the default in the C++ language modes if no INLINING option is specified.
<c-string>
<c-string> can be used to specify the name of a user-defined function to be inlined by the optimizer. The specification of user-selected functions with <c-string> is only supported in the C language modes, since C++ has its own language elements for the inline substitution of functions. <c-string> implies the specification of *BY-SOURCE, which means that even inline pragmas are considered by the optimizer (see also *BY-SOURCE in the C modes).
list-poss
*STD, <c-string> and - for compatibility reasons - even *BY-SOURCE may also be specified together, in which case the optimizer will first attempt the inline substitution of the function(s) specified with *BY-SOURCE and/or <c-string> and then select other functions for inline substitution (provided *STD is also specified) according to its own criteria. Note that *BY-SOURCE need not be specified here, since it is implicitly assumed whenever *STD or <c-string> is specified at the same time.
The meaningful combinations are therefore:
*STD, <c-string>
<-c-string>, <c-string>, ...
Example of the INLINING option
//MODIFY-OPTIMIZATION-PROP - //LEVEL=*HIGH,INLINING=*YES(USER-FUNCT=(*STD,’funct1’,’funct2’))
See “Inline substitution of user-defined functions” (The optimization process ) for further details.
BUILTIN-FUNCTIONS = *UNCHANGED / *NONE / *ALL /list-poss: <c-string 1..125 with-low>
This option can be used to specify the C library functions for which the implementation in the CRTE can be assumed. This permits better optimization of the program.
*UNCHANGED
The value specified in the last MODIFY-OPTIMIZATION-PROPERTIES statement applies.
*NONE
No library function call is specially optimized.
*ALL
All calls for known library functions are handled separately.
<c-string>
Calls for this function are handled separately.
The compiler achieves the greatest effect through inline substitution of a function. In this case the function code is directly inserted at the point of call. This eliminates some of the time-consuming administrative tasks of the runtime system (e.g. saving and restoring registers, return from the function, etc.) and thus reduces the overall execution time of the program.
The following C library functions can be expanded inline:.
strcpy strcmp strncmp strlen strcat memcpy | memcmp memset abs fabs labs |
Notes
Inlined functions cannot be replaced by other functions at link time and cannot be used as checkpoints when debugging with AID.
Non-inlined functions are retained as a call. However, optimizations are possible which cannot be achieved in the user functions. For example, the compiler can use the information that the
isdigit()
function has no side effects.If a function is defined by the user with a name which the compiler knows, conflicts can occur with this option. The function written by the user will generally have a different implementation from the function in the CRTE. Warning CFE2067 is issued instead of the definition in order to indicate the conflict.
Note that the features of the CRTE implementation are used in every compilation unit. However, the warning is only output in the compilation unit containing the private definition.
The default settings of the MODIFY-OPTIMIZATION-PROPERTIES statement and possible modifications are repeated in summarized form in the table below.
*HIGH(...) / *VERY-HIGH(...) | *LOW | |
Standard optimizations | *YES | *NO |
LOOP-UNROLLING | *YES | *NO |
BUILTIN-FUNCTIONS | *NONE | |
INLINING ( in C) | *NO | |
INLINING ( in C++) | *YES(USER-FUNCTIONS=*BY-SOURCE) |