aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 06:03:38 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 06:03:38 +0000
commit45cfe545ec8177262dabc70580ce05feaa1c3880 (patch)
treed7e42a138f6f8b54e1a831aff3c73c653ee77784 /lib/Analysis
parentcb3e3d30054edfc7481bf323b315da4edc63bc44 (diff)
Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/CFGPrinter.cpp11
-rw-r--r--lib/Analysis/IPA/Andersens.cpp2
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp40
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp8
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp11
-rw-r--r--lib/Analysis/InstCount.cpp2
-rw-r--r--lib/Analysis/Interval.cpp3
-rw-r--r--lib/Analysis/IntervalPartition.cpp2
-rw-r--r--lib/Analysis/LoopInfo.cpp5
-rw-r--r--lib/Analysis/LoopVR.cpp3
-rw-r--r--lib/Analysis/PostDominators.cpp5
-rw-r--r--lib/Analysis/ScalarEvolution.cpp4
12 files changed, 35 insertions, 61 deletions
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp
index 2364d984f9..f6ecfc596f 100644
--- a/lib/Analysis/CFGPrinter.cpp
+++ b/lib/Analysis/CFGPrinter.cpp
@@ -26,9 +26,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Config/config.h"
-#include <iosfwd>
-#include <sstream>
-#include <fstream>
using namespace llvm;
namespace llvm {
@@ -96,7 +93,7 @@ namespace {
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -118,7 +115,7 @@ namespace {
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -150,7 +147,7 @@ namespace {
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -179,7 +176,7 @@ namespace {
cerr << "\n";
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 02b4c9ac6f..966e87c4cb 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -607,7 +607,7 @@ namespace {
//===------------------------------------------------------------------===//
// Implement Analyize interface
//
- void print(std::ostream &O, const Module* M) const {
+ void print(raw_ostream &O, const Module*) const {
PrintPointsToGraph();
}
};
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index 4d15a48d4e..f03e4b2ba2 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -18,8 +18,7 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Streams.h"
-#include <ostream>
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
@@ -68,30 +67,21 @@ public:
AU.setPreservesAll();
}
- void print(std::ostream *o, const Module *M) const {
- if (o) print(*o, M);
- }
-
- virtual void print(std::ostream &o, const Module *M) const {
- o << "CallGraph Root is: ";
+ virtual void print(raw_ostream &OS, const Module *) const {
+ OS << "CallGraph Root is: ";
if (Function *F = getRoot()->getFunction())
- o << F->getNameStr() << "\n";
- else
- o << "<<null function: 0x" << getRoot() << ">>\n";
+ OS << F->getName() << "\n";
+ else {
+ OS << "<<null function: 0x" << getRoot() << ">>\n";
+ }
- CallGraph::print(o, M);
+ CallGraph::print(OS, 0);
}
virtual void releaseMemory() {
destroy();
}
- /// dump - Print out this call graph.
- ///
- inline void dump() const {
- print(cerr, Mod);
- }
-
CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; }
CallGraphNode* getCallsExternalNode() const { return CallsExternalNode; }
@@ -187,15 +177,11 @@ void CallGraph::destroy() {
}
}
-void CallGraph::print(std::ostream &OS, const Module *M) const {
+void CallGraph::print(raw_ostream &OS, Module*) const {
for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I)
I->second->print(OS);
}
-void CallGraph::dump() const {
- print(cerr, 0);
-}
-
//===----------------------------------------------------------------------===//
// Implementations of public modification methods
//
@@ -242,21 +228,21 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
return CGN = new CallGraphNode(const_cast<Function*>(F));
}
-void CallGraphNode::print(std::ostream &OS) const {
+void CallGraphNode::print(raw_ostream &OS) const {
if (Function *F = getFunction())
- OS << "Call graph node for function: '" << F->getNameStr() <<"'\n";
+ OS << "Call graph node for function: '" << F->getName() <<"'\n";
else
OS << "Call graph node <<null function: 0x" << this << ">>:\n";
for (const_iterator I = begin(), E = end(); I != E; ++I)
if (Function *FI = I->second->getFunction())
- OS << " Calls function '" << FI->getNameStr() <<"'\n";
+ OS << " Calls function '" << FI->getName() <<"'\n";
else
OS << " Calls external node\n";
OS << "\n";
}
-void CallGraphNode::dump() const { print(cerr); }
+void CallGraphNode::dump() const { print(errs()); }
/// removeCallEdgeFor - This method removes the edge in the node for the
/// specified call site. Note that this method takes linear time, so it
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index df2f0f8bd6..00eddc4de8 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -20,6 +20,7 @@
#include "llvm/ADT/SCCIterator.h"
#include "llvm/PassManagers.h"
#include "llvm/Function.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -56,7 +57,7 @@ public:
// Print passes managed by this manager
void dumpPassStructure(unsigned Offset) {
- llvm::cerr << std::string(Offset*2, ' ') << "Call Graph SCC Pass Manager\n";
+ errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
P->dumpPassStructure(Offset + 1);
@@ -65,9 +66,8 @@ public:
}
Pass *getContainedPass(unsigned N) {
- assert ( N < PassVector.size() && "Pass number out of range!");
- Pass *FP = static_cast<Pass *>(PassVector[N]);
- return FP;
+ assert(N < PassVector.size() && "Pass number out of range!");
+ return static_cast<Pass *>(PassVector[N]);
}
virtual PassManagerType getPassManagerType() const {
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index 920ee37455..c4fb0b9a4e 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -92,13 +92,12 @@ bool FindUsedTypes::runOnModule(Module &m) {
// passed in, then the types are printed symbolically if possible, using the
// symbol table from the module.
//
-void FindUsedTypes::print(std::ostream &OS, const Module *M) const {
- raw_os_ostream RO(OS);
- RO << "Types in use by this module:\n";
+void FindUsedTypes::print(raw_ostream &OS, const Module *M) const {
+ OS << "Types in use by this module:\n";
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
E = UsedTypes.end(); I != E; ++I) {
- RO << " ";
- WriteTypeSymbolic(RO, *I, M);
- RO << '\n';
+ OS << " ";
+ WriteTypeSymbolic(OS, *I, M);
+ OS << '\n';
}
}
diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp
index b0db671724..83724caf52 100644
--- a/lib/Analysis/InstCount.cpp
+++ b/lib/Analysis/InstCount.cpp
@@ -59,7 +59,7 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
- virtual void print(std::ostream &O, const Module *M) const {}
+ virtual void print(raw_ostream &O, const Module *M) const {}
};
}
diff --git a/lib/Analysis/Interval.cpp b/lib/Analysis/Interval.cpp
index 6a6b1b2048..ca9cdcaf24 100644
--- a/lib/Analysis/Interval.cpp
+++ b/lib/Analysis/Interval.cpp
@@ -37,8 +37,7 @@ bool Interval::isLoop() const {
}
-void Interval::print(std::ostream &O) const {
- raw_os_ostream OS(O);
+void Interval::print(raw_ostream &OS) const {
OS << "-------------------------------------------------------------\n"
<< "Interval Contents:\n";
diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp
index cb8a85da55..1f17b77a5b 100644
--- a/lib/Analysis/IntervalPartition.cpp
+++ b/lib/Analysis/IntervalPartition.cpp
@@ -32,7 +32,7 @@ void IntervalPartition::releaseMemory() {
RootInterval = 0;
}
-void IntervalPartition::print(std::ostream &O, const Module*) const {
+void IntervalPartition::print(raw_ostream &O, const Module*) const {
for(unsigned i = 0, e = Intervals.size(); i != e; ++i)
Intervals[i]->print(O);
}
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 75d89af2a5..5939dea4c0 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -309,8 +309,7 @@ void LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominatorTree>();
}
-void LoopInfo::print(std::ostream &OS, const Module*) const {
- raw_os_ostream OSS(OS);
- LI.print(OSS);
+void LoopInfo::print(raw_ostream &OS, const Module*) const {
+ LI.print(OS);
}
diff --git a/lib/Analysis/LoopVR.cpp b/lib/Analysis/LoopVR.cpp
index bae02015c6..573bd3ea01 100644
--- a/lib/Analysis/LoopVR.cpp
+++ b/lib/Analysis/LoopVR.cpp
@@ -228,8 +228,7 @@ void LoopVR::getAnalysisUsage(AnalysisUsage &AU) const {
bool LoopVR::runOnFunction(Function &F) { Map.clear(); return false; }
-void LoopVR::print(std::ostream &os, const Module *) const {
- raw_os_ostream OS(os);
+void LoopVR::print(raw_ostream &OS, const Module *) const {
for (std::map<Value *, ConstantRange *>::const_iterator I = Map.begin(),
E = Map.end(); I != E; ++I) {
OS << *I->first << ": " << *I->second << '\n';
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 69522e8a39..69d6b47bbe 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -41,9 +41,8 @@ PostDominatorTree::~PostDominatorTree() {
delete DT;
}
-void PostDominatorTree::print(std::ostream &OS, const Module *) const {
- raw_os_ostream OSS(OS);
- DT->print(OSS);
+void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
+ DT->print(OS);
}
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index d2c3f58e9c..d5849b0e1d 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -5193,7 +5193,3 @@ void ScalarEvolution::print(raw_ostream &OS, const Module* ) const {
PrintLoopInfo(OS, &SE, *I);
}
-void ScalarEvolution::print(std::ostream &o, const Module *M) const {
- raw_os_ostream OS(o);
- print(OS, M);
-}