<p dir="ltr">Hi Andrew,</p>
<p dir="ltr">Am 23.04.2013 19:41 schrieb "Kaylor, Andrew" <<a href="mailto:andrew.kaylor@intel.com">andrew.kaylor@intel.com</a>>:<br>
><br>
> Hi Dmitri,<br>
><br>
> Regarding your first question, if you can use the MCJIT engine a caching mechanism will be available very soon.  I'm preparing to commit a patch today to add this capability.  I'm not sure what it would take to get something similar working with the older JIT engine.  I expect it would take a fair amount of work because the older JIT engine isn't designed around object loading as the MCJIT engine is.<br>

><br>
> Regarding your second question, there might be more than one way to do this, but once you have an llvm::Function (but before you JIT the code) you should be able to use llvm::Function::setCallingConv().</p>
<p dir="ltr">SetCallingConv is not enough. For example consider following C code:</p>
<p dir="ltr">typedef struct S { int a, b, c; } S;</p>
<p dir="ltr">void doS(S s) { ... }</p>
<p dir="ltr">Is compled on Linux x86 32bit as </p>
<p dir="ltr">%struct.S = type { i32, i32, i32 }</p>
<p dir="ltr">define void @doS(i32 %s.0, i32 %s.1, i32 %s.2) nounwind { ... }</p>
<p dir="ltr">And on Linux x86 64bit as</p>
<p dir="ltr">%0 = type { i64, i32 }<br>
%struct.S = type { i32, i32, i32 }</p>
<p dir="ltr">define void @doS(i64 %s.coerce0, i32 %s.coerce1) nounwind { ... }</p>
<p dir="ltr">Dmitri</p>
<p dir="ltr">><br>
> -Andy<br>
><br>
> -----Original Message-----<br>
> From: <a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a>] On Behalf Of Dmitri Rubinstein<br>
> Sent: Tuesday, April 23, 2013 5:25 AM<br>
> To: LLVM Dev<br>
> Subject: [LLVMdev] LLVM JIT Questions<br>
><br>
> Hi all,<br>
><br>
> For my current project I need a couple of informations about JIT. I seen similar questions already, but the answers are a bit older and I hope somebody can provide me a recent information.<br>
><br>
> 1. In my project I frequently construct LLVM IR, compile it and execute with JIT. Because the constructed IR is often the same (but can vary depending on input data) I would like to cache produced machine code on the disk. There is no JIT API for dumping and loading of compiled code.<br>

><br>
> Are there any plans to add this feature in the near future ?<br>
><br>
> How complex would it be to implement this for somebody who has only experience with LLVM code generation, but no deep knowledge of JIT internals ?<br>
><br>
> 2. I also need to interface with C-libraries which are either loaded as a shared library or pre-compiled with clang and loaded as BC file.<br>
> However, LLVM does not provide a way how to construct function signature compatible with the C-ABI of the specific platform. I know that clang library has internally this information, but I need this functionality without clang.<br>

><br>
> Is there any documentation which describes how to do generate C-ABI compatible LLVM functions or code that implements this functionality ?<br>
><br>
> Thanks,<br>
><br>
> Dmitri<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</p>