diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-09 23:47:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-09 23:47:37 +0000 |
commit | de202b3cda00f17ba2c047be7270b51f9585a413 (patch) | |
tree | 8604a0187eb4225388ab6294c1e8e4e1d1afb6e4 /lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | |
parent | b80e2be8894db9f843f32ebaffb9b7fd6b57d206 (diff) |
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
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
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 |