I'm writing a backend using a mid-October svn snapshot of LLVM. I'm having a hard time figuring out the relationship between my XXXAsmPrinter and MCAsmStreamer. Can someone explain what each is responsible for? Looking at the existing targets, the XXXAsmPrinter implementations seem to implement both the legacy "create a .s file" behavior, using printInstruction/printOperand/etc as well as the newer "lower to MCInst" behavior (EmitInstruction). Is this just a remnant of the v2.x -> v3.x transition? AFAICT, the MCAsmStreamer should be the interface to create the .s file going forward. Is that true? If true, how does it fit into registering the asmprinter as a pass? That is, if the AsmPrinter pass is used to lower to MCInst in the XXXAsmPrinter, then what? What's the target registration for MCInst -> .s file? Thanks, Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111108/dd928bbe/attachment.html>
On Nov 8, 2011, at 4:23 PM, Joe Matarazzo wrote:> I'm writing a backend using a mid-October svn snapshot of LLVM. I'm having a hard time figuring out the relationship between my XXXAsmPrinter and MCAsmStreamer. Can someone explain what each is responsible for? Looking at the existing targets, the XXXAsmPrinter implementations seem to implement both the legacy "create a .s file" behavior, using printInstruction/printOperand/etc as well as the newer "lower to MCInst" behavior (EmitInstruction). Is this just a remnant of the v2.x -> v3.x transition? >The old MachineInstr based AsmPrinter routines are legacy cruft. Not everything has been moved over to the new way of doing things yet.> AFAICT, the MCAsmStreamer should be the interface to create the .s file going forward. Is that true? If true, how does it fit into registering the asmprinter as a pass? That is, if the AsmPrinter pass is used to lower to MCInst in the XXXAsmPrinter, then what? What's the target registration for MCInst -> .s file? >Yes, MCAsmStreamer is the correct path. You shouldn't need to do anything special to register it. Just the usual LLVMInitializeXXXAsmPrinter() hook. See the ARM or X86 target for examples. -Jim
Seemingly Similar Threads
- Using BuildMI to insert Intel MPX instruction BNDCU failed
- [LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
- Is there a reason why MCAsmStreamer class doesn't have its own .h file?
- [LLVMdev] 2 versions of printInstruction()
- Convert MachineInstr to MCInst in AsmPrinter.cpp