Use StringMap instead of std::map<std::string, SDNode*>.
[oota-llvm.git] / include / llvm / CodeGen / SchedGraphCommon.h
index 7560690230b9ef38184bddd9eb2ff4c73e2359c5..514c464dff362e3bd7e0aaddca11cbc5016e4d45 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -16,7 +16,8 @@
 #define LLVM_CODEGEN_SCHEDGRAPHCOMMON_H
 
 #include "llvm/Value.h"
-#include "llvm/ADT/iterator"
+#include "llvm/ADT/iterator.h"
+#include "llvm/Support/Streams.h"
 #include <vector>
 
 namespace llvm {
@@ -57,7 +58,7 @@ public:
 
   // Iterators
   iterator beginInEdges() { return inEdges.begin(); }
-  iterator endInEdges()         { return inEdges.end(); }
+  iterator endInEdges() { return inEdges.end(); }
   iterator beginOutEdges() { return outEdges.begin(); }
   iterator endOutEdges() { return outEdges.end(); }
 
@@ -70,14 +71,15 @@ public:
 
   // Debugging support
   virtual void print(std::ostream &os) const = 0;
+  void print(std::ostream *os) const { if (os) print(*os); }
 
 protected:
   friend class SchedGraphCommon;
-  friend class SchedGraphEdge;         // give access for adding edges
+  friend class SchedGraphEdge;   // give access for adding edges
 
 
   // disable default constructor and provide a ctor for single-block graphs
-  SchedGraphNodeCommon();      // DO NOT IMPLEMENT
+  SchedGraphNodeCommon();  // DO NOT IMPLEMENT
 
   inline SchedGraphNodeCommon(unsigned Id, int index, int late=0) : ID(Id), latency(late), origIndexInBB(index) {}
 
@@ -93,14 +95,11 @@ protected:
 
 // ostream << operator for SchedGraphNode class
 inline std::ostream &operator<<(std::ostream &os,
-                               const SchedGraphNodeCommon &node) {
+                                const SchedGraphNodeCommon &node) {
   node.print(os);
   return os;
 }
 
-
-
-
 //
 // SchedGraphEdge - Edge class to represent dependencies
 //
@@ -114,8 +113,8 @@ public:
   };
 
 protected:
-  SchedGraphNodeCommon*        src;
-  SchedGraphNodeCommon*        sink;
+  SchedGraphNodeCommon* src;
+  SchedGraphNodeCommon* sink;
   SchedGraphEdgeDepType depType;
   unsigned int depOrderType;
   int minDelay; // cached latency (assumes fixed target arch)
@@ -127,35 +126,35 @@ protected:
     ResourceId   resourceId;
   };
 
-public:        
+public:
   // For all constructors, if minDelay is unspecified, minDelay is
   // set to _src->getLatency().
 
   // constructor for CtrlDep or MemoryDep edges, selected by 3rd argument
   SchedGraphEdge(SchedGraphNodeCommon* _src, SchedGraphNodeCommon* _sink,
-                SchedGraphEdgeDepType _depType, unsigned int _depOrderType,
-                int _minDelay = -1);
+                 SchedGraphEdgeDepType _depType, unsigned int _depOrderType,
+                 int _minDelay = -1);
 
   // constructor for explicit value dependence (may be true/anti/output)
   SchedGraphEdge(SchedGraphNodeCommon* _src, SchedGraphNodeCommon* _sink,
-                const Value* _val, unsigned int _depOrderType,
-                int _minDelay = -1);
+                 const Value* _val, unsigned int _depOrderType,
+                 int _minDelay = -1);
 
   // constructor for machine register dependence
   SchedGraphEdge(SchedGraphNodeCommon* _src,SchedGraphNodeCommon* _sink,
-                unsigned int _regNum, unsigned int _depOrderType,
-                int _minDelay = -1);
+                 unsigned int _regNum, unsigned int _depOrderType,
+                 int _minDelay = -1);
 
   // constructor for any other machine resource dependences.
   // DataDepOrderType is always NonDataDep.  It it not an argument to
   // avoid overloading ambiguity with previous constructor.
   SchedGraphEdge(SchedGraphNodeCommon* _src, SchedGraphNodeCommon* _sink,
-                ResourceId _resourceId, int _minDelay = -1);
+                 ResourceId _resourceId, int _minDelay = -1);
 
   ~SchedGraphEdge() {}
 
-  SchedGraphNodeCommon*        getSrc() const { return src; }
-  SchedGraphNodeCommon*        getSink() const { return sink; }
+  SchedGraphNodeCommon* getSrc() const { return src; }
+  SchedGraphNodeCommon* getSink() const { return sink; }
   int getMinDelay() const { return minDelay; }
   SchedGraphEdgeDepType getDepType() const { return depType; }
   unsigned int getDepOrderType() const { return depOrderType; }
@@ -183,11 +182,12 @@ public:
 public:
   // Debugging support
   void print(std::ostream &os) const;
+  void print(std::ostream *os) const { if (os) print(*os); }
   void dump(int indent=0) const;
 
 private:
   // disable default ctor
-  SchedGraphEdge();    // DO NOT IMPLEMENT
+  SchedGraphEdge(); // DO NOT IMPLEMENT
 };
 
 // ostream << operator for SchedGraphNode class
@@ -247,12 +247,12 @@ public:
   inline _EdgeType* getEdge() const { return *(oi); }
 
   inline _Self &operator++() { ++oi; return *this; }    // Preincrement
-  inline _Self operator++(int) {                       // Postincrement
+  inline _Self operator++(int) {                        // Postincrement
     _Self tmp(*this); ++*this; return tmp;
   }
 
   inline _Self &operator--() { --oi; return *this; }    // Predecrement
-  inline _Self operator--(int) {                               // Postdecrement
+  inline _Self operator--(int) {                        // Postdecrement
     _Self tmp = *this; --*this; return tmp;
   }
 };
@@ -275,12 +275,12 @@ public:
   inline _EdgeType* getEdge() const { return *(oi); }
 
   inline _Self &operator++() { ++oi; return *this; }    // Preincrement
-  inline _Self operator++(int) {                       // Postincrement
+  inline _Self operator++(int) {                        // Postincrement
     _Self tmp(*this); ++*this; return tmp;
   }
 
   inline _Self &operator--() { --oi; return *this; }    // Predecrement
-  inline _Self operator--(int) {                               // Postdecrement
+  inline _Self operator--(int) {                        // Postdecrement
     _Self tmp = *this; --*this; return tmp;
   }
 };