<div dir="ltr">We do this in Pyston using a JITEventListener that just disassembles the output; it's "it works let's move on"-quality:<div><a href="https://github.com/dropbox/pyston/blob/master/src/codegen/dis.cpp">https://github.com/dropbox/pyston/blob/master/src/codegen/dis.cpp</a><br>
</div><div><br></div><div style>I'm not sure how efficient the disassembling is, but at least the process is pretty self-contained.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 24, 2014 at 1:33 PM, Craig Smith <span dir="ltr"><<a href="mailto:craig@ni.com" target="_blank">craig@ni.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello all,<br>
<br>
I'm trying to hack MCJIT::emitObject to optionally output the corresponding text assembly associated with the object code being emitted (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 PassManager, but this runs into all sorts of problems because there's only once MCContext and one MachneModuleInfo pass maintaining various state information (MCSections, MCSymbols, etc.) and the two AsmPrinter passes interfere with each other.<br>
<br>
The only way I've been able to get this to work is to create an entirely separate PassManager, and use addPassesToEmitFile() on it, which will redo the entire CodeGen process again unnecessarily.<br>
Does anyone have any ideas/pointers on how I might do this efficiently? This is only for a debugging aid, but I'd like to not have to compile 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>
</blockquote></div><br></div>