Register Conventions
6-13
Run-Time Environment
Setting up a register variable at run time requires approximately four instruc-
tions per register variable. To use this feature efficiently, use register variables
only if the variable is accessed more than twice.
6.2.4.2 Register Variables When the Optimizer is Used
When the optimizer is used, all user register declarations are ignored. The
optimizer decides which variables or compiler temporaries are allocated to
registers. The optimizer allocates the variables, not their addresses, directly
to registers. The optimizer can allocate the registers AR5, AR6, and AR7 for
register variables. Because AR5 is not preserved across function calls, it is
used for variables that overlap any calls.
Because the register use for variables depends on whether or not you use the
optimizer, you should avoid writing code that depends on specific registers
allocated to specific variables.
Note: Using AR6 and AR7 as Global Register Variables
If you have disabled the compiler from using AR6 and AR7 with the
−
r option,
AR6 and AR7 are not available for use as register variables. See section
5.6.3,
Disabling the Compiler From Using AR6 and AR7
on
more information.
6.2.5 Expression Registers
The compiler uses registers not being used for register variables to evaluate
expressions and store temporary results. The contents of the expression reg-
isters are not preserved across function calls. Any register that is being used
for temporary storage when a call occurs is saved to the local frame before the
function is called. This prevents the called function from saving and restoring
expression registers.
6.2.6 Return Values
When a value of any scalar type (integer, pointer, or floating point) is returned
from a function, the value is placed in the accumulator when the function
returns.
Sixteen-bit types (char, short, int, or pointer) are loaded into the accumulator
with correct sign extension.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...