[LLVMdev] Problem selecting the correct registers for a calling convention

Job Noorman jobnoorman at gmail.com
Wed Jul 3 06:37:31 PDT 2013


Hi Borja,

Thanks a lot! Looking at your implementation in the AVR backend has helped me 
solve the problem for the MSP430.

Regards,
Job

On Tuesday 02 July 2013 14:15:18 Borja Ferrer wrote:
> Hello Job,
> 
> I managed to resolve this same problem by using custom C++ code since as
> you mentioned
> the isSplit flag doesn't help here. There are 2 ways to analyze the
> arguments of a function:
> 
> 1) You can get a Function pointer in LowerFormalArguments, and in LowerCall
> only when Callee can by dyn_casted to a GlobalAddressSDNode. By having this
> pointer you can then do:
> 
> for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();I !=
> E; ++I)
> 
>   {
>     unsigned Bytes = TD->getTypeSizeInBits(I->getType()) / 8;
>     // do stuff here
>   }
> 
> 
> 2) The second case is when the dyn_cast above fails because the Callee
> SDValue is a
> 
> ExternalSymbolSDNode. In this case you have to manually analyze the
> arguments using PartOffset.



More information about the llvm-dev mailing list