[cfe-dev] Custom calling conventions in C code

Chris Lattner clattner at apple.com
Mon Jun 23 09:13:55 PDT 2008

On Jun 23, 2008, at 2:28 AM, Matthijs Kooijman wrote:

> Hi all,
> LLVM supports arbitrary, backend specific calling conventions,  
> besides the
> standard predefined ones. I want to be able to compile C programs  
> using some
> custom calling conventions, but I couldn't find any way to mark a  
> specific
> program in my C source as using some arbitrary, custom calling  
> convention (not
> in C itself, clang or gcc extensions).
> Is there any way to accomplish this, or should there be one?

Hey Matthijs,

There isn't currently a way to do this, you'd have to use specific  
named conventions like "cdecl" "stdcall" "pascal" etc, along with  

I think it would be a great thing for compiler hackers to have a  
mechanism to access an arbitrary calling convention, but I also think  
it would be a disaster to expose this to end user code.  The problem  
is that not all constructs are valid with every calling convention,  
and if there is ever a large install base of code using "calling  
convention 19" in their C code, we'd have to support that forever.   
CC#'s are supposed to be an internal implementation detail of the IR.


More information about the cfe-dev mailing list