[LLVMdev] fastcc, tail calls, and gcc

Mark Shannon marks at dcs.gla.ac.uk
Fri Feb 13 02:11:46 PST 2009


Albert Graef wrote:
> Jeff Kuskin wrote:
>> Correct?  If not, how do I call a LLVM JIT-generated fastcc function
>> from a function statically compiled by GCC?
> 
> Well, you can always generate a little wrapper function with C calling
> convention which just calls the fastcc function.
> 

I use the fastcall convention all the time.
LLVM-jitted code calling GCC-compile code and vice-versa.

This works for x86 (32 bit):

void* llvm_jit_compile();

typedef __attribute__((fastcall)) int (*func_ptr)(int p1, int p2);

int g(void) {
     func_ptr f = (func_ptr)llvm_jit_compile();
     return f(1, 2);
}

Mark



More information about the llvm-dev mailing list