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 | 97f51a3024a72ef8500e95b90e6361e6783160fd (patch) | |
tree | 4fab9417a9dc40dd475d7503281ef4e1c3a545d9 /lib/Analysis/DataStructure/Printer.cpp | |
parent | 9a740fdf2165e263da98480d9c24f1803f94ef0c (diff) |
* 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Printer.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index 4a58c69afd..03ce297c4a 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/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"); } |