diff options
author | Bill Wendling <isanbard@gmail.com> | 2006-11-28 22:21:29 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2006-11-28 22:21:29 +0000 |
commit | b5ebf15b2b2ce8989caf1a1114b05d80b0f9bd48 (patch) | |
tree | d3bcb286a90fa4c2b441167133b09cf44c1a7f04 /include/llvm | |
parent | d4d9ab80b7b23c2f73192319e5582fb6802f5f18 (diff) | |
download | external_llvm-b5ebf15b2b2ce8989caf1a1114b05d80b0f9bd48.zip external_llvm-b5ebf15b2b2ce8989caf1a1114b05d80b0f9bd48.tar.gz external_llvm-b5ebf15b2b2ce8989caf1a1114b05d80b0f9bd48.tar.bz2 |
Added a temporary hack to get the llvm-streams to work for future checkins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ADT/BitSetVector.h | 8 | ||||
-rw-r--r-- | include/llvm/Analysis/AliasSetTracker.h | 15 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 14 | ||||
-rw-r--r-- | include/llvm/Bytecode/Analyzer.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/LiveInterval.h | 8 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineBasicBlock.h | 9 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineConstantPool.h | 12 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 12 | ||||
-rw-r--r-- | include/llvm/CodeGen/SchedGraphCommon.h | 19 | ||||
-rw-r--r-- | include/llvm/Module.h | 6 | ||||
-rw-r--r-- | include/llvm/Pass.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/ConstantRange.h | 4 | ||||
-rw-r--r-- | include/llvm/Type.h | 4 | ||||
-rw-r--r-- | include/llvm/Value.h | 4 |
14 files changed, 114 insertions, 7 deletions
diff --git a/include/llvm/ADT/BitSetVector.h b/include/llvm/ADT/BitSetVector.h index 619bb0c..835d2e0 100644 --- a/include/llvm/ADT/BitSetVector.h +++ b/include/llvm/ADT/BitSetVector.h @@ -25,6 +25,7 @@ #ifndef LLVM_ADT_BITSETVECTOR_H #define LLVM_ADT_BITSETVECTOR_H +#include "llvm/Support/Streams.h" #include <bitset> #include <vector> #include <functional> @@ -173,6 +174,9 @@ public: /// /// Printing and debugging support /// + void print(llvm_ostream &O) const { + if (O.stream()) print(*O.stream()); + } void print(std::ostream &O) const; void dump() const { print(std::cerr); } @@ -248,6 +252,10 @@ inline void BitSetVector::print(std::ostream& O) const O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", "); } +inline llvm_ostream& operator<< (llvm_ostream& O, const BitSetVector& bset) { + bset.print(O); + return O; +} inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset) { bset.print(O); diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index 082d899..c4273ac 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -18,6 +18,7 @@ #define LLVM_ANALYSIS_ALIASSETTRACKER_H #include "llvm/Support/CallSite.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/iterator" #include "llvm/ADT/hash_map" #include "llvm/ADT/ilist" @@ -155,6 +156,9 @@ public: iterator end() const { return iterator(); } bool empty() const { return PtrList == 0; } + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } void print(std::ostream &OS) const; void dump() const; @@ -244,6 +248,10 @@ private: bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const; }; +inline llvm_ostream& operator<<(llvm_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; @@ -353,6 +361,9 @@ public: iterator begin() { return AliasSets.begin(); } iterator end() { return AliasSets.end(); } + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } void print(std::ostream &OS) const; void dump() const; @@ -379,6 +390,10 @@ private: AliasSet *findAliasSetForCallSite(CallSite CS); }; +inline llvm_ostream& operator<<(llvm_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/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 74d3162..f1497cd 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -22,6 +22,7 @@ #define LLVM_ANALYSIS_SCALAREVOLUTION_H #include "llvm/Pass.h" +#include "llvm/Support/Streams.h" #include <set> namespace llvm { @@ -96,6 +97,9 @@ 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(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } virtual void print(std::ostream &OS) const = 0; /// dump - This method is used for debugging. @@ -103,6 +107,10 @@ namespace llvm { void dump() const; }; + inline llvm_ostream &operator<<(llvm_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; @@ -120,6 +128,9 @@ namespace llvm { virtual bool isLoopInvariant(const Loop *L) const; virtual const Type *getType() const; virtual bool hasComputableLoopEvolution(const Loop *L) const; + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } virtual void print(std::ostream &OS) const; virtual SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym, @@ -231,6 +242,9 @@ namespace llvm { virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; + void print(llvm_ostream &OS, const Module* = 0) const { + if (OS.stream()) print(*OS.stream()); + } virtual void print(std::ostream &OS, const Module* = 0) const; }; } diff --git a/include/llvm/Bytecode/Analyzer.h b/include/llvm/Bytecode/Analyzer.h index 491629d..912cbfd 100644 --- a/include/llvm/Bytecode/Analyzer.h +++ b/include/llvm/Bytecode/Analyzer.h @@ -22,7 +22,7 @@ #include "llvm/Bytecode/Format.h" #include <string> #include <map> -#include <iostream> +#include <ostream> namespace llvm { diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index b4ceb14..1b3ccad 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -60,7 +60,12 @@ namespace llvm { private: LiveRange(); // DO NOT IMPLEMENT }; + std::ostream& operator<<(std::ostream& os, const LiveRange &LR); + inline llvm_ostream& operator<<(llvm_ostream& os, const LiveRange &LR) { + if (os.stream()) *os.stream() << LR; + return os; + } inline bool operator<(unsigned V, const LiveRange &LR) { return V < LR.start; @@ -273,8 +278,7 @@ namespace llvm { } inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) { - llvm_ostream L(OS); - L << LI; + LI.print(OS); return OS; } } diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index eec3b3c..f714c73 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -17,6 +17,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/ilist" +#include "llvm/Support/Streams.h" namespace llvm { class MachineFunction; @@ -188,6 +189,9 @@ public: // Debugging methods. void dump() const; + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } void print(std::ostream &OS) const; /// getNumber - MachineBasicBlocks are uniquely numbered at the function @@ -222,7 +226,10 @@ private: // Methods used to maintain doubly linked list of blocks... }; std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); - +inline llvm_ostream& operator<<(llvm_ostream &OS, const MachineBasicBlock &MBB){ + if (OS.stream()) *OS.stream() << MBB; + 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 f45c8a7..6bb2665 100644 --- a/include/llvm/CodeGen/MachineConstantPool.h +++ b/include/llvm/CodeGen/MachineConstantPool.h @@ -17,6 +17,7 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/CodeGen/SelectionDAGNodes.h" +#include "llvm/Support/Streams.h" #include <vector> #include <iosfwd> @@ -48,9 +49,17 @@ public: /// print - Implement operator<<... /// + void print(llvm_ostream &O) const { + if (O.stream()) print(*O.stream()); + } virtual void print(std::ostream &O) const = 0; }; +inline llvm_ostream &operator<<(llvm_ostream &OS, + const MachineConstantPoolValue &V) { + V.print(OS); + return OS; +} inline std::ostream &operator<<(std::ostream &OS, const MachineConstantPoolValue &V) { V.print(OS); @@ -134,6 +143,9 @@ public: /// print - Used by the MachineFunction printer to print information about /// constant pool objects. Implemented in MachineFunction.cpp /// + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } void print(std::ostream &OS) const; /// dump - Call print(std::cerr) to be called from the debugger. diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 1aa8b40..11a769c 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -18,6 +18,7 @@ #include "llvm/ADT/iterator" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/Streams.h" #include <vector> #include <cassert> #include <iosfwd> @@ -284,6 +285,10 @@ public: IsDead = false; } + friend llvm_ostream& operator<<(llvm_ostream& os, const MachineOperand& mop) { + if (os.stream()) *os.stream() << mop; + return os; + } friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); friend class MachineInstr; @@ -400,8 +405,15 @@ public: // // Debugging support // + void print(llvm_ostream &OS, const TargetMachine *TM) const { + if (OS.stream()) print(*OS.stream(), TM); + } void print(std::ostream &OS, const TargetMachine *TM) const; void dump() const; + friend llvm_ostream& operator<<(llvm_ostream& os, const MachineInstr& minstr){ + if (os.stream()) *os.stream() << minstr; + return os; + } friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); //===--------------------------------------------------------------------===// diff --git a/include/llvm/CodeGen/SchedGraphCommon.h b/include/llvm/CodeGen/SchedGraphCommon.h index 4f6e2ad..b4cee96 100644 --- a/include/llvm/CodeGen/SchedGraphCommon.h +++ b/include/llvm/CodeGen/SchedGraphCommon.h @@ -17,6 +17,7 @@ #include "llvm/Value.h" #include "llvm/ADT/iterator" +#include "llvm/Support/Streams.h" #include <vector> namespace llvm { @@ -69,6 +70,9 @@ public: void dump(int indent=0) const; // Debugging support + void print(llvm_ostream &os) const { + if (os.stream()) print(*os.stream()); + } virtual void print(std::ostream &os) const = 0; protected: @@ -92,15 +96,17 @@ protected: }; // ostream << operator for SchedGraphNode class +inline llvm_ostream &operator<<(llvm_ostream &os, + const SchedGraphNodeCommon &node) { + node.print(os); + return os; +} inline std::ostream &operator<<(std::ostream &os, const SchedGraphNodeCommon &node) { node.print(os); return os; } - - - // // SchedGraphEdge - Edge class to represent dependencies // @@ -182,6 +188,9 @@ public: public: // Debugging support + void print(llvm_ostream &os) const { + if (os.stream()) print(*os.stream()); + } void print(std::ostream &os) const; void dump(int indent=0) const; @@ -191,6 +200,10 @@ private: }; // ostream << operator for SchedGraphNode class +inline llvm_ostream &operator<<(llvm_ostream &os, const SchedGraphEdge &edge) { + edge.print(os); + return os; +} inline std::ostream &operator<<(std::ostream &os, const SchedGraphEdge &edge) { edge.print(os); return os; diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 195c73d..4cb6d27 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -295,8 +295,14 @@ public: /// @{ public: /// Print the module to an output stream + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream(), 0); + } void print(std::ostream &OS) const { print(OS, 0); } /// Print the module to an output stream with AssemblyAnnotationWriter. + void print(llvm_ostream &OS, AssemblyAnnotationWriter *AAW) const { + if (OS.stream()) print(*OS.stream(), AAW); + } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Dump the module to std::cerr (for debugging). void dump() const; diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 547ad24..30f1df9 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -29,6 +29,7 @@ #ifndef LLVM_PASS_H #define LLVM_PASS_H +#include "llvm/Support/Streams.h" #include <vector> #include <map> #include <iosfwd> @@ -100,6 +101,9 @@ public: /// provide the Module* in case the analysis doesn't need it it can just be /// ignored. /// + void print(llvm_ostream &O, const Module *M) const { + if (O.stream()) print(*O.stream(), M); + } virtual void print(std::ostream &O, const Module *M) const; void dump() const; // dump - call print(std::cerr, 0); diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h index 41073b7..90a2990 100644 --- a/include/llvm/Support/ConstantRange.h +++ b/include/llvm/Support/ConstantRange.h @@ -25,6 +25,7 @@ #define LLVM_SUPPORT_CONSTANT_RANGE_H #include "llvm/Support/DataTypes.h" +#include "llvm/Support/Streams.h" #include <iosfwd> namespace llvm { @@ -140,6 +141,9 @@ class ConstantRange { /// print - Print out the bounds to a stream... /// + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } void print(std::ostream &OS) const; /// dump - Allow printing from a debugger easily... diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 6f19574..a69e751 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -14,6 +14,7 @@ #include "llvm/AbstractTypeUser.h" #include "llvm/Support/Casting.h" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" #include <string> @@ -135,6 +136,9 @@ protected: /// mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; public: + void print(llvm_ostream &O) const { + if (O.stream()) print(*O.stream()); + } void print(std::ostream &O) const; /// @brief Debugging support: print to stderr diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 157ef6e..5dfe63f 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -18,6 +18,7 @@ #include "llvm/AbstractTypeUser.h" #include "llvm/Use.h" #include "llvm/Support/Casting.h" +#include "llvm/Support/Streams.h" #include <string> namespace llvm { @@ -74,6 +75,9 @@ public: /// print - Implement operator<< on Value... /// + void print(llvm_ostream &O) const { + if (O.stream()) print(*O.stream()); + } virtual void print(std::ostream &O) const = 0; /// All values are typed, get the type of this value. |