From de202b3cda00f17ba2c047be7270b51f9585a413 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 9 Nov 2005 23:47:37 +0000 Subject: 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 --- lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAG.cpp') diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 9abaeefcea..e6f33761e1 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -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 -- cgit v1.2.3-18-g5258