Added an assertion since it seems like AdjList returns an errornous size in method
[oota-llvm.git] / lib / Target / SparcV9 / RegAlloc / IGNode.cpp
1 #include "llvm/CodeGen/IGNode.h"
2
3
4 IGNode::IGNode(LiveRange *const PLR, unsigned int Ind): Index(Ind),
5                                                         AdjList(),
6                                                         ParentLR(PLR)
7 {
8   OnStack = false;
9   CurDegree = -1 ;
10   ParentLR->setUserIGNode( this );
11 }
12
13
14
15 void IGNode::pushOnStack()            // sets on to stack and 
16 {                                     // reduce the degree of neighbors  
17   OnStack = true; 
18   int neighs = AdjList.size();
19
20   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();
26 }
27  
28
29 void 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 }