aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-02 05:46:47 +0000
committerChris Lattner <sabre@nondot.org>2001-07-02 05:46:47 +0000
commit347bfdad7f23c7ec4b9e4ca8d4012a83ce5c417e (patch)
tree2fb4322dcec7526c155e2a13bc3a3b92d410e63c /lib/Analysis
parent1715229db9c04e73ba8acb8579eb2b9465209785 (diff)
downloadexternal_llvm-347bfdad7f23c7ec4b9e4ca8d4012a83ce5c417e.zip
external_llvm-347bfdad7f23c7ec4b9e4ca8d4012a83ce5c417e.tar.gz
external_llvm-347bfdad7f23c7ec4b9e4ca8d4012a83ce5c417e.tar.bz2
Add printing code for dominator info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/Writer.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/Analysis/Writer.cpp b/lib/Analysis/Writer.cpp
index 48e8b5a..d837c2c 100644
--- a/lib/Analysis/Writer.cpp
+++ b/lib/Analysis/Writer.cpp
@@ -26,3 +26,43 @@ void cfg::WriteToOutput(const Interval *I, ostream &o) {
copy(I->Successors.begin(), I->Successors.end(),
ostream_iterator<BasicBlock*>(o, "\n"));
}
+
+#include "llvm/Analysis/Dominators.h"
+
+ostream &operator<<(ostream &o, const set<const BasicBlock*> &BBs) {
+ copy(BBs.begin(), BBs.end(), ostream_iterator<const BasicBlock*>(o, "\n"));
+ return o;
+}
+
+void cfg::WriteToOutput(const DominatorSet &DS, ostream &o) {
+ for (DominatorSet::const_iterator I = DS.begin(), E = DS.end(); I != E; ++I) {
+ o << "=============================--------------------------------\n"
+ << "\nDominator Set For Basic Block\n" << I->first
+ << "-------------------------------\n" << I->second << endl;
+ }
+}
+
+
+void cfg::WriteToOutput(const ImmediateDominators &ID, ostream &o) {
+ for (ImmediateDominators::const_iterator I = ID.begin(), E = ID.end();
+ I != E; ++I) {
+ o << "=============================--------------------------------\n"
+ << "\nImmediate Dominator For Basic Block\n" << I->first
+ << "is: \n" << I->second << endl;
+ }
+}
+
+
+void cfg::WriteToOutput(const DominatorTree &DT, ostream &o) {
+
+}
+
+void cfg::WriteToOutput(const DominanceFrontier &DF, ostream &o) {
+ for (DominanceFrontier::const_iterator I = DF.begin(), E = DF.end();
+ I != E; ++I) {
+ o << "=============================--------------------------------\n"
+ << "\nDominance Frontier For Basic Block\n" << I->first
+ << "is: \n" << I->second << endl;
+ }
+}
+