Added a temporary hack to get the llvm-streams to work for future checkins.
authorBill Wendling <isanbard@gmail.com>
Tue, 28 Nov 2006 22:21:29 +0000 (22:21 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 28 Nov 2006 22:21:29 +0000 (22:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31978 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/llvm/ADT/BitSetVector.h
include/llvm/Analysis/AliasSetTracker.h
include/llvm/Analysis/ScalarEvolution.h
include/llvm/Bytecode/Analyzer.h
include/llvm/CodeGen/LiveInterval.h
include/llvm/CodeGen/MachineBasicBlock.h
include/llvm/CodeGen/MachineConstantPool.h
include/llvm/CodeGen/MachineInstr.h
include/llvm/CodeGen/SchedGraphCommon.h
include/llvm/Module.h
include/llvm/Pass.h
include/llvm/Support/ConstantRange.h
include/llvm/Type.h
include/llvm/Value.h

index 619bb0cf5f45d2782dcf8d03dcdee538f441b63e..835d2e09b1d4c5e1593fae07c6bee7c0e15d0d11 100644 (file)
@@ -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);
index 082d89910b84e5a2df8d3f6ab0c46e49c8b7d07f..c4273ac37def77fdec0d8b52a50992e11d5c1e86 100644 (file)
@@ -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;
index 74d3162254448c04bff0117c3a0e26aa0a736e00..f1497cdeda17e32d5ca4a1da4471e7cdb2868c91 100644 (file)
@@ -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;
   };
 }
index 491629d7ed0445b4e4cb39cc41b1041d8ab5e230..912cbfd1fe34b6dcbd23e2b8990b7544fb96e09a 100644 (file)
@@ -22,7 +22,7 @@
 #include "llvm/Bytecode/Format.h"
 #include <string>
 #include <map>
-#include <iostream>
+#include <ostream>
 
 namespace llvm {
 
index b4ceb145337d1ae6692d41e8aeab738c2387466a..1b3ccadf251db6bb2c3ae8e590eb9ee0be7d4ce0 100644 (file)
@@ -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;
   }
 }
index eec3b3cf3b0627112af4b438307abaef3e3560eb..f714c735f33babe496325f4e30797c54cc59b6ee 100644 (file)
@@ -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)
index f45c8a7a8d3b49ac414a4d481037a7ff6aa4325e..6bb2665985ece2be7035cc241eb916932c530baf 100644 (file)
@@ -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.
index 1aa8b40e7ed84c8a688b8e8d229935546a9d6fbf..11a769c930c98656e2c662860f5c89c5839fe891 100644 (file)
@@ -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);
 
   //===--------------------------------------------------------------------===//
index 4f6e2ad32fc819eac117a595f67785cd7078fa5e..b4cee969e1aeb64e2c49db0cddfa22949f2fe8fc 100644 (file)
@@ -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;
index 195c73d2f44a37ffd569a8bf97f196232db825ee..4cb6d279f0a7e08c0c91c1e799627d0902f4fa03 100644 (file)
@@ -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;
index 547ad24f33f7ed59bb22ecc96deb2cb769055b41..30f1df9669237a2c5d2bd0a20a40ed509de97fe8 100644 (file)
@@ -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);
 
index 41073b7b957e0d9c9cbe877f8a6aba0de2447389..90a29902c3491334fd1cf12c711c5dff08936bc1 100644 (file)
@@ -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...
index 6f1957414a708c82e9757e99f8b324ab525692e1..a69e751f784825be115dc5c4b6eb0b3948d38928 100644 (file)
@@ -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
index 157ef6e2b67cf3b4f6576f3410296bb8d52531ff..5dfe63f1b0270a8f8eac183493f07e2e90efd931 100644 (file)
@@ -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.