2002-10-07 18:38:01 +00:00
|
|
|
//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
|
2005-04-22 00:00:37 +00:00
|
|
|
//
|
2003-10-20 17:47:21 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:44:31 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 00:00:37 +00:00
|
|
|
//
|
2003-10-20 17:47:21 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-07 18:38:01 +00: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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-01-13 09:26:24 +00:00
|
|
|
#include "llvm/IR/Dominators.h"
|
2012-12-04 10:44:52 +00:00
|
|
|
#include "llvm/Pass.h"
|
2005-04-22 00:00:37 +00:00
|
|
|
|
2013-01-11 17:28:14 +00:00
|
|
|
using namespace llvm;
|
2010-08-20 00:56:16 +00:00
|
|
|
|
2008-06-30 17:32:58 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// DomInfoPrinter Pass
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class DomInfoPrinter : public FunctionPass {
|
|
|
|
public:
|
|
|
|
static char ID; // Pass identification, replacement for typeid
|
2010-08-06 18:33:48 +00:00
|
|
|
DomInfoPrinter() : FunctionPass(ID) {}
|
2008-06-30 17:32:58 +00:00
|
|
|
|
2014-03-08 08:27:28 +00:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
2008-06-30 17:32:58 +00:00
|
|
|
AU.setPreservesAll();
|
2014-01-13 13:07:17 +00:00
|
|
|
AU.addRequired<DominatorTreeWrapperPass>();
|
2008-06-30 17:32:58 +00:00
|
|
|
}
|
|
|
|
|
2014-03-08 08:27:28 +00:00
|
|
|
bool runOnFunction(Function &F) override {
|
2014-01-13 13:07:17 +00:00
|
|
|
getAnalysis<DominatorTreeWrapperPass>().dump();
|
2008-06-30 17:32:58 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2010-08-20 00:56:16 +00:00
|
|
|
|
|
|
|
char DomInfoPrinter::ID = 0;
|
|
|
|
static RegisterPass<DomInfoPrinter>
|
|
|
|
DIP("print-dom-info", "Dominator Info Printer", true, true);
|