SLAA534A June 2013 – June 2020
For MSP430/430X, up to four arguments to a function are passed in registers.
The number of arguments passed in registers depends on the size and type of each argument. Arguments are assigned, in declared order, to the first available register single, pair, or quad from the following list into which it fits (with the following special exceptions).
For MSP430 and MSP430X, the argument registers are: R12, R13, R14, R15
The size of the CPU registers is different on each architecture. The ways the argument registers are used differs accordingly.
A single register cannot contain multiple arguments. A compiler may promote arguments with a type smaller than int (16 bits) to the size of a register when they are passed in a register. The TI compiler does promote such arguments. Note that the TI compiler does not promote such arguments if they are passed on the stack, unless the arguments are passed to a variadic function or a prototype is not in scope (default argument promotions). When a narrow value is to be passed in a register, the caller is responsible for correctly sign- or zero-extending it to fill the register width.