[LLVMdev] Extending AsmPrinter
David Greene
dag at cray.com
Tue Aug 14 17:38:52 PDT 2007
On Monday 13 August 2007 15:50, Chris Lattner wrote:
> > 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. :)
Ok, I'll see what I can do. :)
> > 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 :)
Right. I've figured out where I need to make the changes in AsmWriterEmitter
given the current design.
I'm trying out a few interesting things here based on custom streambufs.
It requires some surgery to AsmPrinters as a std::ostream won't work
anymore due to the enhanced functionality of the custom streambufs.
Is this still interesting to the larger LLVM community? One thing I have
to do is figure out how to handle asm dumps to cerr.
-Dave
More information about the llvm-dev
mailing list