<div dir="ltr">Missing patch?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 12, 2013 at 4:47 PM, Xinliang David Li <span dir="ltr"><<a href="mailto:xinliangli@gmail.com" target="_blank">xinliangli@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(this patch has been sitting in my computer collecting dust for a<br>
couple of months now, send it out before I forget about it).<br>
<br>
<br>
Currently only 'opt' driver supports CFG dump. The existing command line is :<br>
<br>
opt -<pass_arg> -dot-cfg ....<br>
<br>
The pass scheduler will inject the dot-cfg pass after <pass_arg> pass.<br>
<br>
However, this is not supported for neither 'clang' nor 'llc' driver.<br>
<br>
In fact, there is *no* support for Machine CFG dump at all.<br>
<br>
The following patch added the support to dump .dot CFG file for each<br>
function before/after each pass -- just like IR dump.<br>
<br>
The syntax is :<br>
<br>
    <driver> -dot-cfg-after=<pass-arg> ...<br>
    <driver> -dot-cfg-before=<pass-arg> ...<br>
<br>
The cfg printer is also enhanced to allow the pass name and order<br>
string to be included in the name.<br>
<br>
For instance,<br>
<br>
     opt -dot-cfg-after=gvn t.b ...  # t.b defines 'foo'<br>
<br>
It will create file cfg.foo.after.gvn.dot<br>
<br>
The new option is now unified across three drivers:<br>
<br>
    opt -O2 -dot-cfg-after=gvn t.bc -o to.bc<br>
    llc  -dot-cfg-before=machine-cp t.bc -o t.o<br>
    clang -mllvm -dot-cfg-before=...   [1]<br>
<br>
<br>
Brief descriptions of the changes:<br>
<br>
1) The CFGPrinter code is templatized and refactored -- the main<br>
implementation is moved into CFGPrinterBase<..><br>
2) CFG and CFGOnly dumps are now unified into the same template class<br>
3) For Function class, CFGPrinterT used -- which is derived from CFGPrinterBase<br>
4) For MachineFunction, MachineCFGPrinterT is derived from CFGPrinterBase<br>
5) To avoid creating dependency backwards from core to analysis, the<br>
cfgprinter is moved to Support, sitting in core.<br>
<br>
<br>
[1]. This currently does not work because Clang driver has a bug that<br>
it does not register driver scheduled pass names properly.  THis also<br>
blocks option -print-before|after from working with clang driver.  I<br>
have another patch for it.<br>
<br>
<br>
LLVM builds fine and regression test is ok.<br>
<br>
If the patch looks ok and useful, can someone help check this in?<br>
<br>
thanks,<br>
<br>
David<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>