]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
1 | //===- GraphPrinters.cpp - DOT printers for various graph types -----------===// |
2 | // | |
3 | // The LLVM Compiler Infrastructure | |
4 | // | |
5 | // This file is distributed under the University of Illinois Open Source | |
6 | // License. See LICENSE.TXT for details. | |
7 | // | |
8 | //===----------------------------------------------------------------------===// | |
9 | // | |
10 | // This file defines several printers for various different types of graphs used | |
11 | // by the LLVM infrastructure. It uses the generic graph interface to convert | |
12 | // the graph into a .dot graph. These graphs can then be processed with the | |
13 | // "dot" tool to convert them to postscript or some other suitable format. | |
14 | // | |
15 | //===----------------------------------------------------------------------===// | |
16 | ||
1a4d82fc | 17 | #include "llvm/IR/Dominators.h" |
970d7e83 | 18 | #include "llvm/Pass.h" |
223e47cc | 19 | |
970d7e83 | 20 | using namespace llvm; |
223e47cc LB |
21 | |
22 | //===----------------------------------------------------------------------===// | |
23 | // DomInfoPrinter Pass | |
24 | //===----------------------------------------------------------------------===// | |
25 | ||
26 | namespace { | |
27 | class DomInfoPrinter : public FunctionPass { | |
28 | public: | |
29 | static char ID; // Pass identification, replacement for typeid | |
30 | DomInfoPrinter() : FunctionPass(ID) {} | |
31 | ||
1a4d82fc | 32 | void getAnalysisUsage(AnalysisUsage &AU) const override { |
223e47cc | 33 | AU.setPreservesAll(); |
1a4d82fc | 34 | AU.addRequired<DominatorTreeWrapperPass>(); |
223e47cc LB |
35 | } |
36 | ||
1a4d82fc JJ |
37 | bool runOnFunction(Function &F) override { |
38 | getAnalysis<DominatorTreeWrapperPass>().dump(); | |
223e47cc LB |
39 | return false; |
40 | } | |
41 | }; | |
42 | } | |
43 | ||
44 | char DomInfoPrinter::ID = 0; | |
45 | static RegisterPass<DomInfoPrinter> | |
46 | DIP("print-dom-info", "Dominator Info Printer", true, true); |