diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-07-27 01:12:15 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-07-27 01:12:15 +0000 |
| commit | 96a0dfa33e8469ef18866d1d89708af18929e38e (patch) | |
| tree | d5a653ca0e77dbb4285ac095171397badafe1214 /llvm/lib/Analysis/DataStructure/Printer.cpp | |
| parent | 5768f01926dd07c0a863fa03035224e14d9b4508 (diff) | |
| download | bcm5719-llvm-96a0dfa33e8469ef18866d1d89708af18929e38e.tar.gz bcm5719-llvm-96a0dfa33e8469ef18866d1d89708af18929e38e.zip | |
* Standardize how analysis results/passes as printed with the print() virtual
methods
* Eliminate AnalysisID: Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
the analyses themselves.
llvm-svn: 3115
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Printer.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DataStructure/Printer.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Printer.cpp b/llvm/lib/Analysis/DataStructure/Printer.cpp index 4a58c69afd3..03ce297c4a9 100644 --- a/llvm/lib/Analysis/DataStructure/Printer.cpp +++ b/llvm/lib/Analysis/DataStructure/Printer.cpp @@ -147,16 +147,21 @@ void DSGraph::print(std::ostream &O) const { } template <typename Collection> -static void printCollection(const Collection &C, std::ostream &O, Module *M, - const string &Prefix) { - for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) +static void printCollection(const Collection &C, std::ostream &O, + const Module *M, const string &Prefix) { + if (M == 0) { + O << "Null Module pointer, cannot continue!\n"; + return; + } + + for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) if (!I->isExternal()) { string Filename = Prefix + "." + I->getName() + ".dot"; O << "Writing '" << Filename << "'..."; std::ofstream F(Filename.c_str()); if (F.good()) { - DSGraph &Graph = C.getDSGraph(*I); + DSGraph &Graph = C.getDSGraph((Function&)*I); Graph.print(F); O << " [" << Graph.getGraphSize() << "+" << Graph.getFunctionCalls().size() << "]\n"; @@ -168,10 +173,10 @@ static void printCollection(const Collection &C, std::ostream &O, Module *M, // print - Print out the analysis results... -void LocalDataStructures::print(std::ostream &O, Module *M) const { +void LocalDataStructures::print(std::ostream &O, const Module *M) const { printCollection(*this, O, M, "ds"); } -void BUDataStructures::print(std::ostream &O, Module *M) const { +void BUDataStructures::print(std::ostream &O, const Module *M) const { printCollection(*this, O, M, "bu"); } |

