Switch the allnodes list from a vector of pointers to an ilist of nodes.This eliminates the vector, allows constant time removal of a node froma graph, and makes iteration over the all nodes list stable when adding

nodes to the graph.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2005-11-09 23:47:37 +00:00
parent b80e2be889
commit de202b3cda
4 changed files with 37 additions and 46 deletions

View File

@ -837,21 +837,18 @@ void SimpleSched::FakeGroupDominators() {
void SimpleSched::PrepareNodeInfo() {
// Allocate node information
Info = new NodeInfo[NodeCount];
// Get base of all nodes table
SelectionDAG::allnodes_iterator AllNodes = DAG.allnodes_begin();
// For each node being scheduled
for (unsigned i = 0, N = NodeCount; i < N; i++) {
// Get next node from DAG all nodes table
SDNode *Node = AllNodes[i];
unsigned i = 0;
for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
E = DAG.allnodes_end(); I != E; ++I, ++i) {
// Fast reference to node schedule info
NodeInfo* NI = &Info[i];
// Set up map
Map[Node] = NI;
Map[I] = NI;
// Set node
NI->Node = Node;
NI->Node = I;
// Set pending visit count
NI->setPending(Node->use_size());
NI->setPending(I->use_size());
}
}
@ -1235,7 +1232,7 @@ void SimpleSched::EmitNode(NodeInfo *NI) {
///
void SimpleSched::Schedule() {
// Number the nodes
NodeCount = DAG.allnodes_size();
NodeCount = std::distance(DAG.allnodes_begin(), DAG.allnodes_end());
// Test to see if scheduling should occur
bool ShouldSchedule = NodeCount > 3 && ScheduleStyle != noScheduling;
// Set up minimum info for scheduling