[LLVMdev] Changes to the PTX calling conventions

Peter Collingbourne peter at pcc.me.uk
Tue Dec 13 13:42:48 PST 2011

On Tue, Dec 13, 2011 at 03:50:28PM -0500, Justin Holewinski wrote:
> You mean having no calling convention for device functions, and a new,
> common calling convention for kernels?
> While this would work in practice, my issue with this approach is that it
> goes against the LLVM reference:
> *"ccc" - The C calling convention*:This calling convention (the default if
> no other calling convention is specified) matches the target C calling
> conventions. This calling convention supports varargs function calls and
> tolerates some mismatch in the declared prototype and implemented
> declaration of the function (as does normal C).
> Our devices do not really have a "C calling convention," so the default
> does not make much sense.  However, I have no objection to modifying the
> documentation to state that the C calling convention is the default for
> targets that support that convention.

I think that we should have the default calling convention map
to *something* on every target.  On PTX, the ptx_device calling
convention makes sense.

The reason I would like the C calling convention to be supported is
that it allows us to write callable generic functions in LLVM bitcode.
In libclc I had to write identity wrappers for each target [1] around
functions implemented in LLVM bitcode just to be able to call them,
and it would be much more convenient if I didn't have to do this for
every target.


[1] http://git.pcc.me.uk/?p=~peter/libclc.git;a=blob;f=ptx/lib/integer/add_sat.ll;h=9b8311cfb9ce9158f5359fec0d864e37e132b701;hb=3637bed2ea414a417e8e0d8d0d22e29cb0d3767e

More information about the llvm-dev mailing list