<div dir="ltr">Hi Revital,<div><br></div><div>The CompileOnDemand layer is used by the lazy bitcode JIT in the lli tool. You can find the code in llvm/tools/lli/OrcLazyJIT.* .</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 20, 2015 at 2:32 AM, Revital1 Eres <span dir="ltr"><<a href="mailto:ERES@il.ibm.com" target="_blank">ERES@il.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font size="2" face="sans-serif">Hello </font><font size="3">Lang</font><font size="2" face="sans-serif">,</font>
<br>
<br><font size="2" face="sans-serif">Thanks for your answer.</font>
<br>
<br><font size="2" face="sans-serif">I am now looking for an example of the
usage of CompileOnDemandLayer. Is there an example available for that (could
not find one in llvm/examples)?</font>
<br>
<br><font size="2" face="sans-serif">Thanks,</font>
<br><font size="2" face="sans-serif">Revital</font>
<br>
<br>
<br>
<br><font size="1" color="#5f5f5f" face="sans-serif">From:      
 </font><font size="1" face="sans-serif">Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">To:      
 </font><font size="1" face="sans-serif">Revital1 Eres/Haifa/IBM@IBMIL</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Cc:      
 </font><font size="1" face="sans-serif">LLVM Developers Mailing
List <<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Date:      
 </font><font size="1" face="sans-serif">10/07/2015 12:10 AM</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Subject:    
   </font><font size="1" face="sans-serif">Re: [LLVMdev]
Help with using LLVM to re-compile hot functions at run-time</font>
<br>
<hr noshade><span class="">
<br>
<br>
<br><font size="3">Hi Revital,</font>
<br>
<br><font size="3">LLVM does have an IR interpreter, but I don't think it's
maintained well (or possibly at all). The interpreter is also not designed
to interact with the LLVM JITs.</font>
<br>
<br><font size="3">We generally encourage people to just JIT LLVM IR, rather
than interpreting it. For the use-case you have described, you could JIT
IR with no optimizations to begin with, then re-JIT hot functions at a
higher level.</font>
<br>
<br><font size="3">The Orc JIT APIs (LLVM's newer JIT APIs) were written
with this kind of use-case in mind, and are probably a better fit for this
than MCJIT. There is no built-in hot-function detection or recompilation
yet, but I think this would be *fairly* easy to write in terms of Orc's
callback API.</font>
<br>
<br><font size="3">Cheers,</font>
<br><font size="3">Lang.</font>
<br>
<br>
<br><font size="3">On Thu, Jul 9, 2015 at 4:19 AM, Revital1 Eres <</font><a href="mailto:ERES@il.ibm.com" target="_blank"><font size="3" color="blue"><u>ERES@il.ibm.com</u></font></a><font size="3">>
wrote:</font>
<br><font size="2" face="sans-serif">Hello,</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
I am new to LLVM and a I appreciate your help with the following:</font><font size="3">
<br>
</font><font size="2" face="sans-serif"><br>
I want to run the LLVM IR through virtual machine (LLVM interpreter?) and
jit</font><font size="3"> </font><font size="2" face="sans-serif"><br>
compile the hot functions (using MCJIT).</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
This task will require amongst other identifying the hot functions and
having a</font><font size="3"> </font><font size="2" face="sans-serif"><br>
code cache that should be patched with the native code of the functions
after</font><font size="3"> </font><font size="2" face="sans-serif"><br>
they are jitted.</font><font size="3"> <br>
</font><font size="2" face="sans-serif"><br>
I've read so far about MCJIT and lli however I have not seen that the LLVM
<br>
interpreter can be used as a VM the way I was looking for; meaning</font><font size="3">
</font><font size="2" face="sans-serif"><br>
execute the code one instruction at a time; have a profiling mode to <br>
identify hot functions and call jit to compile the hot functions.</font><font size="3">
<br>
</font><font size="2" face="sans-serif"><br>
I appreciate any advice/starting points for this project.</font><font size="3">
<br>
</font><font size="2" face="sans-serif"><br>
Thanks,</font><font size="3"> </font><font size="2" face="sans-serif"><br>
Revital</font><font size="3"> <br>
<br>
_______________________________________________<br>
LLVM Developers mailing list</font><font size="3" color="blue"><u><br>
</u></font></span><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank"><font size="3" color="blue"><u>LLVMdev@cs.uiuc.edu</u></font></a><font size="3"> 
       </font><a href="http://llvm.cs.uiuc.edu/" target="_blank"><font size="3" color="blue"><u>http://llvm.cs.uiuc.edu</u></font></a><font size="3" color="blue"><u><br>
</u></font><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank"><font size="3" color="blue"><u>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</u></font></a><font size="3"><br>
</font>
<br>
<br>
<br></blockquote></div><br></div>