[LLVMdev] [PATCH] Before/After IR Dumps
Chris Lattner
clattner at apple.com
Thu Mar 4 16:48:39 PST 2010
On Mar 4, 2010, at 7:28 AM, David Greene wrote:
> 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'd expect the pass manager to manage all of this. To get the appropriate printer for a pass, it would invoke a virtual method on the pass itself, e.g.:
P->getPrinterPass();
which would return a ModulePrinter, FunctionPrinter, MachineFunctionPrinter etc depending on the pass.
-Chris
More information about the llvm-dev
mailing list