-OdocF: Dynamic Option Configuration for Functions

Group

OPTIMIZATIONS

Scope

Function

Syntax
-OdocF=<option>

Arguments

<option>: Set of options, separated by `|' to be evaluated for each single function.

Default

None

Defines

None

Pragmas

None

Description

Normally, you must set a specific set of Compiler switches for each compilation unit (file to be compiled). For some files, a specific set of options may decrease the code size, but for other files, the same set of Compiler options may produce more code depending on the sources.

Some optimizations may reduce the code size for some functions, but may increase the code size for other functions in the same compilation unit. Normally it is impossible to vary options over different functions, or to find the best combination of options.

This option solves this problem by allowing the Compiler to choose from a set of options to reach the smallest code size for every function. Without this feature, you must set some Compiler switches, which are fixed, over the whole compilation unit. With this feature, the Compiler is free to find the best option combination from a user-defined set for every function.

Standard merging rules applies also for this new option, e.g.,

-Or -OdocF="-Ocu|-Cu"

is the same as

-OrDOCF="-Ouc|-Cu"

The Compiler attempts to find the best option combination (of those specified) and evaluates all possible combinations of all specified sets, e.g., for the option shown in the following listing:

Listing: Example of dynamic option configuration
-W2 -OdocF="-Or|-Cni -Cu|-Oc"


The code sizes for following option combinations are evaluated:

1. -W2

2. -W2  -Or

3. -W2      -Cni -Cu

4. -W2  -Or -Cni -Cu

5. -W2               -Oc

6. -W2  -Or          -Oc

7. -W2      -Cni -Cu     -Oc

8. -W2  -Or  -Cni -Cu       -Oc

Thus, if the more sets are specified, the longer the Compiler has to evaluate all combinations, e.g., for 5 sets 32 evaluations.

Note: Do not use this option to specify options with scope Application or Compilation Unit (such as memory model, float or double format, or object-file format) or options for the whole compilation unit (like inlining or macro definition). The generated functions may be incompatible for linking and executing.

Limitations:

Example
-Odocf="-Or|-Cni"