1 //===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines several printers for various different types of graphs used
10 // by the LLVM infrastructure. It uses the generic graph interface to convert
11 // the graph into a .dot graph. These graphs can then be processed with the
12 // "dot" tool to convert them to postscript or some other suitable format.
14 //===----------------------------------------------------------------------===//
16 #include "llvm/IR/Dominators.h"
17 #include "llvm/Pass.h"
21 //===----------------------------------------------------------------------===//
22 // DomInfoPrinter Pass
23 //===----------------------------------------------------------------------===//
26 class DomInfoPrinter
: public FunctionPass
{
28 static char ID
; // Pass identification, replacement for typeid
29 DomInfoPrinter() : FunctionPass(ID
) {}
31 void getAnalysisUsage(AnalysisUsage
&AU
) const override
{
33 AU
.addRequired
<DominatorTreeWrapperPass
>();
36 bool runOnFunction(Function
&F
) override
{
37 getAnalysis
<DominatorTreeWrapperPass
>().print(dbgs());
43 char DomInfoPrinter::ID
= 0;
44 static RegisterPass
<DomInfoPrinter
>
45 DIP("print-dom-info", "Dominator Info Printer", true, true);