SLAA534A June 2013 – June 2020
All architectures have 16 CPU registers. These are named R0 through R15. Some of these registers are special-purpose registers. MSP430 has 16-bit registers. MSP430X has 20-bit CPU registers, with the exception of SR (R2), which is 16 bits. See the MSP430x2xx Family User's Guide (SLAU144) for details about registers.
R0 is the program counter (PC). The program counter must always remain aligned on a word (2-byte) boundary.
R1 is the call stack pointer (SP). The stack pointer must always remain properly aligned, even during hand-coded assembly functions (see Section 4.6.1). Both MSP430 and MSP430X require alignment to 2 bytes. Stack management and the local frame structure is presented in Section 4.6.
R2 is the status register (SR). In some addressing modes, if the register is SR, this is actually interpreted as a constant. Which constant SR represents depends on the addressing mode. See the section on "Constant Generator Registers" in the MSP430x2xx Family User's Guide for details.
R3 is the constant generator register . When this register is used, it is interpreted as a constant. Which constant R3 represents depends on the addressing mode.
Implementations must not use the special-purpose registers for any purpose other than the dedicated special purpose. The remaining registers are general-purpose registers.
For MSP430 and MSP430X, the ABI designates R4-R10 as callee-saved registers. That is, a called function is expected 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 registers. 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 | Alias | Preserved by Callee | Role in Calling Convention |
---|---|---|---|
R0 | PC | N/A | Program Counter |
R1 | SP | yes | Call Stack Pointer |
R2 | SR | N/A | Status Register |
R3 | CG | N/A | Constant Generator Register |
R4 | yes | ||
R5 | yes | ||
R6 | yes | ||
R7 | yes | ||
R8 | yes | function argument (special case) | |
R9 | yes | function argument (special case) | |
R10 | yes | function argument (special case) | |
R11 | no | function argument (special case) | |
R12 | no | function argument, return value | |
R13 | no | function argument, return value | |
R14 | no | function argument, return value | |
R15 | no | function argument, return value |