[LLVMdev] Extending AsmPrinter

Chris Lattner sabre at nondot.org
Mon Aug 13 13:50:45 PDT 2007


On Fri, 10 Aug 2007, David Greene wrote:
> I'm looking at extending AsmPrinter to pretty-print comments after
> instructions (I'm adding the necessary fields to MachineInstr to do this).

ok

> I also have a few questions on the general design of AsmPrinter.  Why is
> runOnMachineFunction implemented for each target AsmPrinter?  I would

Historical reasons that aren't very good.  Over the years, I've taken 
several stabs at merging the asmprinters from various targets together. 
They used to be completely separate with no common base class for example. 
Any progress to merging them further would be great. :)

> have expected this to live in the base AsmPrinter class with calls out to
> specialized helper functions (Template Method pattern).  If things were
> designed this way, it would be trivial to do what I want:

Yes, this is one advantage, another is that we wouldn't have to fix the 
same bug in multiple places :)

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list