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/LegalizeDAG.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/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 874bfafab1..56ab18c773 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -394,7 +394,6 @@ static void ComputeTopDownOrdering(SDNode *N, std::vector<SDNode*> &Order, // Now that we have N in, add anything that uses it if all of their operands // are now done. - for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end(); UI != E;++UI) ComputeTopDownOrdering(*UI, Order, Visited); } @@ -409,19 +408,20 @@ void SelectionDAGLegalize::LegalizeDAG() { // node is only legalized after all of its operands are legalized. std::map<SDNode*, unsigned> Visited; std::vector<SDNode*> Order; - Order.reserve(DAG.allnodes_end()-DAG.allnodes_begin()); // Compute ordering from all of the leaves in the graphs, those (like the // entry node) that have no operands. for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), E = DAG.allnodes_end(); I != E; ++I) { - if ((*I)->getNumOperands() == 0) { - Visited[*I] = 0 - 1U; - ComputeTopDownOrdering(*I, Order, Visited); + if (I->getNumOperands() == 0) { + Visited[I] = 0 - 1U; + ComputeTopDownOrdering(I, Order, Visited); } } - assert(Order.size() == Visited.size() && Order.size() == DAG.allnodes_size()&& + assert(Order.size() == Visited.size() && + Order.size() == + (unsigned)std::distance(DAG.allnodes_begin(), DAG.allnodes_end()) && "Error: DAG is cyclic!"); Visited.clear(); |