[LLVMdev] Question about llvm JIT

Peng Cheng gm4cheng at gmail.com
Mon Aug 6 09:35:40 PDT 2012


I have a function in llvm ir as follows:

  def [2 x [3 x double]] @fun()
  {
    return [ ... ]; // a [2 x [3 x double]] constant
  }

I would like to JIT this function in C.

I first get the void pointer using:

  void *FPtr = TheExecutionEngine->getPointerToFunction( func );

Then I need to conver this void pointer to the corresponding C function
pointer
type, and then call the function pointer.

  double a[2][3];

  CType *FP = (CType*) FPtr;

  a = FP();

My question is that:

1. Is this JIT work flow supported by LLVM?

2. If yes, what is correct CType for the JITted function?

3. If not, what are requirements on the LLVM function IRs such that they
could be JIT and called in C?

Thanks,
-Peng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120806/5751c4c9/attachment.html>


More information about the llvm-dev mailing list