blob: f271966d104f4525895808e3ee0bfc37e5d414dc [file] [log] [blame]
Chris Lattnerac859db2002-10-07 18:38:01 +00001//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
Misha Brukman3da94ae2005-04-22 00:00:37 +00002//
John Criswell7c0e0222003-10-20 17:47:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner21c62da2007-12-29 20:44:31 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman3da94ae2005-04-22 00:00:37 +00007//
John Criswell7c0e0222003-10-20 17:47:21 +00008//===----------------------------------------------------------------------===//
Chris Lattnerac859db2002-10-07 18:38:01 +00009//
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
Chris Lattner51fbec92011-04-05 21:43:56 +000017#include "llvm/Analysis/Dominators.h"
Chandler Carruthf010c462012-12-04 10:44:52 +000018#include "llvm/Pass.h"
Andrew Tricka125cac2013-01-11 17:28:14 +000019
Chris Lattner27829ec2004-04-12 05:38:01 +000020using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000021
Devang Patel687e03b2008-06-30 17:32:58 +000022//===----------------------------------------------------------------------===//
23// DomInfoPrinter Pass
24//===----------------------------------------------------------------------===//
25
26namespace {
27 class DomInfoPrinter : public FunctionPass {
28 public:
29 static char ID; // Pass identification, replacement for typeid
Owen Anderson90c579d2010-08-06 18:33:48 +000030 DomInfoPrinter() : FunctionPass(ID) {}
Devang Patel687e03b2008-06-30 17:32:58 +000031
32 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
33 AU.setPreservesAll();
34 AU.addRequired<DominatorTree>();
Devang Patel687e03b2008-06-30 17:32:58 +000035
36 }
37
38 virtual bool runOnFunction(Function &F) {
Chris Lattner9fc5cdf2011-01-02 22:09:33 +000039 getAnalysis<DominatorTree>().dump();
Devang Patel687e03b2008-06-30 17:32:58 +000040 return false;
41 }
42 };
Devang Patel687e03b2008-06-30 17:32:58 +000043}
Dan Gohmana2a3bbc2010-08-20 00:56:16 +000044
45char DomInfoPrinter::ID = 0;
46static RegisterPass<DomInfoPrinter>
47DIP("print-dom-info", "Dominator Info Printer", true, true);