aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 05:17:37 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 05:17:37 +0000
commit791102fb1192ac9483274e54cbc42480c9b1af10 (patch)
tree4729b1da9b9c946fb83bc177dd3d00bffcf85390 /include
parent79c5d3f9717756dc3ff56cfcaa3ae1a5930c457a (diff)
downloadexternal_llvm-791102fb1192ac9483274e54cbc42480c9b1af10.zip
external_llvm-791102fb1192ac9483274e54cbc42480c9b1af10.tar.gz
external_llvm-791102fb1192ac9483274e54cbc42480c9b1af10.tar.bz2
eliminate the std::ostream form of WriteAsOperand and update clients.
This also updates dominator related stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79825 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/AliasSetTracker.h10
-rw-r--r--include/llvm/Analysis/Dominators.h27
-rw-r--r--include/llvm/Analysis/LoopInfo.h18
-rw-r--r--include/llvm/Analysis/PostDominators.h4
-rw-r--r--include/llvm/Assembly/Writer.h3
-rw-r--r--include/llvm/CodeGen/MachineDominators.h6
6 files changed, 20 insertions, 48 deletions
diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h
index 1fb4c8f..82c6f39 100644
--- a/include/llvm/Analysis/AliasSetTracker.h
+++ b/include/llvm/Analysis/AliasSetTracker.h
@@ -155,8 +155,7 @@ public:
iterator end() const { return iterator(); }
bool empty() const { return PtrList == 0; }
- void print(std::ostream &OS) const;
- void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(raw_ostream &OS) const;
void dump() const;
/// Define an iterator for alias sets... this is just a forward iterator.
@@ -245,7 +244,7 @@ private:
bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
};
-inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) {
+inline raw_ostream& operator<<(raw_ostream &OS, const AliasSet &AS) {
AS.print(OS);
return OS;
}
@@ -374,8 +373,7 @@ public:
iterator begin() { return AliasSets.begin(); }
iterator end() { return AliasSets.end(); }
- void print(std::ostream &OS) const;
- void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(raw_ostream &OS) const;
void dump() const;
private:
@@ -403,7 +401,7 @@ private:
AliasSet *findAliasSetForCallSite(CallSite CS);
};
-inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) {
+inline raw_ostream& operator<<(raw_ostream &OS, const AliasSetTracker &AST) {
AST.print(OS);
return OS;
}
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 366d492..094fecf 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -32,6 +32,7 @@
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <map>
#include <set>
@@ -161,8 +162,8 @@ EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<BasicBlock>);
EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
template<class NodeT>
-static std::ostream &operator<<(std::ostream &o,
- const DomTreeNodeBase<NodeT> *Node) {
+static raw_ostream &operator<<(raw_ostream &o,
+ const DomTreeNodeBase<NodeT> *Node) {
if (Node->getBlock())
WriteAsOperand(o, Node->getBlock(), false);
else
@@ -174,9 +175,9 @@ static std::ostream &operator<<(std::ostream &o,
}
template<class NodeT>
-static void PrintDomTree(const DomTreeNodeBase<NodeT> *N, std::ostream &o,
+static void PrintDomTree(const DomTreeNodeBase<NodeT> *N, raw_ostream &o,
unsigned Lev) {
- o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N;
+ o.indent(2*Lev) << "[" << Lev << "] " << N;
for (typename DomTreeNodeBase<NodeT>::const_iterator I = N->begin(),
E = N->end(); I != E; ++I)
PrintDomTree<NodeT>(*I, o, Lev+1);
@@ -534,7 +535,7 @@ public:
/// print - Convert to human readable form
///
- virtual void print(std::ostream &o, const Module* ) const {
+ void print(raw_ostream &o) const {
o << "=============================--------------------------------\n";
if (this->isPostDominator())
o << "Inorder PostDominator Tree: ";
@@ -547,14 +548,6 @@ public:
PrintDomTree<NodeT>(getRootNode(), o, 1);
}
- void print(std::ostream *OS, const Module* M = 0) const {
- if (OS) print(*OS, M);
- }
-
- virtual void dump() {
- print(llvm::cerr);
- }
-
protected:
template<class GraphT>
friend void Compress(DominatorTreeBase<typename GraphT::NodeType>& DT,
@@ -837,9 +830,7 @@ public:
DT->releaseMemory();
}
- virtual void print(std::ostream &OS, const Module* M= 0) const {
- DT->print(OS, M);
- }
+ virtual void print(std::ostream &OS, const Module* M= 0) const;
};
//===-------------------------------------
@@ -988,10 +979,6 @@ public:
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS, const Module* = 0) const;
- void print(std::ostream *OS, const Module* M = 0) const {
- if (OS) print(*OS, M);
- }
- virtual void dump();
};
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index fb20406..5435226 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -454,8 +454,8 @@ public:
#endif
}
- void print(std::ostream &OS, unsigned Depth = 0) const {
- OS << std::string(Depth*2, ' ') << "Loop at depth " << getLoopDepth()
+ void print(raw_ostream &OS, unsigned Depth = 0) const {
+ OS.indent(Depth*2) << "Loop at depth " << getLoopDepth()
<< " containing: ";
for (unsigned i = 0; i < getBlocks().size(); ++i) {
@@ -472,12 +472,8 @@ public:
(*I)->print(OS, Depth+2);
}
- void print(std::ostream *O, unsigned Depth = 0) const {
- if (O) print(*O, Depth);
- }
-
void dump() const {
- print(cerr);
+ print(errs());
}
protected:
@@ -878,7 +874,7 @@ public:
// Debugging
- void print(std::ostream &OS, const Module* ) const {
+ void print(raw_ostream &OS) const {
for (unsigned i = 0; i < TopLevelLoops.size(); ++i)
TopLevelLoops[i]->print(OS);
#if 0
@@ -942,10 +938,8 @@ public:
virtual void releaseMemory() { LI.releaseMemory(); }
- virtual void print(std::ostream &O, const Module* M = 0) const {
- LI.print(O, M);
- }
-
+ virtual void print(std::ostream &O, const Module* M = 0) const;
+
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
/// removeLoop - This removes the specified top-level loop from this loop info
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index cd6af74..ff579e3 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -57,9 +57,7 @@ struct PostDominatorTree : public FunctionPass {
return DT->properlyDominates(A, B);
}
- virtual void print(std::ostream &OS, const Module* M= 0) const {
- DT->print(OS, M);
- }
+ virtual void print(std::ostream &OS, const Module*) const;
};
FunctionPass* createPostDomTree();
diff --git a/include/llvm/Assembly/Writer.h b/include/llvm/Assembly/Writer.h
index 5e5fe15..c5b2390 100644
--- a/include/llvm/Assembly/Writer.h
+++ b/include/llvm/Assembly/Writer.h
@@ -17,7 +17,6 @@
#ifndef LLVM_ASSEMBLY_WRITER_H
#define LLVM_ASSEMBLY_WRITER_H
-#include <iosfwd>
#include <string>
namespace llvm {
@@ -71,8 +70,6 @@ void WriteTypeSymbolic(raw_ostream &, const Type *, const Module *M);
// then even constants get pretty-printed; for example, the type of a null
// pointer is printed symbolically.
//
-void WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true,
- const Module *Context = 0);
void WriteAsOperand(raw_ostream &, const Value *, bool PrintTy = true,
const Module *Context = 0);
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h
index 7b3d5f7..1439b1b 100644
--- a/include/llvm/CodeGen/MachineDominators.h
+++ b/include/llvm/CodeGen/MachineDominators.h
@@ -23,7 +23,7 @@
namespace llvm {
-inline void WriteAsOperand(std::ostream &, const MachineBasicBlock*, bool t) { }
+inline void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t) { }
template<>
inline void DominatorTreeBase<MachineBasicBlock>::addRoot(MachineBasicBlock* MBB) {
@@ -162,9 +162,7 @@ public:
virtual void releaseMemory();
- virtual void print(std::ostream &OS, const Module* M= 0) const {
- DT->print(OS, M);
- }
+ virtual void print(std::ostream &OS, const Module*) const;
};
//===-------------------------------------