[llvm-dev] Matching calling conventions in lowerFormalArguments

Joan Lluch via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 7 14:38:38 PDT 2019


I am now starting to implement some of the basic library functions for my architecture. Among other things, the processor does not implement hardware multiplication, so I need to define it in the form of a library call.

I already specified the required library names and calling conventions for some testing library functions by calling ‘setLibcallName’ and ‘setLibcallCallingConv’ in the MyTargetTargetLowering constructor. This works fine when calling the functions, from the user program, for example when explicitly or implicitly using ‘memcpy’ or when performing a multiplication. The functions get properly called according to the specified calling convention in ’setLibcallCallingConv'. This is handled in the ‘LowerCall’ method of the ‘myTargetLowering' implementation.

However, I do not know what I need to do in order to have the actual library functions to use the required calling convention upon receiving the arguments. In particular, in my implementation of ‘LowerFormalArguments’ I always get the ‘C’ calling convention, not the one that I want for the library functions. 

So how do I tell LLVM that a particular function should use a specific calling convention?

Joan Lluch 


More information about the llvm-dev mailing list