blob: d8473d2370bb765bb36c315578a6146435fd4b3c [file] [log] [blame]
Ruchira Sasanka8e604792001-09-14 21:18:34 +00001#include "llvm/CodeGen/IGNode.h"
2
3
4IGNode::IGNode(LiveRange *const PLR, unsigned int Ind): Index(Ind),
Ruchira Sasanka0e62aa62001-10-19 21:39:31 +00005 AdjList(),
Ruchira Sasanka8e604792001-09-14 21:18:34 +00006 ParentLR(PLR)
7{
8 OnStack = false;
9 CurDegree = -1 ;
10 ParentLR->setUserIGNode( this );
11}
12
13
14
15void IGNode::pushOnStack() // sets on to stack and
16{ // reduce the degree of neighbors
17 OnStack = true;
Ruchira Sasankaa9e45c82001-11-03 22:01:09 +000018 int neighs = AdjList.size();
Ruchira Sasanka8e604792001-09-14 21:18:34 +000019
Ruchira Sasankaa9e45c82001-11-03 22:01:09 +000020 if( neighs < 0) {
21 cout << "\nAdj List size = " << neighs;
22 assert(0 && "Invalid adj list size");
23 }
24
25 for(int i=0; i < neighs; i++) (AdjList[i])->decCurDegree();
Ruchira Sasanka8e604792001-09-14 21:18:34 +000026}
27
28
29void IGNode::delAdjIGNode(const IGNode *const Node) {
30 vector <IGNode *>::iterator It = AdjList.begin();
31
32 // find Node
33 for( ; It != AdjList.end() && (*It != Node); It++ ) ;
34 assert( It != AdjList.end() ); // the node must be there
35
36 AdjList.erase( It );
37}