
What Kind of Optimization Is Being Performed?
3-15
Optimizing Your Code
3.8.1 Cost-based Register Allocation
The optimizer, when enabled, allocates registers to user variables and com-
piler temporary values according to their type, use, and frequency. Variables
used within loops are weighted to have priority over others, and those vari-
ables whose uses do not overlap may be allocated to the same register.
3.8.2 Autoincrement Addressing
For pointer expressions of the form
*p++,
the compiler uses efficient
TMS320C2x/C2xx/C5x autoincrement addressing modes. In many cases,
where code steps through an array in a loop, such as for (i = 0; i < n; ++i) a[i]...,
the loop optimizations convert the array references to indirect references
through autoincremented register variable pointers. See Example 3
3.8.3 Repeat Blocks
The TMS320C2x/C2xx/C5x supports zero-overhead loops with the RPTB (re-
peat block) instruction. With the optimizer, the compiler can detect loops con-
trolled by counters and generate them using the efficient repeat forms. The it-
eration count can be either a constant or an expression. For the TMS320C2x,
which does not have a repeat block instruction, the compiler allocates an AR
as the loop counter and implements the loop with a BANZ instruction. See
Example 3
Содержание TMS320C2x
Страница 8: ...viii...
Страница 69: ...2 47 C Compiler Description...
Страница 159: ...6 36...
Страница 226: ...8 6...
Страница 250: ...Index Index 14 Z z shell option 2 2 2 4 2 14 overriding with c option 4 5 overriding with n option 2 13...