SPRUIG8I January 2018 – December 2023
Strict conventions associate specific registers with specific operations in the C/C++ environment.
The register conventions dictate how the compiler uses registers and how values are preserved across function calls.
The registers in Table 6-2 are available to the compiler for allocation to register variables and temporary expression results. If the compiler cannot allocate a register of a required type, spilling occurs. Spilling is the process of moving a register's contents to memory to free the register for another purpose.
The C7000 has two datapaths: an A-side datapath with 64-bit “scalar” registers, and a B-side datapath with 512-bit “vector” registers. The lower 64-bits of any B-side vector register can also be accessed as a scalar register by removing the ‘V’ from its name. Scalar registers are not limited to storing scalar values; a vector can be stored in a scalar register if it fits.
D15 is the Stack Pointer (SP). The stack pointer must always remain aligned on a 2-word (8-byte) boundary. The SP points at the first aligned address below (less than) the currently allocated stack.
RP, D15 (SP), A8-A15, B14/VB14, and B15/VB15 are callee-save registers. That is, a called function is required to preserve them so they have the same value on return from a function as they had at the point of the call.
All other registers are caller-save; that is, they are not preserved across a call, so if their value is needed following the call, the caller is responsible for saving and restoring their contents.
Register | File | Preserved by Callee? | Role in Calling Convention |
---|---|---|---|
A0 | A side scalar | no | |
A1 | no | Pointer to return-by-reference value | |
A2 | no | ||
A3 | no | ||
A4 | no | 1st scalar argument | |
A5 | no | 2nd scalar argument | |
A6 | no | 3rd scalar argument | |
A7 | no | 4th scalar argument | |
A8 | yes | 5th scalar argument | |
A9 | yes | 6th scalar argument | |
A10 | yes | 7th scalar argument | |
A11 | yes | 8th scalar argument | |
A12 | yes | 9th scalar argument | |
A13 | yes | ||
A14 | yes | ||
A15 | yes | ||
AL0-AL7 | A side local L | no | |
AM0-AM7 | A side local M | no | |
VB0 | B side vector | no | 1st vector argument |
VB1 | no | 2nd vector argument | |
VB2 | no | 3rd vector argument | |
VB3 | no | 4th vector argument | |
VB4 | no | 5th vector argument | |
VB5 | no | 6th vector argument | |
VB6 | no | 7th vector argument | |
VB7 | no | 8th vector argument | |
VB8 | no | 9th vector argument | |
VB9 | no | 10th vector argument | |
VB10 | no | 11th vector argument | |
VB11 | no | 12th vector argument | |
VB12 | no | 13th vector argument | |
VB13 | no | 14th vector argument | |
VB14 | yes | 15th vector argument | |
VB15 | yes | 16th vector argument | |
VBL0-VBL7 | B side local L | no | |
VBM-VBM7 | B side local M | no | |
D0-D14 | D unit local | no | |
D15 | yes | Stack Pointer | |
RP | Control | yes | Return Pointer |
P0 | Vector predicates | no | 1st vector predicate argument |
P1 | no | 2nd vector predicate argument | |
P2 | no | 3rd vector predicate argument | |
P3 | no | 4th vector predicate argument | |
P4 | no | 5th vector predicate argument | |
P5 | no | 6th vector predicate argument | |
P6 | no | 7th vector predicate argument | |
P7 | no | 8th vector predicate argument | |
CUCR0-CUCR3 | C-unit Control Register | no |
All other control registers are not saved or restored by the compiler.
The compiler assumes that control registers not listed in Table 6-2 that can have an effect on compiled code have default values.