| |||
| Home > Compiler Command-line Options > Command-line options > ‑Onum | |||
This option specifies the level of optimization to be used when compiling source files.
-Onum
Where is one
of the following:num
0Minimum optimization. Turns off most optimizations. It gives the best possible debug view and the lowest level of optimization.
1Restricted
optimization. Removes unused inline functions and unused static
functions. Turns off optimizations that seriously degrade the debug view.
If used with --debug, this option gives a satisfactory
debug view with good code density.
2High
optimization. If used with --debug, the debug view
might be less satisfactory because the mapping of object code to
source code is not always clear.
This is the default optimization level.
3Maximum
optimization. -O3 performs the same optimizations
as -O2 however the balance between space and time
optimizations in the generated code is more heavily weighted towards
space or time compared with -O2. That is:
-O3 -Otime aims to produce faster
code than -O2 -Otime, at the risk of increasing
your image size
-O3 -Ospace aims to produce smaller
code than -O2 -Ospace, but performance might be
degraded.
In addition, -O3 performs extra optimizations
that are more aggressive, such as:
High-level
scalar optimizations, including loop unrolling, for -O3 -Otime.
This can give significant performance benefits at a small code size
cost, but at the risk of a longer build time.
More aggressive inlining and automatic inlining
for -O3 -Otime.
Multifile compilation by default.
The performance of floating-point code can be influenced by
selecting an appropriate numerical model using the --fpmode option.
Do not rely on the implementation details of these optimizations, because they might change in future releases.