<div>I have a function in llvm ir as follows:</div><div><br></div><div> def [2 x [3 x double]] @fun()</div><div> {</div><div> return [ ... ]; // a [2 x [3 x double]] constant</div><div> }</div><div><br></div><div>I would like to JIT this function in C.</div>
<div><br></div><div>I first get the void pointer using:</div><div><br></div><div> void *FPtr = TheExecutionEngine->getPointerToFunction( func );</div><div><br></div><div>Then I need to conver this void pointer to the corresponding C function pointer</div>
<div>type, and then call the function pointer.</div><div><br></div><div> double a[2][3];</div><div><br></div><div> CType *FP = (CType*) FPtr;</div><div> </div><div> a = FP();</div><div><br></div><div>My question is that:</div>
<div><br></div><div>1. Is this JIT work flow supported by LLVM?</div><div><br></div><div>2. If yes, what is correct CType for the JITted function?</div><div><br></div><div>3. If not, what are requirements on the LLVM function IRs such that they could be JIT and called in C?</div>
<div><br></div><div>Thanks,</div><div>-Peng</div><div><br></div>