This patch fixes the MSP430 calling convention by implementing most parts in C++ instead of tablegen.
After having asked a question about this on llvm-dev and receiving an answer from a maintainer of the AVR backend, I think using custom C++ code is necessary mainly for the following reasons:
- Split arguments are assigned to registers in big-endian order which cannot be done using tablegen since the MSP430 is little-endian.
- Split arguments should either be placed completely in registers or completely on the stack but never be mixed. I don't think there is a way to enforce this in tablegen.
Note that this patch is heavily inspired by the calling convention implementation of the AVR backend.
PS: I created a new revision since D1046 only deals with the return value part of the calling convention while this patch also handles arguments.