[all-commits] [llvm/llvm-project] 32a826: -dot-machine-cfg for printing MachineFunction to a...

Christudasan Devadasan via All-commits all-commits at lists.llvm.org
Thu Sep 22 00:20:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 32a8260ccc8bc87134df6417c6deb0f4172bc4bf
      https://github.com/llvm/llvm-project/commit/32a8260ccc8bc87134df6417c6deb0f4172bc4bf
  Author: Christudasan Devadasan <Christudasan.Devadasan at amd.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/CFGPrinter.h
    A llvm/include/llvm/CodeGen/MachineCFGPrinter.h
    M llvm/include/llvm/CodeGen/MachinePassRegistry.def
    M llvm/include/llvm/CodeGen/Passes.h
    M llvm/include/llvm/InitializePasses.h
    M llvm/lib/CodeGen/CMakeLists.txt
    M llvm/lib/CodeGen/CodeGen.cpp
    A llvm/lib/CodeGen/MachineCFGPrinter.cpp
    A llvm/test/Analysis/DotMachineCFG/AMDGPU/functions.mir
    A llvm/test/Analysis/DotMachineCFG/AMDGPU/irreducible.mir
    A llvm/test/Analysis/DotMachineCFG/AMDGPU/lit.local.cfg

  Log Message:
  -----------
  -dot-machine-cfg for printing MachineFunction to a dot file

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.

Patch by Yashwant Singh <Yashwant.Singh at amd.com> (yassingh)

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D133709




More information about the All-commits mailing list