Yuri
2014-Feb-08 21:19 UTC
[LLVMdev] How to run passes 'addPassesToEmitMC' from the command line?
How do I run passes, that 'addPassesToEmitMC' specifies, on the given module using a command line? The equivalent C++ code is: Module *M = ...; // input: module object TargetMachine *TM = ... SmallVector<char, 4096> Buffer; raw_svector_ostream OS(Buffer); PassManager PM; PM.add(new DataLayout(*TM->getDataLayout())); (void)TM->addPassesToEmitMC(PM, NULL, OS, false)); PM.run(*M); OS.flush(); // --> ouput: binary Buffer Any way to do the same from the command line? 'llc' brings module to .s or .o, but not to relocatable ELF object as this C++ does. addPassesToEmitMC is only called from MCJIT, and it doesn't look like it is called from any command line utility. Yuri
Tim Northover
2014-Feb-09 11:36 UTC
[LLVMdev] How to run passes 'addPassesToEmitMC' from the command line?
> Any way to do the same from the command line? > 'llc' brings module to .s or .o, but not to relocatable ELF object as this > C++ does.I'm not sure I understand the distinction. A .o file is a relocatable ELF object (depending on your platform, obviously). What differences between the output of "llc -filetype=obj" and the MCJIT route are causing you problems? Tim.