1 //===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
15 //===----------------------------------------------------------------------===//
17 #include "llvm/Analysis/Dominators.h"
18 #include "llvm/Pass.h"
22 //===----------------------------------------------------------------------===//
23 // DomInfoPrinter Pass
24 //===----------------------------------------------------------------------===//
27 class DomInfoPrinter : public FunctionPass {
29 static char ID; // Pass identification, replacement for typeid
30 DomInfoPrinter() : FunctionPass(ID) {}
32 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
34 AU.addRequired<DominatorTree>();
38 virtual bool runOnFunction(Function &F) {
39 getAnalysis<DominatorTree>().dump();
45 char DomInfoPrinter::ID = 0;
46 static RegisterPass<DomInfoPrinter>
47 DIP("print-dom-info", "Dominator Info Printer", true, true);