| Chris Lattner | da95680 | 2001-06-21 05:27:22 +0000 | [diff] [blame] | 1 | //===-- IntervalWriter.cpp - Library for printing Intervals ------*- C++ -*--=// | 
|  | 2 | // | 
|  | 3 | // This library implements the interval printing functionality defined in | 
|  | 4 | // llvm/Assembly/Writer.h | 
|  | 5 | // | 
|  | 6 | //===----------------------------------------------------------------------===// | 
|  | 7 |  | 
|  | 8 | #include "llvm/Assembly/Writer.h" | 
| Chris Lattner | c9f39b2 | 2001-06-24 04:05:45 +0000 | [diff] [blame] | 9 | #include "llvm/Analysis/Interval.h" | 
| Chris Lattner | da95680 | 2001-06-21 05:27:22 +0000 | [diff] [blame] | 10 | #include <iterator> | 
|  | 11 | #include <algorithm> | 
|  | 12 |  | 
|  | 13 | void cfg::WriteToOutput(const Interval *I, ostream &o) { | 
|  | 14 | o << "-------------------------------------------------------------\n" | 
|  | 15 | << "Interval Contents:\n"; | 
|  | 16 |  | 
|  | 17 | // Print out all of the basic blocks in the interval... | 
|  | 18 | copy(I->Nodes.begin(), I->Nodes.end(), | 
|  | 19 | ostream_iterator<BasicBlock*>(o, "\n")); | 
|  | 20 |  | 
|  | 21 | o << "Interval Predecessors:\n"; | 
|  | 22 | copy(I->Predecessors.begin(), I->Predecessors.end(), | 
|  | 23 | ostream_iterator<BasicBlock*>(o, "\n")); | 
|  | 24 |  | 
|  | 25 | o << "Interval Successors:\n"; | 
|  | 26 | copy(I->Successors.begin(), I->Successors.end(), | 
|  | 27 | ostream_iterator<BasicBlock*>(o, "\n")); | 
|  | 28 | } | 
| Chris Lattner | 347bfda | 2001-07-02 05:46:47 +0000 | [diff] [blame] | 29 |  | 
|  | 30 | #include "llvm/Analysis/Dominators.h" | 
|  | 31 |  | 
|  | 32 | ostream &operator<<(ostream &o, const set<const BasicBlock*> &BBs) { | 
|  | 33 | copy(BBs.begin(), BBs.end(), ostream_iterator<const BasicBlock*>(o, "\n")); | 
|  | 34 | return o; | 
|  | 35 | } | 
|  | 36 |  | 
|  | 37 | void cfg::WriteToOutput(const DominatorSet &DS, ostream &o) { | 
|  | 38 | for (DominatorSet::const_iterator I = DS.begin(), E = DS.end(); I != E; ++I) { | 
|  | 39 | o << "=============================--------------------------------\n" | 
|  | 40 | << "\nDominator Set For Basic Block\n" << I->first | 
|  | 41 | << "-------------------------------\n" << I->second << endl; | 
|  | 42 | } | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 |  | 
|  | 46 | void cfg::WriteToOutput(const ImmediateDominators &ID, ostream &o) { | 
|  | 47 | for (ImmediateDominators::const_iterator I = ID.begin(), E = ID.end(); | 
|  | 48 | I != E; ++I) { | 
|  | 49 | o << "=============================--------------------------------\n" | 
|  | 50 | << "\nImmediate Dominator For Basic Block\n" << I->first | 
|  | 51 | << "is: \n" << I->second << endl; | 
|  | 52 | } | 
|  | 53 | } | 
|  | 54 |  | 
|  | 55 |  | 
|  | 56 | void cfg::WriteToOutput(const DominatorTree &DT, ostream &o) { | 
|  | 57 |  | 
|  | 58 | } | 
|  | 59 |  | 
|  | 60 | void cfg::WriteToOutput(const DominanceFrontier &DF, ostream &o) { | 
|  | 61 | for (DominanceFrontier::const_iterator I = DF.begin(), E = DF.end(); | 
|  | 62 | I != E; ++I) { | 
|  | 63 | o << "=============================--------------------------------\n" | 
|  | 64 | << "\nDominance Frontier For Basic Block\n" << I->first | 
|  | 65 | << "is: \n" << I->second << endl; | 
|  | 66 | } | 
|  | 67 | } | 
|  | 68 |  |