[LLVMdev] Creating a new MCStreamer object inside AsmPrinter

Ronaldo Ferreira ronaldorferreira at gmail.com
Fri Oct 10 16:48:51 PDT 2014

Just in case someone else needs it, the solution is here:
MCAsmStreamer::EmitInstruction. Just had to add this:
InstPrinter->printInst(&Inst, errs(), "");

2014-10-08 1:12 GMT+02:00 Ronaldo Ferreira <ronaldorferreira at gmail.com>:

> Hi,
> I would like to create a new MCStreamer object inside the AsmPrinter
> class, which will be used in the AsmPrinter::EmitFunctionBody() method.
> This new MCStreamer object has to use the dbgs() raw_stream instead of the
> default Out stream as created in the LLVMTargetMachine::addPassesToEmitFile
> method.
> In that method, there's a call to the default
> OutStreamer.EmitInstruction(&MI) method. In my code, I need to call this
> method for my new MCStreamer object.
> In summary, I want to print the asm instruction created by the
> EmitInstruction method to the dbgs() stream.
> All the objects I need (at least I think) to create my new MCStreamer
> object are the running instances for the Target of the MCInstPrinter,
> MCAsmBackend and MCCodeEmitter classes. How can I retrieve these objects
> inside the AsmPrinter class?
> Thanks,
> Ronaldo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141011/ab019d4c/attachment.html>

More information about the llvm-dev mailing list