Ronaldo Ferreira
2014-Oct-07 23:12 UTC
[LLVMdev] Creating a new MCStreamer object inside AsmPrinter
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/20141008/0143036f/attachment.html>
Ronaldo Ferreira
2014-Oct-10 23:48 UTC
[LLVMdev] Creating a new MCStreamer object inside AsmPrinter
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>