SLAA534A June 2013 – June 2020
For MSP430 and MSP430X, for efficiency, the compiler uses a special calling convention for certain compiler helper functions that take two 64-bit arguments ("long long int" and "double" arithmetic).
In this special case, the compiler allows two register quads for argument passing: R8::R11 and R12::R15. This is the only case in which R8 through R11 are used as argument registers. The first argument is passed in R8::R11 and the second argument is passed in R12::R15. The return value is in R12::R15, as usual.
See Section 6.4 for helper functions that use modified conventions.
MSP430 and MSP430X example:
C source code
long long a1, a2;
long long func(void)
{
return a1 / a2;
}
Compiled in small code, small data model:
func:
PUSH.W R10; R10 is caller-saved!
PUSH.W R9 ; R9 is caller-saved!
PUSH.W R8 ; R8 is caller-saved!
MOV.W &a1+0,R8
MOV.W &a1+2,R9
MOV.W &a1+4,R10
MOV.W &a1+6,R11
MOV.W &a2+0,R12
MOV.W &a2+2,R13
MOV.W &a2+4,R14
MOV.W &a2+6,R15
CALL #__mspabi_divlli
BR #__mspabi_func_epilog_3