2002-10-07 20:38:01 +02:00
|
|
|
//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-01-13 10:26:24 +01:00
|
|
|
#include "llvm/IR/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
|
|
|
|
2014-03-08 09:27:28 +01:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
2008-06-30 19:32:58 +02:00
|
|
|
AU.setPreservesAll();
|
2014-01-13 14:07:17 +01:00
|
|
|
AU.addRequired<DominatorTreeWrapperPass>();
|
2008-06-30 19:32:58 +02:00
|
|
|
}
|
|
|
|
|
2014-03-08 09:27:28 +01:00
|
|
|
bool runOnFunction(Function &F) override {
|
2017-01-28 03:02:38 +01:00
|
|
|
getAnalysis<DominatorTreeWrapperPass>().print(dbgs());
|
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);
|