-opt

Specifies code optimization options to apply to object code.

Remarks
  -optkeyword [,...]

The keyword arguments are:

off | none

Suppresses all optimizations. This is the default.

  on

Same as -opt level=2, peephole

  all | full

Same as -opt speed,level=4, schedule, intrinsics, noframe peephole, autoline, func_align 16

  l[evel]=num

Sets a specific optimization level. The options for num are:

For num options 0 through 4 inclusive, the default is 0.

  [no]space

Optimizes object code for size. Equivalent to #pragma optimize_for_size on.

  [no]speed

Optimizes object code for speed. Equivalent to #pragma optimize_for_size off.

  [no]cse | [no]commonsubs

Common subexpression elimination. Equivalent to #pragma opt_common_subs.

  [no]deadcode

Removes dead code. Equivalent to #pragma opt_dead_code.

  [no]deadstore

Removes dead assignments. Equivalent to #pragma opt_dead_assignments.

  [no]lifetimes

Computes variable lifetimes. Equivalent to #pragma opt_lifetimes.

  [no]loop[invariants]

Removes loop invariants. Equivalent to #pragma opt_loop_invariants.

  [no]prop[agation]

Propagation of constant and copy assignments. Equivalent to #pragma opt_propagation.

  [no]strength 

Strength reduction. Reducing multiplication by an array index variable to addition. Equivalent to #pragma opt_strength_reduction.

  [no]dead

Same as -opt [no]deadcode and [no]deadstore. Equivalent to #pragma opt_dead_code on|off and #pragma opt_dead_assignments.

  [no]alias_by_type

Type based alias optimizations. Equivalent to #pragma c9x_alias_by_type.

  [no]peep[hole]

Peephole optimization. Equivalent to #pragma peephole.

  [no]schedule

Performs instruction scheduling.

  display | dump

Displays complete list of active optimizations.

Optimization Routines explains the supported optimizations and their availability at certain optimization levels.

Table 1. Optimization Routines
Optimization Routine Explanation Optimization Level
Global Register Allocation or Global Register Allocation Only for Temporary Values Stores working values of heavily used variables in registers instead of memory. 1, 2, 3, 4
Dead Code Elimination Removes statements never logically executed or referred to by other statements. 1, 2, 3, 4
Branch Optimizations Merges and restructures portions of the intermediate code translation in order to reduce branch instructions. 1, 2, 3, 4
Arithmetic Operations Replaces intensive computational instructions with faster equivalent instructions that produce the same result. 1, 2, 3, 4
Expression Simplification Replaces complex arithmetic expressions with simplified equivalent expressions. 1, 2, 3, 4
Common Subexpression Elimination Replaces redundant expressions with a single expression. 2, 3, 4
Copy Propagation or Copy and Expression Propagation Replaces multiple occurrences of one variable with a single occurrence. 2, 3, 4
Peephole Optimization Applies local optimization routines to small sections of code. 2, 3, 4
Dead Store Elimination Removes assignments to a variable that goes unused before being reassigned again. 3, 4
Live Range Splitting Reduces variable lifetimes to achieve optimal allocation. Shorter variable lifetimes reduce register spilling. 3, 4
Loop-Invariant Code Motion Moves static computations outside of a loop 3, 4
Strength Reduction Inside loops, replaces multiplication instructions with addition instructions. 3, 4
Loop Transformations Reorganizes loop object code in order to reduce setup and completion-test overhead. 3, 4
Loop Unrolling or Loop Unrolling (Opt for Speed Only) Duplicates code inside a loop in order to spread branch and completion-test overhead over more operations. 3, 4
Vectorization For processors that support vector optimizations, translates computations with code-loop arrays into equivalent vector instructions. 3, 4
Lifetime Based Register Allocation or Register Coloring In a particular routine, uses the same processor register to store different variables, as long as no statement uses those variables simultaneously. 3, 4
Instruction Scheduling Rearranges the instruction sequence to reduce conflicts among registers and processor resources. None
Repeated Iterates the optimization routines listed between {* and *}. 4
Stack alignment Aligns the stack pointer. Required when load/store instruction has an alignment requirement. 2,3,4
Stack frame compression Performs live/dead analysis on all non-static symbols (compiler generated temporaries, automatics, input parameters, and outgoing parameters). Using the live/dead information, all the dead stores are eliminated. 2,3,4
Related information
-inline
-ipa
-O
-O+