-mf compiler option

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

This discussion applies to the C6000 compiler.

Compiler options are generally documented in the Optimizing Compiler User's Guide (SPRU187)

With the release of code generation tools 6.1.0 via update advisor, a new compiler option -mf was introduced.

It is not documented in SPRU187o or the online help at present (please check for newer revisions, which may have been published after the creation of this article).

However, as it is prominently visible on the "Basic" Category of the project build options in Code Composer Studio, this article summarizes the available information about the new option.

-mf[=0-5] Optimize for speed (Default:4)

How -ms (--opt_for_space) maps to -mf (--opt_for_speed)

The -ms and -mf options roughly map to each other (in the reverse direction). Here is the mapping:

-ms and -mf are not meant to be used together. Using them together will only cause the last one specified to be honored. –mf does not have any enabling mechanism (i.e. another option which would have to be used to activate it) other than the use of the option.

The -mf option is not available on versions 6.0.x or before.

At the present there are no plans to have -ms# deprecated.

-mf scale

The advantage of the -mf# scale is that it is more straightforward with a clear risk/reward profile. The -mf scale is roughly split at the mid point with -mf[0-2] representing optimize for code size and -mf[3-5] representing optimize for performance/speed. The default use model sets -mf4. Remember -mf is completely independent of the -o flag.


So, using this scale users can specify exactly what level of risk they are willing to accept. Based on the option specified, the compiler will recognize the risk profile selected and activate the appropriate set of optimizations. Note that speed above DOES NOT represent compile speed but rather the applications overall CPU cycle performance.

Due to cache constraints, it may be advisable in some cases to reduce code size in favor of better memory access times and thus overall application performance. For this reason, there is a general recommendation to use -ms0 (or -mf3) together with -o3.

How does the use of a -mf switch affect my code?

Most compiler optimizations on C6000 involve the tradeoff of code size and performance.


For all C6000 devices, the following optimizations are varied according to the -mf setting:


For C6400+/C674x/C66xx devices, the compiler further varies the following according to the -mf setting:


Note that these lists are incomplete, but they cover most of the major things that change based on the -mf setting.

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox