The precise optimizations performed by the compiler depend both on the level of optimization chosen, and whether you are optimizing for performance or code size.
The compiler supports the following optimization levels:
Minimum optimization. The compiler performs simple optimizations that do not impair the debug view.
When debugging is enabled, this option gives the best possible debug view.
When debugging is enabled, this option gives a generally satisfactory debug view with good code density.
High optimization. This is the default optimization level.
When debugging is enabled, this option might give a less satisfactory debug view.
Maximum optimization. This is the most aggressive form of optimization available. Specifying this option enables multifile compilation by default where multiple files are specified on the command line.
When debugging is enabled, this option typically gives a poor debug view.
Because optimization affects the mapping of object code to
source code, the choice of optimization level with
impacts the debug view.
-O0 is the best option to use
if a simple debug view is needed. Selecting
-O0 typically increases
the size of the ELF image by 7 to 15%. To reduce the size of your
debug tables, use the
- Other information