Compiling C/C++ Code
3-6
The options described in Table 3–4 are recommended for control code, and
will result in smaller code size with minimal performance degradation.
Table 3–4. Compiler Options for Control Code
Option
Description
–o3
†
In addition to the optimizations described in Table 3–2, -o3 can
perform other code size reducing optimizations like: eliminating
unused assignments, eliminating local and global common sub-
expressions, and removing functions that are never called.
–pm
‡
Combines source files to perform program–level optimization by
allowing visibility to the entire application source.
–op2
Specifies that the module contains no functions or variables that
are called or modified from outside the source code provided to
the compiler. This improves variable analysis and allowed as-
sumptions.
–oi0
Disables all automatic size–controlled inlining, (which is en-
abled by –o3). User specified inlining of functions is still al-
lowed.
–ms2–ms3
Optimizes primarily for code size, and secondly for perfor-
mance.
† Although –o3 is preferable, at a minimum use the –o option.
‡ Use the –pm option for as much of your program as possible.
The options described in Table 3–5 provide information, but do not affect per-
formance or code size.
Table 3–5. Compiler Options for Information
Option
Description
–mw
Use this option to produce additional compiler feedback. This
option has no performance or code size impact.
– k
Keeps the assembly file so that you can inspect and analyze
compiler feedback. This option has no performance or code
size impact.
–gp
Enables automatic function level profiling with the loader. Can
result in minor performance degradation around function call
boundaries only.
–s/–ss
Interlists C/C++ source or optimizer comments in assembly.
The -s option may show minor performance degradation. The
-ss option may show more severe performance degradation.