TMS34010 C Compiler - Al Kossow's Bitsavers
TMS34010 C Compiler - Al Kossow's Bitsavers
TMS34010 C Compiler - Al Kossow's Bitsavers
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Runtime Environment - Register Conventions<br />
5.2 Register Conventions<br />
Strict conventions associate specific registers with specific operations in the<br />
C environment. If you plan to interface assembly language routines to a C<br />
program, it is important that you understand these register conventions.<br />
5.2.1 Dedicated Registers<br />
The C environment reserves three registers. Do not modify these registers in<br />
any other manner than that described in Section 5.3, Function Structure and<br />
Calling Conventions, page 5-8.<br />
SP<br />
A14 (STK)<br />
A13 (FP)<br />
5.2.2 Using Registers<br />
points to the top of the system stack.<br />
points to the program stack.<br />
points to the beginning of the currently active frame.<br />
In addition, the C compiler assumes certain information about bits in the status<br />
register. Specifically, it assumes that FS1 (field size 1) is 32 within a C function.<br />
FSO, however, can be changed in a function without being restored.<br />
A function can usually use registers AO through A 12, however:<br />
• When a function is called, it must save the contents of each register that<br />
it uses; it must restore these registers before it returns to the caller. Register<br />
A8 is the only exception; its contents do not have to be saved or<br />
restored.<br />
• If a function returns an integer value or a pointer, the value must be<br />
placed in A8.<br />
The code generator uses the A-file registers for the following purposes:<br />
Expression analysis<br />
Return value/Scratch<br />
User register variables<br />
AO through A11<br />
A8<br />
A9,A10,A11,A12,AO,A2,A4,A6<br />
The C compiler doesn't use registers 80 through 814.<br />
Expression-analysis registers are allocated from high to low registers, based<br />
on availability and current use. (<strong>Al</strong>l integer expression analysis uses 32-bit<br />
. math.)<br />
Note:<br />
The compiler constantly tracks the contents of registers and attempts to<br />
reuse register data whenever possible. Therefore, it is inadvisable to use<br />
inline assembly language or any other method to modify a register that a<br />
function is using. Use the -r code generator option to produce information<br />
about register use.<br />
5-6