<font size=2 face="sans-serif">Hi Again,</font>
<br>
<br><font size=2 face="sans-serif">I'm a little confused regarding what
is the exact Orc's functions I should use</font>
<br><font size=2 face="sans-serif">in order to save the functions code
in a code cache so it could be later</font>
<br><font size=2 face="sans-serif">replaced with different versions of
it and I appreciate your help.</font>
<br>
<br><font size=2 face="sans-serif">Just a reminder I want to dynamically
recompile the program based on profile</font>
<br><font size=2 face="sans-serif"> collected at the run-time. I would
like to start executing the program from</font>
<br><font size=2 face="sans-serif">the code-cache and at some point be
able to replace a function body with it's</font>
<br><font size=2 face="sans-serif">new compiled version; this can be done
by replacing the entry in the function</font>
<br><font size=2 face="sans-serif"> code with a trampoline to It's
new version so that future calls to it will</font>
<br><font size=2 face="sans-serif">call the new version code.</font>
<br>
<br><font size=2 face="sans-serif">Does the CompileOnDemandLayer executes
the program from a code cache </font>
<br><font size=2 face="sans-serif">and holds pointers to the code of the
functions it executes? I am compiling for Power machine. </font>
<br><font size=2 face="sans-serif">Is there a target specific pieces that
I should implement for making Orc work on Power?</font>
<br>
<br><font size=2 face="sans-serif">Thanks again,</font>
<br><font size=2 face="sans-serif">Revital</font>
<br>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:      
 </font><font size=1 face="sans-serif">Lang Hames <lhames@gmail.com></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 <llvmdev@cs.uiuc.edu></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:      
 </font><font size=1 face="sans-serif">20/07/2015 08:41 PM</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>
<br>
<br>
<br><font size=3>Hi Revital,</font>
<br>
<br><font size=3>The CompileOnDemand layer is used by the lazy bitcode
JIT in the lli tool. You can find the code in llvm/tools/lli/OrcLazyJIT.*
.</font>
<br>
<br><font size=3>Cheers,</font>
<br><font size=3>Lang.</font>
<br>
<br>
<br><font size=3>On Mon, Jul 20, 2015 at 2:32 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>Lang</font><font size=2 face="sans-serif">,</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
Thanks for your answer.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
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><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>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
From:        </font><font size=1 face="sans-serif">Lang
Hames <</font><a href=mailto:lhames@gmail.com target=_blank><font size=1 color=blue face="sans-serif"><u>lhames@gmail.com</u></font></a><font size=1 face="sans-serif">></font><font size=3>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
To:        </font><font size=1 face="sans-serif">Revital1
Eres/Haifa/IBM@IBMIL</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Cc:        </font><font size=1 face="sans-serif">LLVM
Developers Mailing List <</font><a href=mailto:llvmdev@cs.uiuc.edu target=_blank><font size=1 color=blue face="sans-serif"><u>llvmdev@cs.uiuc.edu</u></font></a><font size=1 face="sans-serif">></font><font size=3>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
Date:        </font><font size=1 face="sans-serif">10/07/2015
12:10 AM</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Subject:        </font><font size=1 face="sans-serif">Re:
[LLVMdev] Help with using LLVM to re-compile hot functions at run-time</font><font size=3>
<br>
</font>
<hr noshade><font size=3><br>
<br>
<br>
Hi Revital, <br>
<br>
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. <br>
<br>
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. <br>
<br>
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. <br>
<br>
Cheers, <br>
Lang. <br>
<br>
<br>
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><font size=2 face="sans-serif"><br>
Hello,</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
I am new to LLVM and a I appreciate your help with the following:</font><font size=3>
</font><font size=2 face="sans-serif"><br>
<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> </font><font size=2 face="sans-serif"><br>
<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> </font><font size=2 face="sans-serif"><br>
<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>
</font><font size=2 face="sans-serif"><br>
<br>
I appreciate any advice/starting points for this project.</font><font size=3>
</font><font size=2 face="sans-serif"><br>
<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><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>
<br>
<br>
</font>
<br>
<br>
<br>