diff options
author | Devang Patel <dpatel@apple.com> | 2008-06-27 16:43:21 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-06-27 16:43:21 +0000 |
commit | abc6e6ab9f594eff2af738e767182bf5c2f7aa43 (patch) | |
tree | 867d38610baae7b275dd79593792f89162778778 /llvm/lib/VMCore/Dominators.cpp | |
parent | c1e80a759f0c2c9bdb6f5dbcbddbd1adfc439aa3 (diff) | |
download | bcm5719-llvm-abc6e6ab9f594eff2af738e767182bf5c2f7aa43.tar.gz bcm5719-llvm-abc6e6ab9f594eff2af738e767182bf5c2f7aa43.zip |
Add dominator info printer pass.
llvm-svn: 52829
Diffstat (limited to 'llvm/lib/VMCore/Dominators.cpp')
-rw-r--r-- | llvm/lib/VMCore/Dominators.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Dominators.cpp b/llvm/lib/VMCore/Dominators.cpp index e9eca4eee4a..452b59d2181 100644 --- a/llvm/lib/VMCore/Dominators.cpp +++ b/llvm/lib/VMCore/Dominators.cpp @@ -286,3 +286,34 @@ void DominanceFrontierBase::print(std::ostream &o, const Module* ) const { void DominanceFrontierBase::dump() { print (llvm::cerr); } + +//===----------------------------------------------------------------------===// +// DomInfoPrinter Pass +//===----------------------------------------------------------------------===// + +namespace { + class VISIBILITY_HIDDEN DomInfoPrinter : public FunctionPass { + public: + static char ID; // Pass identification, replacement for typeid + DomInfoPrinter() : FunctionPass((intptr_t)&ID) {} + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired<DominatorTree>(); + AU.addRequired<DominanceFrontier>(); + + } + + virtual bool runOnFunction(Function &F) { + DominatorTree &DT = getAnalysis<DominatorTree>(); + DT.dump(); + DominanceFrontier &DF = getAnalysis<DominanceFrontier>(); + DF.dump(); + return false; + } + }; +} + +char DomInfoPrinter::ID = 0; +static RegisterPass<DomInfoPrinter> +DIP("print-dom-info", "Dominator Info Printer", true, true); |