[LLVMdev] [PATCH] Before/After IR Dumps
David Greene
dag at cray.com
Thu Mar 4 07:28:22 PST 2010
On Thursday 04 March 2010 01:54:55 Chris Lattner wrote:
> On Mar 2, 2010, at 1:45 PM, David Greene wrote:
> > This set of patches adds support for dumping IR before or after specified
> > Passes. It adds the following command-line options:
> >
> > -print-before=<pass-option>
> > -print-after=<pass-option>
> > -print-before-all
> > -print-after-all
>
> This patch looks very invasive for such a simple thing, isn't there a
> better way?
Possibly. What specifically do you object to? The main problem is that
one needs different printers at different stages of the compiler:
ModulePrinter, FunctionPrinter and MachineFunctionPrinter. It makes
sense to write the code once and parameterize it on the printer type.
I see addPass<> as the most "invasive" in the sense that the patch
changes almost every call of PM.addPass(..) to addPass<>(PM, ...).
That's a consequence of code sharing.
I wanted a command-line interface that is intuitive. This requires that
passes show up in the print option as a result of registering them with
the PassManager.
I could get rid of the "Previous" parameter to addPass<> if we don't mind
duplicate output in the case where we want something printed after
Pass A and before Pass B when Pass B immediately follows Pass A.
I'm happy to revisit design decisions if you let me know what you want to
see changed.
> Also, please please please stay in 80 columns.
Ah, thought I had fixed all of that. I will do another scan.
-Dave
More information about the llvm-dev
mailing list