Add dominator info printer pass.

llvm-svn: 52829
This commit is contained in:
Devang Patel 2008-06-27 16:43:21 +00:00
parent eb63554d81
commit d5faa747e9

View File

@ -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);