blob: 640edfee41dec002ec300b688154ad70cc7e3073 [file] [log] [blame]
Chris Lattner91264832002-10-07 18:38:01 +00001//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
Misha Brukman650ba8e2005-04-22 00:00:37 +00002//
John Criswell09344dc2003-10-20 17:47:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner345353d2007-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 Brukman650ba8e2005-04-22 00:00:37 +00007//
John Criswell09344dc2003-10-20 17:47:21 +00008//===----------------------------------------------------------------------===//
Chris Lattner91264832002-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
Chandler Carruth5ad5f152014-01-13 09:26:24 +000017#include "llvm/IR/Dominators.h"
Chandler Carruth4d88a1c2012-12-04 10:44:52 +000018#include "llvm/Pass.h"
Andrew Trick962318f62013-01-11 17:28:14 +000019
Chris Lattner0a752642004-04-12 05:38:01 +000020using namespace llvm;
Brian Gaeke960707c2003-11-11 22:41:34 +000021
Devang Patel81ea3bb2008-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 Andersona7aed182010-08-06 18:33:48 +000030 DomInfoPrinter() : FunctionPass(ID) {}
Devang Patel81ea3bb2008-06-30 17:32:58 +000031
Craig Toppere56917c2014-03-08 08:27:28 +000032 void getAnalysisUsage(AnalysisUsage &AU) const override {
Devang Patel81ea3bb2008-06-30 17:32:58 +000033 AU.setPreservesAll();
Chandler Carruth73523022014-01-13 13:07:17 +000034 AU.addRequired<DominatorTreeWrapperPass>();
Devang Patel81ea3bb2008-06-30 17:32:58 +000035 }
36
Craig Toppere56917c2014-03-08 08:27:28 +000037 bool runOnFunction(Function &F) override {
Chandler Carruth73523022014-01-13 13:07:17 +000038 getAnalysis<DominatorTreeWrapperPass>().dump();
Devang Patel81ea3bb2008-06-30 17:32:58 +000039 return false;
40 }
41 };
Devang Patel81ea3bb2008-06-30 17:32:58 +000042}
Dan Gohman12bb5052010-08-20 00:56:16 +000043
44char DomInfoPrinter::ID = 0;
45static RegisterPass<DomInfoPrinter>
46DIP("print-dom-info", "Dominator Info Printer", true, true);