#ifndef IG_NODE_H
#define IG_NODE_H
-#include "llvm/CodeGen/RegAllocCommon.h"
#include "llvm/CodeGen/LiveRange.h"
class LiveRange;
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;
//
// 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; }
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)