Optimization
Calls, Jumps, and Branches
For some branches or function calls, the compiler can replace the original
instructions with more efficient instructions to lower execution time or
with fewer instructions to reduce program size. Optimizations that
perform such restructuring include:
•
branch optimization
•
branch prediction for i960 Cx and Hx processors
•
leaf-function identification
•
inline function expansion
•
tail-call elimination
Branch Optimizations
Branch optimizations streamline the flow of program control by
performing the following actions:
•
collapsing branch chains
•
eliminating branch-to-next-line sequences
•
eliminating branch-around-branch sequences
The following program fragments show branch optimizations.
•
This program fragment contains a branch directly to another branch
instruction. It doesn't matter whether the branch is conditional or
unconditional. After branch optimization, the branch chain is
collapsed to a single branch.
The final branch might be eliminated by the dead code optimization.
Before
cmpi
g1, g2
bl
.L1
...
.L1:
b
.L2
After
cmpi
g1, g2
bl
.L2
...
.L1:
b
.L2
11
11-9