[LLVMdev] How to run passes 'addPassesToEmitMC' from the command line?

Yuri yuri at rawbw.com
Sat Feb 8 13:19:11 PST 2014


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



More information about the llvm-dev mailing list