2009-06-02 17:52:33 +00:00
|
|
|
//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// 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-11-24 09:08:18 +00:00
|
|
|
#include "llvm/IR/Dominators.h"
|
2013-04-08 18:41:23 +00:00
|
|
|
#include "llvm/Pass.h"
|
2009-06-02 17:52:33 +00:00
|
|
|
|
2013-04-08 18:41:23 +00:00
|
|
|
using namespace llvm;
|
2010-09-17 15:48:55 +00:00
|
|
|
|
2009-06-02 17:52:33 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// DomInfoPrinter Pass
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class DomInfoPrinter : public FunctionPass {
|
|
|
|
public:
|
|
|
|
static char ID; // Pass identification, replacement for typeid
|
2010-09-17 15:48:55 +00:00
|
|
|
DomInfoPrinter() : FunctionPass(ID) {}
|
2009-06-02 17:52:33 +00:00
|
|
|
|
2014-11-24 09:08:18 +00:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
2009-06-02 17:52:33 +00:00
|
|
|
AU.setPreservesAll();
|
2014-11-24 09:08:18 +00:00
|
|
|
AU.addRequired<DominatorTreeWrapperPass>();
|
2009-06-02 17:52:33 +00:00
|
|
|
}
|
|
|
|
|
2014-11-24 09:08:18 +00:00
|
|
|
bool runOnFunction(Function &F) override {
|
2017-04-16 16:01:22 +00:00
|
|
|
getAnalysis<DominatorTreeWrapperPass>().print(dbgs());
|
2009-06-02 17:52:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2010-09-17 15:48:55 +00:00
|
|
|
|
|
|
|
char DomInfoPrinter::ID = 0;
|
|
|
|
static RegisterPass<DomInfoPrinter>
|
|
|
|
DIP("print-dom-info", "Dominator Info Printer", true, true);
|