[llvm-commits] CVS: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h LiveInterval.h LiveIntervalAnalysis.h MachineBasicBlock.h MachineConstantPool.h MachineFunction.h MachineInstr.h MachineJumpTableInfo.h SchedGraphCommon.h

Bill Wendling isanbard at gmail.com
Sat Dec 16 21:15:50 PST 2006



Changes in directory llvm/include/llvm/CodeGen:

LinkAllCodegenComponents.h updated: 1.3 -> 1.4
LiveInterval.h updated: 1.33 -> 1.34
LiveIntervalAnalysis.h updated: 1.65 -> 1.66
MachineBasicBlock.h updated: 1.53 -> 1.54
MachineConstantPool.h updated: 1.24 -> 1.25
MachineFunction.h updated: 1.62 -> 1.63
MachineInstr.h updated: 1.208 -> 1.209
MachineJumpTableInfo.h updated: 1.10 -> 1.11
SchedGraphCommon.h updated: 1.16 -> 1.17
---
Log message:

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.


---
Diffs of the changes:  (+19 -55)

 LinkAllCodegenComponents.h |    1 +
 LiveInterval.h             |   16 ++++------------
 LiveIntervalAnalysis.h     |    3 +++
 MachineBasicBlock.h        |    8 +-------
 MachineConstantPool.h      |   13 ++-----------
 MachineFunction.h          |    1 +
 MachineInstr.h             |   14 ++++----------
 MachineJumpTableInfo.h     |    1 +
 SchedGraphCommon.h         |   17 ++---------------
 9 files changed, 19 insertions(+), 55 deletions(-)


Index: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
diff -u llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.4
--- llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3	Tue Aug  1 14:14:14 2006
+++ llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h	Sat Dec 16 23:15:12 2006
@@ -31,6 +31,7 @@
       (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);


Index: llvm/include/llvm/CodeGen/LiveInterval.h
diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.33 llvm/include/llvm/CodeGen/LiveInterval.h:1.34
--- llvm/include/llvm/CodeGen/LiveInterval.h:1.33	Fri Dec 15 20:15:42 2006
+++ llvm/include/llvm/CodeGen/LiveInterval.h	Sat Dec 16 23:15:12 2006
@@ -57,16 +57,13 @@
 
     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 @@
       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 @@
     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;


Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.65 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.66
--- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.65	Wed Nov 15 20:41:50 2006
+++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h	Sat Dec 16 23:15:12 2006
@@ -161,6 +161,9 @@
 
     /// 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


Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.53 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.54
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.53	Fri Dec 15 20:15:42 2006
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h	Sat Dec 16 23:15:12 2006
@@ -189,10 +189,8 @@
 
   // 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 @@
 };
 
 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)


Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.24 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.25
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.24	Wed Dec  6 19:30:31 2006
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h	Sat Dec 16 23:15:12 2006
@@ -49,17 +49,10 @@
 
   /// 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 @@
   /// 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.
   ///


Index: llvm/include/llvm/CodeGen/MachineFunction.h
diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.62 llvm/include/llvm/CodeGen/MachineFunction.h:1.63
--- llvm/include/llvm/CodeGen/MachineFunction.h:1.62	Tue Oct  3 14:18:57 2006
+++ llvm/include/llvm/CodeGen/MachineFunction.h	Sat Dec 16 23:15:12 2006
@@ -238,6 +238,7 @@
   /// 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


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.208 llvm/include/llvm/CodeGen/MachineInstr.h:1.209
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.208	Fri Dec 15 20:15:42 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Sat Dec 16 23:15:12 2006
@@ -78,6 +78,7 @@
   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 @@
     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 @@
   //
   // 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 print(std::ostream &OS) const;
+  void print(std::ostream *OS) const { if (OS) print(*OS); }
   void dump() const;
-  friend OStream& operator<<(OStream& os, const MachineInstr& minstr) {
-    if (os.stream()) minstr.print(*os.stream());
-    return os;
-  }
   friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr){
     minstr.print(os);
     return os;


Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h
diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.10 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.11
--- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.10	Thu Dec 14 15:03:17 2006
+++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h	Sat Dec 16 23:15:12 2006
@@ -90,6 +90,7 @@
   /// jump tables.  Implemented in MachineFunction.cpp
   ///
   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.
   ///


Index: llvm/include/llvm/CodeGen/SchedGraphCommon.h
diff -u llvm/include/llvm/CodeGen/SchedGraphCommon.h:1.16 llvm/include/llvm/CodeGen/SchedGraphCommon.h:1.17
--- llvm/include/llvm/CodeGen/SchedGraphCommon.h:1.16	Wed Dec  6 19:30:31 2006
+++ llvm/include/llvm/CodeGen/SchedGraphCommon.h	Sat Dec 16 23:15:12 2006
@@ -70,10 +70,8 @@
   void dump(int indent=0) const;
 
   // Debugging support
-  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); }
 
 protected:
   friend class SchedGraphCommon;
@@ -96,11 +94,6 @@
 };
 
 // ostream << operator for SchedGraphNode class
-inline OStream &operator<<(OStream &os,
-                           const SchedGraphNodeCommon &node) {
-  node.print(os);
-  return os;
-}
 inline std::ostream &operator<<(std::ostream &os,
                                 const SchedGraphNodeCommon &node) {
   node.print(os);
@@ -188,10 +181,8 @@
 
 public:
   // Debugging support
-  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(int indent=0) const;
 
 private:
@@ -200,10 +191,6 @@
 };
 
 // ostream << operator for SchedGraphNode class
-inline OStream &operator<<(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;






More information about the llvm-commits mailing list