lost
2012-Mar-01 08:57 UTC
[LLVMdev] Is there any way to print assembly code of a function compiled by ExecutionEngine?
Hello! I'm using LLVM's JIT in my project. Is there any way to view assembly code of functions it generates without disassembling them from the memory?
Jose Fonseca
2012-Mar-01 11:11 UTC
[LLVMdev] Is there any way to print assembly code of a function compiled by ExecutionEngine?
I'm not sure what you mean with "without disassembling them from the memory". If one can't read the JIT functions from memory, then from where would we read it? I wrote a function that can disassemble an arbitrary function using MC on http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp Is this what you're looking for? If so, then perhaps this would be an useful thing to have in LLVM tree itself. Jose ----- Original Message -----> Hello! > > I'm using LLVM's JIT in my project. Is there any way to view assembly > code of functions it generates without disassembling them from the > memory? > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Caldarale, Charles R
2012-Mar-01 13:38 UTC
[LLVMdev] Is there any way to print assembly code of a function compiled by ExecutionEngine?
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of lost > Subject: [LLVMdev] Is there any way to print assembly code of a function compiled by ExecutionEngine?> I'm using LLVM's JIT in my project. Is there any way to view assembly > code of functions it generates without disassembling them from the > memory?We use the following: Context = getGlobalContext(); m3log = new dt_ostream(sysLogger); fm3log = new formatted_raw_ostream(*m3log); pMod = new Module("label", Context); TD = new TargetData(pMod->getDataLayout()); pMPasses = new PassManager(); pMPasses->add(new TargetData(*TD)); tmc->addPassesToEmitFile(*pMPasses, *fm3log, TargetMachine::CGFT_AssemblyFile); pMPasses->run(*pMod); (Lots of other bits omitted from the above for simplicity.) Reference: http://llvm.org/docs/doxygen/html/classllvm_1_1LLVMTargetMachine.html#a5c437ac9b4d158e38ad4e826dac63914 - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.