diff options
author | Devang Patel <dpatel@apple.com> | 2008-06-30 17:32:58 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-06-30 17:32:58 +0000 |
commit | 81ea3bb55cf9582b2bf6d039a9c819ba15c5d78e (patch) | |
tree | df962486f3d82bb31bf45b2d1f2b2e8d9d9d1d71 /llvm/tools/opt/GraphPrinters.cpp | |
parent | a0e071c861d11d1b890e00cfd3d5a2905714f492 (diff) | |
download | bcm5719-llvm-81ea3bb55cf9582b2bf6d039a9c819ba15c5d78e.tar.gz bcm5719-llvm-81ea3bb55cf9582b2bf6d039a9c819ba15c5d78e.zip |
Move dominator info printer into tool/opt/GraphPrinters.cpp
llvm-svn: 52907
Diffstat (limited to 'llvm/tools/opt/GraphPrinters.cpp')
-rw-r--r-- | llvm/tools/opt/GraphPrinters.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/tools/opt/GraphPrinters.cpp b/llvm/tools/opt/GraphPrinters.cpp index 867e3348087..7f1199a1e3d 100644 --- a/llvm/tools/opt/GraphPrinters.cpp +++ b/llvm/tools/opt/GraphPrinters.cpp @@ -18,6 +18,7 @@ #include "llvm/Pass.h" #include "llvm/Value.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/Analysis/Dominators.h" #include <iostream> #include <fstream> using namespace llvm; @@ -81,3 +82,34 @@ namespace { RegisterPass<CallGraphPrinter> P2("print-callgraph", "Print Call Graph to 'dot' file"); } + +//===----------------------------------------------------------------------===// +// DomInfoPrinter Pass +//===----------------------------------------------------------------------===// + +namespace { + class 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); +} |