2001-09-14 21:18:34 +00:00
|
|
|
#include "llvm/CodeGen/IGNode.h"
|
2002-01-20 22:54:45 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <iostream>
|
|
|
|
using std::cerr;
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-01-07 19:19:18 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Sets this IGNode on stack and reduce the degree of neighbors
|
|
|
|
//-----------------------------------------------------------------------------
|
2002-02-05 04:20:12 +00:00
|
|
|
|
|
|
|
void IGNode::pushOnStack() {
|
2001-09-14 21:18:34 +00:00
|
|
|
OnStack = true;
|
2001-11-03 22:01:09 +00:00
|
|
|
int neighs = AdjList.size();
|
2001-09-14 21:18:34 +00:00
|
|
|
|
2002-02-05 04:20:12 +00:00
|
|
|
if (neighs < 0) {
|
2002-01-20 22:54:45 +00:00
|
|
|
cerr << "\nAdj List size = " << neighs;
|
2001-11-03 22:01:09 +00:00
|
|
|
assert(0 && "Invalid adj list size");
|
|
|
|
}
|
|
|
|
|
2002-01-20 22:54:45 +00:00
|
|
|
for(int i=0; i < neighs; i++)
|
|
|
|
AdjList[i]->decCurDegree();
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|
|
|
|
|
2002-01-07 19:19:18 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Deletes an adjacency node. IGNodes are deleted when coalescing merges
|
|
|
|
// two IGNodes together.
|
|
|
|
//-----------------------------------------------------------------------------
|
2002-02-05 04:20:12 +00:00
|
|
|
|
|
|
|
void IGNode::delAdjIGNode(const IGNode *Node) {
|
|
|
|
std::vector<IGNode *>::iterator It=find(AdjList.begin(), AdjList.end(), Node);
|
2001-09-14 21:18:34 +00:00
|
|
|
assert( It != AdjList.end() ); // the node must be there
|
2002-01-20 22:54:45 +00:00
|
|
|
AdjList.erase(It);
|
2001-09-14 21:18:34 +00:00
|
|
|
}
|