Support for machine function cfg dot dump

Xinliang David Li xinliangli at gmail.com
Tue Jun 18 16:03:28 PDT 2013


Ping..  The attached is an example cfg dump from llc.

David

On Wed, Jun 12, 2013 at 4:51 PM, Xinliang David Li <xinliangli at gmail.com> wrote:
> Just attached.
>
> thanks,
>
> David
>
> On Wed, Jun 12, 2013 at 4:51 PM, Chandler Carruth <chandlerc at google.com> wrote:
>> Missing patch?
>>
>>
>> On Wed, Jun 12, 2013 at 4:47 PM, Xinliang David Li <xinliangli at gmail.com>
>> wrote:
>>>
>>> (this patch has been sitting in my computer collecting dust for a
>>> couple of months now, send it out before I forget about it).
>>>
>>>
>>> Currently only 'opt' driver supports CFG dump. The existing command line
>>> is :
>>>
>>> opt -<pass_arg> -dot-cfg ....
>>>
>>> The pass scheduler will inject the dot-cfg pass after <pass_arg> pass.
>>>
>>> However, this is not supported for neither 'clang' nor 'llc' driver.
>>>
>>> In fact, there is *no* support for Machine CFG dump at all.
>>>
>>> The following patch added the support to dump .dot CFG file for each
>>> function before/after each pass -- just like IR dump.
>>>
>>> The syntax is :
>>>
>>>     <driver> -dot-cfg-after=<pass-arg> ...
>>>     <driver> -dot-cfg-before=<pass-arg> ...
>>>
>>> The cfg printer is also enhanced to allow the pass name and order
>>> string to be included in the name.
>>>
>>> For instance,
>>>
>>>      opt -dot-cfg-after=gvn t.b ...  # t.b defines 'foo'
>>>
>>> It will create file cfg.foo.after.gvn.dot
>>>
>>> The new option is now unified across three drivers:
>>>
>>>     opt -O2 -dot-cfg-after=gvn t.bc -o to.bc
>>>     llc  -dot-cfg-before=machine-cp t.bc -o t.o
>>>     clang -mllvm -dot-cfg-before=...   [1]
>>>
>>>
>>> Brief descriptions of the changes:
>>>
>>> 1) The CFGPrinter code is templatized and refactored -- the main
>>> implementation is moved into CFGPrinterBase<..>
>>> 2) CFG and CFGOnly dumps are now unified into the same template class
>>> 3) For Function class, CFGPrinterT used -- which is derived from
>>> CFGPrinterBase
>>> 4) For MachineFunction, MachineCFGPrinterT is derived from CFGPrinterBase
>>> 5) To avoid creating dependency backwards from core to analysis, the
>>> cfgprinter is moved to Support, sitting in core.
>>>
>>>
>>> [1]. This currently does not work because Clang driver has a bug that
>>> it does not register driver scheduled pass names properly.  THis also
>>> blocks option -print-before|after from working with clang driver.  I
>>> have another patch for it.
>>>
>>>
>>> LLVM builds fine and regression test is ok.
>>>
>>> If the patch looks ok and useful, can someone help check this in?
>>>
>>> thanks,
>>>
>>> David
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfg._Z3fooP1Ai.after.prologepilog.dot
Type: application/octet-stream
Size: 2846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130618/61a9195a/attachment.obj>


More information about the llvm-commits mailing list