Hi,
I am using LLVM 3.1, and wants to print the machine code of JIT IR
I try the following method
EngineBuilder builder(&ctx.getModule());
builder.setEngineKind(EngineKind::JIT);
*
TargetMachine * tm = builder.selectTarget();
tm->Options.PrintMachineCode = true;*
engine = builder.create();
and somewhere in my code, I use
runJITonFunction();
Another question is that I am not sure when JIT would dump machine code.
Does anyone know how to do that ?
Chia Lun Liu
--
View this message in context:
http://llvm.1065342.n5.nabble.com/How-to-print-machine-code-of-JIT-IR-tp52776.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
Hi Chia Lun Liu, On 12/21/12 7:47 AM, ChiaLun wrote:> I am using LLVM 3.1, and wants to print the machine code of JIT IR > > I try the following method > > EngineBuilder builder(&ctx.getModule()); > builder.setEngineKind(EngineKind::JIT); > * > TargetMachine * tm = builder.selectTarget(); > tm->Options.PrintMachineCode = true;* > engine = builder.create();Try builder.create(tm). selectTarget() returns a new object, so setting options on that has no effect on the ExecutionEngine which is built by the create() call. In fact, EngineBuilder.create() just creates passes a newly created TargetMachine:> ExecutionEngine *create() { > return create(selectTarget()); > }> Another question is that I am not sure when JIT would dump machine code.It actually dumps it several times during code emission, after running different passes on it. Code emission happens on the first call to the functions, thus lazily (or just in time). Cheers, Clemens
Hi Clemens Hammacher, I try your method, and it prints what I want. I am grateful for your info. Chia Lun Liu -- View this message in context: http://llvm.1065342.n5.nabble.com/How-to-print-machine-code-of-JIT-IR-tp52776p52804.html Sent from the LLVM - Dev mailing list archive at Nabble.com.