5.7.7 Options for Controlling Optimization
The options tabulated below control compiler optimizations and are described in the sections that follow.
Use of an option is permitted and has an effect with an unlicensed compiler (Free edition) if that option is enabled by default when using optimization level 2 or lower. Any form of option that disables an optimization is available unconditionally.
Option (links to explanatory section) | Edition | Controls |
---|---|---|
-O0 | All | Do not optimize. |
-O
| All | Optimization level 1. |
-O2 | All | Optimization level 2. |
-O3 | PRO only | Speed-orientated optimizations. |
-Og | All | Less optimizations for better debugging. |
-Os | PRO only | Size-orientated optimizations. |
-falign-functions[=n]
| All | Alignment of the start of functions. |
-falign-labels[=n]
| All | Alignment of all branch targets. |
-falign-loops[=n]
| All | Alignment of loops. |
-f[no-]caller-saves | All | Allocation into registers clobbered by function calls. |
-f[no-]cse-follow-jumps | All | Customization of common subexpression elimination optimizations. |
-f[no-]cse-skip-blocks | All | Customization of common subexpression elimination optimizations. |
-f[no-]data-sections | All | Placement of objects into a section in the output file. |
-f[no-]defer-pop | All | When arguments to function calls are popped. |
-f[no-]expensive-optimizations | All | Minor optimizations that are relatively expensive. |
-f[no-]function-cse | All | Placement of function addresses. |
-f[no-]function-sections | All | Placement of functions intoa section in the output file. |
-f[no-]gcse | All | The global common subexpression elimination pass. |
-f[no-]gcse-lm | All | Customization of common subexpression elimination dealing with loads. |
-f[no-]gcse-sm | All | Customization of common subexpression elimination dealing with stores. |
-finline | All | Controls processing of functions marked with theinline keyword. |
-f[no-]inline-functions | All | Integratation of all simple functions into their callers. |
-f[no-]inline-limit=n | All | The size limit for inlining functions. |
-f[no-]keep-inline-functions | All | Output of a separate run-time-callable version of inlined functions. |
-f[no-]keep-static-consts | All | Output of static const objects. |
-f[no-]lto | PRO only | The standard link-time optimizer. |
-f[no-]omit-frame-pointer | All | Reservation of the Frame Pointer in a register for functions that don't need one. |
-f[no-]optimize-sibling-calls | All | Optimization of sibling and tail recursive calls. |
-m[no-]pa | PRO | Procedural Abstraction optimizations. |
-f[no-]peephole
| All | Machine-specific peephole optimizations. |
-f[no-]rename-registers | All | Use of free registers to avoid false dependencies in scheduled code. |
-f[no-]rerun-cse-after-loop | All | When common subexpression elimination optimizations should be performed. |
-f[no-]rerun-loop-opt | All | Legacy option and is ignored. |
-f[no-]schedule-insns
| All | Reordering instructions to eliminate instruction stalls. |
-f[no-]strength-reduce | All | Legacy Option and is ignored. |
-f[no-]strict-aliasing | All | Assumption of the strictest aliasing rules applicable to the language being compiled. |
-f[no-]thread-jumps | All | Jump-to-branch optimizations. |
-f[no-]toplevel-reorder | All | Reordering of top-level functions, variables, and asm statements. |
-f[no-]unroll-loops
| All | Loop unrolling. |