
Optimization Types and Functions
SC100 C Compiler
5-19
5.3.3 Low-Level Optimizations
The Low-Level Transformations (LLT) phase is a separate modular stage of the optimization process
which implements a number of low-level optimizations. This phase transforms the linear code generated
by the high-level optimization phase into parallel assembly code, which can take advantage of the parallel
execution units of the SC100 architecture.
The degree of parallelization that the optimizer is able to achieve is limited by the number and type of
dependencies within the source code. See
Section 5.3.1,
“
Dependencies and Parallelization,
”
for a
summary of these issues.
Section 5.4,
“
Guidelines for Using the Optimizer,
”
provides detailed advice about preparing your source
code with a view to reducing dependencies and realizing the maximum potential for optimization.
All low-level optimizations are applied when the level 2 optimization (option -O2) is selected. The speed
and time optimization levels (options -Os, -Ot, -Ot1 and -Ot2) apply most of the low-level optimizations,
with different thresholds. See
Section 5.3.4,
“
Time Optimizations,
”
and
Section 5.3.5,
“
Space
Optimizations,
”
for more detail.
Low-level optimizations are not activated at all when either option -O0 or option -O1 is selected.
The major low-level optimizations are summarized below in Table 5-3, and are described in detail in the
sections that follow.
Table 5-3. Summary of Low-Level Optimizations
Optimization
Description
Section
Page
Instruction scheduling
Executes multiple instructions in the same cycle, fills
delay slots associated with a branch operation, and
avoids pipeline restrictions
5.3.3.1
5-21
Low-level software pipelining
Rearranges instructions in a loop to minimize
dependencies
5.3.3.2
5-22
Conditional execution and
predication
Transforms a branch into a sequence of conditional
actions
5.3.3.3
5-25
Speculative execution
Moves instructions from conditional to unconditional
paths
5.3.3.4
5-26
Post-increment detection
Combines the functions of incrementing (or
decrementing) a pointer and accessing the computed
address into one instruction
5.3.3.5
5-27
Low-level peephole optimization
Merges a sequence of instructions into a single
instruction
5.3.3.6
5-28