-opt. NXP CodeWarrior Development Studio
Iklan
Iklan
Chapter 10 Command-Line Options for Optimization
Equivalent to
-opt level=4
, peephole, schedule, autoinline, func_align 16.
p
Equivalent to
-opt speed
.
s
Equivalent to
-opt space
.
Remarks
Options can be combined into a single command. Command is case-sensitive.
10.5 -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:
•
0
- Global register allocation only for temporary values. Equivalent to
#pragma optimization_level 0
.
•
1
- Adds dead code elimination, branch and arithmetic optimizations, expression simplification. Equivalent to
#pragma optimization_level 1
.
•
2
- Adds common subexpression elimination, copy and expression propagation, stack frame compression, stack alignment, fast floating-point to integer conversions.
Equivalent to:
#pragma optimization_level 2
.
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
Freescale Semiconductor, Inc.
101
-opt
•
3
- Adds dead store elimination, live range splitting, loop-invariant code motion, strength reduction, loop transformations, loop unrolling (with
-opt speed
only), loop vectorization, lifetime-based register allocation. Equivalent to optimization_level 3
.
• 4 - Like level 3, but with more comprehensive optimizations from levels 1 and 2.
Equivalent to #pragma optimization_level 4.
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]peep[hole]
Peephole optimization. Equivalent to
#pragma peephole
.
[no]schedule
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
102 Freescale Semiconductor, Inc.
Chapter 10 Command-Line Options for Optimization
Performs instruction scheduling.
display | dump
Displays complete list of active optimizations.
Table 10-1 explains the supported optimizations and their availability at certain optimization levels.
Table 10-1. Optimization Routines
Optimization Routine
Global Register Allocation or Global
Register Allocation Only for Temporary
Values
Dead Code Elimination
Explanation
Stores working values of heavily used variables in registers instead of memory.
Branch Optimizations
Arithmetic Operations
Expression Simplification
Common Subexpression Elimination
Copy Propagation or Copy and
Expression Propagation
Peephole Optimization
Dead Store Elimination
Live Range Splitting
Loop-Invariant Code Motion
Strength Reduction
Loop Transformations
Loop Unrolling or Loop Unrolling (Opt for
Speed Only)
Removes statements never logically executed or referred to by other statements.
Merges and restructures portions of the intermediate code translation in order to reduce branch instructions.
Replaces intensive computational instructions with faster equivalent instructions that produce the same result.
Replaces complex arithmetic expressions with simplified equivalent expressions.
Replaces redundant expressions with a single expression.
Replaces multiple occurrences of one variable with a single occurrence.
Applies local optimization routines to small sections of code.
Removes assignments to a variable that goes unused before being reassigned again.
Reduces variable lifetimes to achieve optimal allocation. Shorter variable lifetimes reduce register spilling.
Moves static computations outside of a loop
Inside loops, replaces multiplication instructions with addition instructions.
Reorganizes loop object code in order to reduce setup and completion-test overhead.
Duplicates code inside a loop in order to spread branch and completion-test overhead over more operations.
1, 2, 3, 4
1, 2, 3, 4
1, 2, 3, 4
1, 2, 3, 4
1, 2, 3, 4
2, 3, 4
2, 3, 4
2, 3, 4
3, 4
3, 4
3, 4
3, 4
3, 4
3, 4
Optimization Level
Table continues on the next page...
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
Freescale Semiconductor, Inc.
103
-opt
Table 10-1. Optimization Routines (continued)
Optimization Routine
Vectorization
Lifetime Based Register Allocation or
Register Coloring
Instruction Scheduling
Repeated
Stack alignment
Stack frame compression
Explanation
For processors that support vector optimizations, translates computations with code-loop arrays into equivalent vector instructions.
In a particular routine, uses the same processor register to store different variables, as long as no statement uses those variables simultaneously.
Rearranges the instruction sequence to reduce conflicts among registers and processor resources.
Iterates the optimization routines listed between {* and *}.
Aligns the stack pointer. Required when load/store instruction has an alignment requirement.
Performs live/dead analysis on all nonstatic symbols (compiler generated temporaries, automatics, input parameters, and outgoing parameters).
Using the live/dead information, all the dead stores are eliminated.
3, 4
3, 4
None
4
2,3,4
2,3,4
Optimization Level
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
104 Freescale Semiconductor, Inc.
Unduh
Iklan