2002-10-07 20:38:01 +02:00
|
|
|
//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 19:47:21 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:44:31 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 19:47:21 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-07 20:38:01 +02:00
|
|
|
//
|
|
|
|
// This file defines several printers for various different types of graphs used
|
|
|
|
// by the LLVM infrastructure. It uses the generic graph interface to convert
|
|
|
|
// the graph into a .dot graph. These graphs can then be processed with the
|
|
|
|
// "dot" tool to convert them to postscript or some other suitable format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-04-05 23:43:56 +02:00
|
|
|
#include "llvm/Analysis/Dominators.h"
|
2012-12-04 11:44:52 +01:00
|
|
|
#include "llvm/Pass.h"
|
2005-04-22 02:00:37 +02:00
|
|
|
|
2013-01-11 18:28:14 +01:00
|
|
|
using namespace llvm;
|
2010-08-20 02:56:16 +02:00
|
|
|
|
2008-06-30 19:32:58 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// DomInfoPrinter Pass
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class DomInfoPrinter : public FunctionPass {
|
|
|
|
public:
|
|
|
|
static char ID; // Pass identification, replacement for typeid
|
2010-08-06 20:33:48 +02:00
|
|
|
DomInfoPrinter() : FunctionPass(ID) {}
|
2008-06-30 19:32:58 +02:00
|
|
|
|
|
|
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
|
|
|
AU.setPreservesAll();
|
|
|
|
AU.addRequired<DominatorTree>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool runOnFunction(Function &F) {
|
2011-01-02 23:09:33 +01:00
|
|
|
getAnalysis<DominatorTree>().dump();
|
2008-06-30 19:32:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2010-08-20 02:56:16 +02:00
|
|
|
|
|
|
|
char DomInfoPrinter::ID = 0;
|
|
|
|
static RegisterPass<DomInfoPrinter>
|
|
|
|
DIP("print-dom-info", "Dominator Info Printer", true, true);
|