Changes For Bug 352
[oota-llvm.git] / lib / CodeGen / InstrSched / SchedGraph.h
index 4da761f0f85c8ff90b357c09190c0d85add382a8..53ded6377d031c7fdc4b3b529cfa573f3ffe5ed2 100644 (file)
@@ -1,13 +1,18 @@
-//===-- SchedGraph.h - Scheduling Graph --------------------------*- C++ -*--=//
+//===-- SchedGraph.h - Scheduling Graph -------------------------*- C++ -*-===//
+// 
+//                     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.
+// 
+//===----------------------------------------------------------------------===//
 //
-// Purpose:
-//     Scheduling graph based on SSA graph plus extra dependence edges
-//     capturing dependences due to machine resources (machine registers,
-//     CC registers, and any others).
+// This is a scheduling graph based on SSA graph plus extra dependence edges
+// capturing dependences due to machine resources (machine registers, CC
+// registers, and any others).
 // 
-// Strategy:
-//     This graph tries to leverage the SSA graph as much as possible,
-//     but captures the extra dependences through a common interface.
+// This graph tries to leverage the SSA graph as much as possible, but captures
+// the extra dependences through a common interface.
 // 
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/SchedGraphCommon.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Transforms/Scalar.h"
-#include "Support/hash_map"
-#include "Support/GraphTraits.h"
+#include "llvm/ADT/hash_map"
+#include "llvm/ADT/GraphTraits.h"
+
+namespace llvm {
 
 class RegToRefVecMap;
 class ValueToDefVecMap;
@@ -41,7 +48,7 @@ public:
 
   // Accessor methods
   const MachineInstr* getMachineInstr() const { return MI; }
-  const MachineOpCode getOpCode() const { return MI->getOpCode(); }
+  const MachineOpCode getOpcode() const { return MI->getOpcode(); }
   bool isDummyNode() const { return (MI == NULL); }
   MachineBasicBlock &getMachineBasicBlock() const { return *MBB; }
 
@@ -173,68 +180,6 @@ public:
 
 
 
-//********************** Sched Graph Iterators *****************************/
-
-// Ok to make it a template because it shd get instantiated at most twice:
-// for <SchedGraphNode, SchedGraphNode::iterator> and
-// for <const SchedGraphNode, SchedGraphNode::const_iterator>.
-// 
-template <class _NodeType, class _EdgeType, class _EdgeIter>
-class SGPredIterator: public bidirectional_iterator<_NodeType, ptrdiff_t> {
-protected:
-  _EdgeIter oi;
-public:
-  typedef SGPredIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
-  
-  inline SGPredIterator(_EdgeIter startEdge) : oi(startEdge) {}
-  
-  inline bool operator==(const _Self& x) const { return oi == x.oi; }
-  inline bool operator!=(const _Self& x) const { return !operator==(x); }
-  
-  // operator*() differs for pred or succ iterator
-  inline _NodeType* operator*() const { return (_NodeType*)(*oi)->getSrc(); }
-  inline _NodeType* operator->() const { return operator*(); }
-  
-  inline _EdgeType* getEdge() const { return *(oi); }
-  
-  inline _Self &operator++() { ++oi; return *this; }    // Preincrement
-  inline _Self operator++(int) {                       // Postincrement
-    _Self tmp(*this); ++*this; return tmp; 
-  }
-  
-  inline _Self &operator--() { --oi; return *this; }    // Predecrement
-  inline _Self operator--(int) {                               // Postdecrement
-    _Self tmp = *this; --*this; return tmp;
-  }
-};
-
-template <class _NodeType, class _EdgeType, class _EdgeIter>
-class SGSuccIterator : public bidirectional_iterator<_NodeType, ptrdiff_t> {
-protected:
-  _EdgeIter oi;
-public:
-  typedef SGSuccIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
-  
-  inline SGSuccIterator(_EdgeIter startEdge) : oi(startEdge) {}
-  
-  inline bool operator==(const _Self& x) const { return oi == x.oi; }
-  inline bool operator!=(const _Self& x) const { return !operator==(x); }
-  
-  inline _NodeType* operator*() const { return (_NodeType*)(*oi)->getSink(); }
-  inline _NodeType* operator->() const { return operator*(); }
-  
-  inline _EdgeType* getEdge() const { return *(oi); }
-  
-  inline _Self &operator++() { ++oi; return *this; }    // Preincrement
-  inline _Self operator++(int) {                       // Postincrement
-    _Self tmp(*this); ++*this; return tmp; 
-  }
-  
-  inline _Self &operator--() { --oi; return *this; }    // Predecrement
-  inline _Self operator--(int) {                               // Postdecrement
-    _Self tmp = *this; --*this; return tmp;
-  }
-};
 
 // 
 // sg_pred_iterator
@@ -312,4 +257,6 @@ template <> struct GraphTraits<const SchedGraph*> {
   }
 };
 
+} // End llvm namespace
+
 #endif