ARM Ltd. Windows GCC Compiler > Optimization

Use the Optimization panel to control compiler optimizations. Compiler optimization can be applied in either global or non-global optimization mode. You can apply global optimization at the end of the development cycle, after compiling and optimizing all source files individually or in groups.

The following table lists and describes the various options available on the Optimization panel.

Table 1. ARM Ltd. Windows GCC Compiler > Optimization
Option Description
Optimization Level Use this option to specify the optimizations that you want the compiler to apply to the generated object code. The options available are:
  • None (-O0) - Disable optimizations. This setting is equivalent to specifying the -O0 command-line option. The compiler generates unoptimized, linear assembly-language code.
  • Optimize (-O1) - The compiler performs all target-independent (that is, non-parallelized) optimizations, such as function inlining. This setting is equivalent to specifying the -O1 command-line option. The compiler omits all target-specific optimizations and generates linear assembly-language code.
  • Optimize more (-O2) - The compiler performs all optimizations (both target-independent and target-specific). This setting is equivalent to specifying the -O2 command-line option. The compiler outputs optimized, non-linear, parallelized assembly-language code.
  • Optimize most (-O3) - The compiler performs all the level 2 optimizations, then the low-level optimizer performs global-algorithm register allocation. This setting is equivalent to specifying the -O3 command-line option. At this optimization level, the compiler generates code that is usually faster than the code generated from level 2 optimizations.
  • Optimize for size (-Os) - Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size. This setting is equivalent to specifying the - Os command-line option.
Pack structures (-fpack-struct) Packed data structures are supported in the compiler with the keyword __packed or __attribute__((packed)). There is no code generation support for accessing un-aligned, packed data members.Users should exercise caution when accessing packed data structures because data might not be aligned.
Short enumerations (-fshort-enums) Check to use short enumerated constants and is equivalent to -fshort-enums.
Function sections (-ffunction-sections) Check to use function sections and is equivalent to -ffunction-sections.
Data sections (-fdata-sections) Check to use short data sections and is equivalent to -ffunction-sections.
Other optimization flags Specifies individual optimization flag that can be turned ON/OFF based on the user requirements.