aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2006-12-17 05:15:13 +0000
committerBill Wendling <isanbard@gmail.com>2006-12-17 05:15:13 +0000
commit5c7e326585f3a543388ba871c3425f7664cd9143 (patch)
tree85de3d1ef8b725fb5db8a5e36c5d312da657cab6
parent89b0d995d26d9e70b9c8d7fab8b99f1e89ac11bb (diff)
Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32636 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/BitSetVector.h15
-rw-r--r--include/llvm/Analysis/AliasSetTracker.h16
-rw-r--r--include/llvm/Analysis/CallGraph.h8
-rw-r--r--include/llvm/Analysis/Dominators.h15
-rw-r--r--include/llvm/Analysis/FindUsedTypes.h1
-rw-r--r--include/llvm/Analysis/Interval.h1
-rw-r--r--include/llvm/Analysis/IntervalPartition.h3
-rw-r--r--include/llvm/Analysis/LoopInfo.h13
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h18
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h7
-rw-r--r--include/llvm/Analysis/Trace.h3
-rw-r--r--include/llvm/Argument.h3
-rw-r--r--include/llvm/BasicBlock.h1
-rw-r--r--include/llvm/CodeGen/LinkAllCodegenComponents.h1
-rw-r--r--include/llvm/CodeGen/LiveInterval.h16
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h3
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h8
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h13
-rw-r--r--include/llvm/CodeGen/MachineFunction.h1
-rw-r--r--include/llvm/CodeGen/MachineInstr.h14
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h1
-rw-r--r--include/llvm/CodeGen/SchedGraphCommon.h17
-rw-r--r--include/llvm/Constant.h1
-rw-r--r--include/llvm/Function.h1
-rw-r--r--include/llvm/GlobalVariable.h1
-rw-r--r--include/llvm/InlineAsm.h1
-rw-r--r--include/llvm/Instruction.h1
-rw-r--r--include/llvm/Module.h10
-rw-r--r--include/llvm/Pass.h4
-rw-r--r--include/llvm/Support/ConstantRange.h4
-rw-r--r--include/llvm/Support/Debug.h4
-rw-r--r--include/llvm/Support/Streams.h9
-rw-r--r--include/llvm/Target/SubtargetFeature.h1
-rw-r--r--include/llvm/Type.h4
-rw-r--r--include/llvm/Value.h4
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp4
-rw-r--r--lib/Analysis/Trace.cpp5
-rw-r--r--lib/Bytecode/Writer/Writer.cpp2
-rw-r--r--lib/CodeGen/DwarfWriter.cpp16
-rw-r--r--lib/CodeGen/LiveInterval.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp24
-rw-r--r--lib/CodeGen/VirtRegMap.cpp8
-rw-r--r--lib/CodeGen/VirtRegMap.h6
-rw-r--r--lib/Support/Debug.cpp4
-rw-r--r--lib/Support/Streams.cpp2
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp7
46 files changed, 138 insertions, 165 deletions
diff --git a/include/llvm/ADT/BitSetVector.h b/include/llvm/ADT/BitSetVector.h
index 5d1fc86c3a..21d3cc9e7b 100644
--- a/include/llvm/ADT/BitSetVector.h
+++ b/include/llvm/ADT/BitSetVector.h
@@ -27,7 +27,6 @@
#include "llvm/Support/Streams.h"
#include <bitset>
-#include <vector>
#include <functional>
namespace llvm {
@@ -173,10 +172,8 @@ public:
///
/// Printing and debugging support
///
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
- }
void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
void dump() const { print(cerr); }
public:
@@ -247,24 +244,18 @@ public:
};
-inline void BitSetVector::print(std::ostream& O) const
+inline void BitSetVector::print(llvm_ostream& O) const
{
for (std::vector<bitword>::const_iterator
I=bitsetVec.begin(), E=bitsetVec.end(); I != E; ++I)
O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", ");
}
-inline OStream& operator<< (OStream& O, const BitSetVector& bset) {
- bset.print(O);
- return O;
-}
-inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset)
-{
+inline std::ostream& operator<<(std::ostream& O, const BitSetVector& bset) {
bset.print(O);
return O;
}
-
///
/// Optimized versions of fundamental comparison operations
///
diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h
index 5fcda16270..cd6450fac8 100644
--- a/include/llvm/Analysis/AliasSetTracker.h
+++ b/include/llvm/Analysis/AliasSetTracker.h
@@ -156,10 +156,8 @@ public:
iterator end() const { return iterator(); }
bool empty() const { return PtrList == 0; }
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
/// Define an iterator for alias sets... this is just a forward iterator.
@@ -248,10 +246,6 @@ private:
bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
};
-inline OStream& operator<<(OStream &OS, const AliasSet &AS) {
- AS.print(OS);
- return OS;
-}
inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) {
AS.print(OS);
return OS;
@@ -361,10 +355,8 @@ public:
iterator begin() { return AliasSets.begin(); }
iterator end() { return AliasSets.end(); }
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
private:
@@ -390,10 +382,6 @@ private:
AliasSet *findAliasSetForCallSite(CallSite CS);
};
-inline OStream& operator<<(OStream &OS, const AliasSetTracker &AST) {
- AST.print(OS);
- return OS;
-}
inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) {
AST.print(OS);
return OS;
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 1f737da53c..24effd8d49 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -152,10 +152,8 @@ public:
///
void initialize(Module &M);
- void print(OStream &o, const Module *M) const {
- if (o.stream()) print(*o.stream(), M);
- }
virtual void print(std::ostream &o, const Module *M) const;
+ void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
void dump() const;
// stub - dummy function, just ignore it
@@ -201,10 +199,8 @@ public:
/// dump - Print out this call graph node.
///
void dump() const;
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
//===---------------------------------------------------------------------
// Methods to keep a call graph up to date with a function that has been
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 939300f8ac..f29ed8345d 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -144,6 +144,9 @@ 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);
+ }
};
//===-------------------------------------
@@ -234,6 +237,9 @@ 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);
+ }
/// dominates - Return true if A dominates B. This performs the special
/// checks necessary if A and B are in the same basic block.
@@ -410,6 +416,9 @@ 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);
+ }
};
//===-------------------------------------
@@ -546,6 +555,9 @@ 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);
+ }
protected:
/// getNode - return the (Post)DominatorTree node for the specified basic
/// block. This is the same as using operator[] on this class.
@@ -635,6 +647,9 @@ 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);
+ }
};
diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h
index fbf41de7cb..008e30c93e 100644
--- a/include/llvm/Analysis/FindUsedTypes.h
+++ b/include/llvm/Analysis/FindUsedTypes.h
@@ -34,6 +34,7 @@ public:
/// symbol table from the module.
///
void print(std::ostream &o, const Module *M) const;
+ void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
private:
/// IncorporateType - Incorporate one type and all of its subtypes into the
diff --git a/include/llvm/Analysis/Interval.h b/include/llvm/Analysis/Interval.h
index b9e1d31e3a..bed815a665 100644
--- a/include/llvm/Analysis/Interval.h
+++ b/include/llvm/Analysis/Interval.h
@@ -99,6 +99,7 @@ public:
/// print - Show contents in human readable format...
void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
};
/// succ_begin/succ_end - define methods so that Intervals may be used
diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h
index 1cc903cae1..bd998e81de 100644
--- a/include/llvm/Analysis/IntervalPartition.h
+++ b/include/llvm/Analysis/IntervalPartition.h
@@ -61,6 +61,9 @@ public:
// print - Show contents in human readable format...
virtual void print(std::ostream &O, const Module* = 0) const;
+ void print(std::ostream *O, const Module* M = 0) const {
+ if (O) print(*O, M);
+ }
// getRootInterval() - Return the root interval that contains the starting
// block of the function.
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 238a0f627d..62f19e3c29 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -217,10 +217,10 @@ public:
/// the mapping in the LoopInfo class.
void removeBlockFromLoop(BasicBlock *BB);
- void print(OStream &O, unsigned Depth = 0) const {
- if (O.stream()) print(*O.stream(), Depth);
- }
void print(std::ostream &O, unsigned Depth = 0) const;
+ void print(std::ostream *O, unsigned Depth = 0) const {
+ if (O) print(*O, Depth);
+ }
void dump() const;
private:
friend class LoopInfo;
@@ -283,10 +283,11 @@ public:
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
- void print(OStream &O, const Module* = 0) const {
- if (O.stream()) print(*O.stream());
- }
+
void print(std::ostream &O, const Module* = 0) const;
+ void print(std::ostream *O, const Module* M = 0) const {
+ if (O) print(*O, M);
+ }
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index 4eb0bb33b2..4aac284ee0 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -97,20 +97,14 @@ namespace llvm {
/// print - Print out the internal representation of this scalar to the
/// specified stream. This should really only be used for debugging
/// purposes.
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
virtual void print(std::ostream &OS) const = 0;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// dump - This method is used for debugging.
///
void dump() const;
};
- inline OStream &operator<<(OStream &OS, const SCEV &S) {
- S.print(OS);
- return OS;
- }
inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) {
S.print(OS);
return OS;
@@ -128,10 +122,8 @@ namespace llvm {
virtual bool isLoopInvariant(const Loop *L) const;
virtual const Type *getType() const;
virtual bool hasComputableLoopEvolution(const Loop *L) const;
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
virtual SCEVHandle
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const;
@@ -242,10 +234,10 @@ namespace llvm {
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
- void print(OStream &OS, const Module* = 0) const {
- if (OS.stream()) print(*OS.stream());
- }
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);
+ }
};
}
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index ba1b6d4fec..c261dfc8e5 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -62,6 +62,7 @@ namespace llvm {
}
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVConstant *S) { return true; }
@@ -108,6 +109,7 @@ namespace llvm {
virtual ConstantRange getValueRange() const;
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVTruncateExpr *S) { return true; }
@@ -154,6 +156,7 @@ namespace llvm {
}
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVZeroExtendExpr *S) { return true; }
@@ -218,6 +221,7 @@ namespace llvm {
virtual const Type *getType() const { return getOperand(0)->getType(); }
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVCommutativeExpr *S) { return true; }
@@ -332,6 +336,7 @@ namespace llvm {
virtual const Type *getType() const;
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVSDivExpr *S) { return true; }
@@ -428,6 +433,7 @@ namespace llvm {
const SCEVHandle &Conc) const;
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVAddRecExpr *S) { return true; }
@@ -472,6 +478,7 @@ namespace llvm {
virtual const Type *getType() const;
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVUnknown *S) { return true; }
diff --git a/include/llvm/Analysis/Trace.h b/include/llvm/Analysis/Trace.h
index b26101d15c..65aa593c8d 100644
--- a/include/llvm/Analysis/Trace.h
+++ b/include/llvm/Analysis/Trace.h
@@ -106,7 +106,8 @@ public:
/// print - Write trace to output stream.
///
- void print (OStream &O) const;
+ void print (std::ostream &O) const;
+ void print (std::ostream *O) const { if (O) print(*O); }
/// dump - Debugger convenience method; writes trace to standard error
/// output stream.
diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h
index 1751c21ce2..1d92066ce5 100644
--- a/include/llvm/Argument.h
+++ b/include/llvm/Argument.h
@@ -53,6 +53,9 @@ public:
const Argument *getPrev() const { return Prev; }
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const {
+ if (OS) print(*OS);
+ }
/// classof - Methods for support type inquiry through isa, cast, and
/// dyn_cast:
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index f15d2b46a9..0ca8eae1a3 100644
--- a/include/llvm/BasicBlock.h
+++ b/include/llvm/BasicBlock.h
@@ -152,6 +152,7 @@ public:
InstListType &getInstList() { return InstList; }
virtual void print(std::ostream &OS) const { print(OS, 0); }
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
diff --git a/include/llvm/CodeGen/LinkAllCodegenComponents.h b/include/llvm/CodeGen/LinkAllCodegenComponents.h
index 5c39b505fe..1cf75bf01f 100644
--- a/include/llvm/CodeGen/LinkAllCodegenComponents.h
+++ b/include/llvm/CodeGen/LinkAllCodegenComponents.h
@@ -31,6 +31,7 @@ namespace {
(void) llvm::createSimpleRegisterAllocator();
(void) llvm::createLocalRegisterAllocator();
(void) llvm::createLinearScanRegisterAllocator();
+ (void) llvm::createGraphColoringRegisterAllocator();
(void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL);
(void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL);
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index b22922c84c..367cefeb36 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -57,16 +57,13 @@ namespace llvm {
void dump() const;
void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
private:
LiveRange(); // DO NOT IMPLEMENT
};
std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
- inline OStream& operator<<(OStream& os, const LiveRange &LR) {
- if (os.stream()) LR.print(*os.stream());
- return os;
- }
inline bool operator<(unsigned V, const LiveRange &LR) {
@@ -260,9 +257,9 @@ namespace llvm {
return beginNumber() < other.beginNumber();
}
- void print(OStream OS, const MRegisterInfo *MRI = 0) const;
- void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const {
- print(OStream(OS), MRI);
+ void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const;
+ void print(std::ostream *OS, const MRegisterInfo *MRI = 0) const {
+ if (OS) print(*OS, MRI);
}
void dump() const;
@@ -273,11 +270,6 @@ namespace llvm {
LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
};
- inline OStream &operator<<(OStream &OS, const LiveInterval &LI) {
- LI.print(OS);
- return OS;
- }
-
inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
LI.print(OS);
return OS;
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 11f836b99a..e0f60452e3 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -161,6 +161,9 @@ namespace llvm {
/// print - Implement the dump method.
virtual void print(std::ostream &O, const Module* = 0) const;
+ void print(std::ostream *O, const Module* M = 0) const {
+ if (O) print(*O, M);
+ }
private:
/// RemoveMachineInstrFromMaps - This marks the specified machine instr as
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 896d9efe03..1fd36ed55a 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -189,10 +189,8 @@ public:
// Debugging methods.
void dump() const;
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// getNumber - MachineBasicBlocks are uniquely numbered at the function
/// level, unless they're not in a MachineFunction yet, in which case this
@@ -226,10 +224,6 @@ private: // Methods used to maintain doubly linked list of blocks...
};
std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB);
-inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) {
- if (OS.stream()) MBB.print(*OS.stream());
- return OS;
-}
//===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index bc701f6b86..ffd0e55663 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -49,17 +49,10 @@ public:
/// print - Implement operator<<...
///
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
- }
virtual void print(std::ostream &O) const = 0;
+ void print(std::ostream *O) const { if (O) print(*O); }
};
-inline OStream &operator<<(OStream &OS,
- const MachineConstantPoolValue &V) {
- V.print(OS);
- return OS;
-}
inline std::ostream &operator<<(std::ostream &OS,
const MachineConstantPoolValue &V) {
V.print(OS);
@@ -143,10 +136,8 @@ public:
/// print - Used by the MachineFunction printer to print information about
/// constant pool objects. Implemented in MachineFunction.cpp
///
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// dump - Call print(std::cerr) to be called from the debugger.
///
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index f264c91c11..c393b07aaf 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -238,6 +238,7 @@ public:
/// to the specified stream.
///
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// viewCFG - This function is meant for use from the debugger. You can just
/// say 'call F->viewCFG()' and a ghostview window should pop up from the
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 77de83768e..ad2ccdf8ca 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -78,6 +78,7 @@ private:
MachineOperand() {}
void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
public:
MachineOperand(const MachineOperand &M) {
@@ -288,10 +289,6 @@ public:
IsDead = false;
}
- friend OStream& operator<<(OStream& os, const MachineOperand& mop) {
- if (os.stream()) mop.print(*os.stream());
- return os;
- }
friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop) {
mop.print(os);
return os;
@@ -403,16 +400,13 @@ public:
//
// Debugging support
//
- void print(OStream &OS, const TargetMachine *TM) const {
- if (OS.stream()) print(*OS.stream(), TM);
+ void print(std::ostream *OS, const TargetMachine *TM) const {
+ if (OS) print(*OS, TM);
}
void print(std::ostream &OS, const TargetMachine *TM) const;
void