<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Craig,<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I am trying to JIT PHP code and this is a hack ..<br>
<a href="https://github.com/sathvikl/llvm/blob/master/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp">https://github.com/sathvikl/llvm/blob/master/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp</a><br>
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">It writes out file of JITed methods in /tmp using the OProfileJIT interface so if you register via the OProfile interface <br></div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">+ JITEventListener *event_listener = JITEventListener::createOProfileJITEventListener()<br>+ llvm_engine->RegisterJITEventListener(event_listener) <br>
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">and run oprofile, it will dump out the file with JITed methods into a file. If you use a disassembler, you can try libxed <br><a href="https://github.com/facebook/hhvm/blob/10b2a6a3a8075b676ea167ea49e6bba5b8cca68e/hphp/util/disasm.cpp">https://github.com/facebook/hhvm/blob/10b2a6a3a8075b676ea167ea49e6bba5b8cca68e/hphp/util/disasm.cpp</a> <br>
</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">shows how to use it. <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">libxed is packaged here - <br>
<a href="https://software.intel.com/en-us/articles/pin-a-binary-instrumentation-tool-downloads">https://software.intel.com/en-us/articles/pin-a-binary-instrumentation-tool-downloads</a><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I plan to write a cleaner interface for this so you can view it via perf but didn't get to it.<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
sathvik <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"> <br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 24, 2014 at 4:03 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah, that's probably how I'd do it.<br>
<br>
Might be useful if you guys want to contribute that as a command line<br>
option Kevin.<br>
<br>
-eric<br>
<br>
On Tue, Jun 24, 2014 at 3:03 PM, Kevin Modzelewski <<a href="mailto:kmod@dropbox.com">kmod@dropbox.com</a>> wrote:<br>
> We do this in Pyston using a JITEventListener that just disassembles the<br>
> output; it's "it works let's move on"-quality:<br>
> <a href="https://github.com/dropbox/pyston/blob/master/src/codegen/dis.cpp" target="_blank">https://github.com/dropbox/pyston/blob/master/src/codegen/dis.cpp</a><br>
><br>
> I'm not sure how efficient the disassembling is, but at least the process is<br>
> pretty self-contained.<br>
<div class="im HOEnZb">><br>
><br>
> On Tue, Jun 24, 2014 at 1:33 PM, Craig Smith <<a href="mailto:craig@ni.com">craig@ni.com</a>> wrote:<br>
>><br>
>><br>
</div><div class="HOEnZb"><div class="h5">>> Hello all,<br>
>><br>
>> I'm trying to hack MCJIT::emitObject to optionally output the<br>
>> corresponding text assembly associated with the object code being emitted<br>
>> (if a debug flag is set in the app/dev environment which is hosting LLVM).<br>
>> I attempted to do this by adding another AsmPrinter pass to the<br>
>> PassManager, but this runs into all sorts of problems because there's only<br>
>> once MCContext and one MachneModuleInfo pass maintaining various state<br>
>> information (MCSections, MCSymbols, etc.) and the two AsmPrinter passes<br>
>> interfere with each other.<br>
>><br>
>> The only way I've been able to get this to work is to create an entirely<br>
>> separate PassManager, and use addPassesToEmitFile() on it, which will redo<br>
>> the entire CodeGen process again unnecessarily.<br>
>> Does anyone have any ideas/pointers on how I might do this efficiently?<br>
>> This is only for a debugging aid, but I'd like to not have to compile<br>
>> everything twice when it's enabled.<br>
>><br>
>> Thanks<br>
>> Craig<br>
>><br>
>><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" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
><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" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><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" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>