[LLVMdev] Native MCAsmStreamer?

Edward Meewis ed at extraordinarymachine.nl
Thu Oct 13 17:36:34 PDT 2011


Hi all,

I'm working on a new target, a 16 bit microcontroller, in the process of 
learning the LLVM backend things.

It's going well so far, but I have a question:

I'd like to use a pure MCAsmStreamer and not have another layer of glue. 
Right now, I have the following to make it compile:
---
using namespace llvm;

namespace {
   class HCS12AsmPrinter : public AsmPrinter {
   public:
     HCS12AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
       : AsmPrinter(TM, Streamer) {}

     virtual const char *getPassName() const {
       return "HCS12 Assembly Printer";
     }
   };
} // end of anonymous namespace

// Force static initialization.
extern "C" void LLVMInitializeHCS12AsmPrinter() {
   RegisterAsmPrinter<HCS12AsmPrinter> X(TheHCS12Target);
}
---
Most targets seem to go through this, but is there a way to register an 
MCAsmStreamer directly?
I may have missed something; some help is appriciated.

Thanks in advance,

Ed.




More information about the llvm-dev mailing list