I'm using the IRBuilder C++ API to generate LLVM IR code and execute it on-the-fly. I know about Module::dump() to print the IR code, but is there any way to print out the native assembly code (x86 in my case)?
- Paul
I'm using the IRBuilder C++ API to generate LLVM IR code and execute it on-the-fly. I know about Module::dump() to print the IR code, but is there any way to print out the native assembly code (x86 in my case)?
- Paul
"Paul J. Lucas" <paul@lucasmail.org> writes:
I'm using the IRBuilder C++ API to generate LLVM IR code and execute
it on-the-fly. I know about Module::dump() to print the IR code, but
is there any way to print out the native assembly code (x86 in my
case)?
Not the native assembly, but a representation of the native
instructions, just create your ExecutionEngine thus:
EngineBuilder builder(MyModule);
...
TargetMachine *tm = builder.selectTarget();
tm->Options.PrintMachineCode = 1;
ExecutionEngine *EE = builder.create(tm);
It is quite verbose too.