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