Expression Registers - Texas Instruments TMS320C2x User Manual

Optimizing c compiler digital signal processor
Hide thumbs Also See for TMS320C2x:
Table of Contents

Advertisement

6.2.4.2
Register Variables When the Optimizer is Used
6.2.5

Expression Registers

6.2.6
Return Values
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.
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 page 5-11, for
more information.
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.
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.
Register Conventions
Run-Time Environment
6-13

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tms320c2xxTms320c5x

Table of Contents