Section 2: Compiler
81
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
2.11.5. Register
Usage
Data, address, and floating-point registers are used to hold both the values of
automatic variables and the intermediate results generated during the evaluation
of an expression. The registers used to hold intermediate expression values are
referred to as scratch registers. Registers d0–d2, a0–a1, and fp0–fp1 are used
as scratch registers by the compiler; their values are not guaranteed across
function calls. When the
-X2
command line flag is specified, the value of register
d2 is guaranteed across function calls. Registers d3–d7, a2–a5, and fp2–fp7
must remain stable across function calls and are thus required to be saved and
restored in any function that uses them. Registers a6 (frame pointer) and a7
(stack pointer) must also remain stable across function calls. The unlk instruction
restores registers a6 and a7.
2.12.
Compiler-Generated Function Calls
The compiler usually generates in-line assembly code when translating C
programs. Sometimes, however, the compiler calls library functions to perform
operations when in-line code would be inefficient or when special debugging
options have been requested. The compiler-generated function calls fall into the
following three categories:
1. calls to integer arithmetic functions
2. calls to floating-point software functions
3. calls to debugging functions
Compiler-generated function calls do not follow the standard C function calling
conventions. For example, when calling internal integer arithmetic functions,
parameters are passed in registers instead of on the stack. The following
sections describe the special calling conventions used by each category of
compiler-generated function calls.