Rewrote uses of deprecated `MachineFunction::get(BasicBlock *BB)'.
[oota-llvm.git] / lib / Target / SparcV9 / RegAlloc / IGNode.h
index bdaedf8c134c66ae3c14f24e9bb20f54916b576c..edb178f5bc912fe56107069af0a004a59cbb9ecd 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef IG_NODE_H
 #define IG_NODE_H
 
-#include "llvm/CodeGen/RegAllocCommon.h"
 #include "llvm/CodeGen/LiveRange.h"
 class LiveRange;
 class RegClass;
@@ -37,11 +36,9 @@ class RegClass;
 //----------------------------------------------------------------------------
 
 class IGNode {
-  const int Index;            // index within IGNodeList 
-
-  bool OnStack;               // this has been pushed on to stack for coloring
-
-  std::vector<IGNode *> AdjList;   // adjacency list for this live range
+  const unsigned Index;         // index within IGNodeList 
+  bool OnStack;                 // this has been pushed on to stack for coloring
+  std::vector<IGNode *> AdjList;// adjacency list for this live range
 
   int CurDegree;     
   //
@@ -50,12 +47,14 @@ class IGNode {
   // Decremented when a neighbor is pushed on to the stack. 
   // After that, never incremented/set again nor used.
 
-  LiveRange *const ParentLR;  // parent LR (cannot be a const)
+  LiveRange *const ParentLR;
 public:
 
-  // constructor
-  //
-  IGNode(LiveRange *LR, unsigned index);
+  IGNode(LiveRange *LR, unsigned index) : Index(index), ParentLR(LR) {
+    OnStack = false;
+    CurDegree = -1;
+    ParentLR->setUserIGNode(this);
+  }
 
   inline unsigned int getIndex() const { return Index; }
 
@@ -73,6 +72,9 @@ public:
 
   inline unsigned getNumOfNeighbors() const { return AdjList.size(); }
 
+  // Get the number of unique neighbors if these two nodes are merged
+  unsigned getCombinedDegree(const IGNode* otherNode) const;
+
   inline bool isOnStack() const { return OnStack; }
 
   // remove form IG and pushes on to stack (reduce the degree of neighbors)