[PATCH] D133709: -dot-machine-cfg for printing MachineFunction to a dot file

Yashwant Singh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 10:07:19 PDT 2022


yassingh created this revision.
Herald added subscribers: kosarev, kerbowa, hiraditya, mgorny, jvesely.
Herald added a project: All.
yassingh requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This pass allows a user to dump a MIR function to a dot file 
and view it as a graph. It is targeted to provide a similar 
functionality as -dot-cfg pass on LLVM-IR. As of now the pass 
also support below flags:
-dot-mcfg-only [optional][won't print instructions in the 
graph just block name]
-mcfg-dot-filename-prefix [optional][prefix to add to output dot file]
-mcfg-func-name [optional] [specify function name or it's 
substring, handy if mir file contains multiple functions and 
you need to see graph of just one]

More flags and details can be introduced as per the requirements 
in future. This pass is inspired from -dot-cfg IR pass and APIs 
are written in almost identical format. More tests are to be 
added and would appreciate inputs on tests too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133709

Files:
  llvm/include/llvm/CodeGen/MachineCFGPrinter.h
  llvm/include/llvm/CodeGen/MachinePassRegistry.def
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/InitializePasses.h
  llvm/lib/CodeGen/CMakeLists.txt
  llvm/lib/CodeGen/CodeGen.cpp
  llvm/lib/CodeGen/MachineCFGPrinter.cpp
  llvm/test/Analysis/DotMachineCFG/AMDGPU/irreducible.mir
  llvm/test/Analysis/DotMachineCFG/AMDGPU/lit.local.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133709.459501.patch
Type: text/x-patch
Size: 17678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220912/46624fca/attachment.bin>


More information about the llvm-commits mailing list