[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 29 14:59:43 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.173 -> 1.174
---
Log message:

Add a new API for Nate


---
Diffs of the changes:  (+27 -0)

 SelectionDAG.cpp |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.173 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.174
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.173	Sun Aug 28 18:59:36 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Mon Aug 29 16:59:31 2005
@@ -228,6 +228,33 @@
   delete N;  
 }
 
+void SelectionDAG::DeleteNode(SDNode *N) {
+  assert(N->use_empty() && "Cannot delete a node that is not dead!");
+
+  // First take this out of the appropriate CSE map.
+  RemoveNodeFromCSEMaps(N);
+
+  // Remove it from the AllNodes list.
+  for (std::vector<SDNode*>::iterator I = AllNodes.begin(); ; ++I) {
+    assert(I != AllNodes.end() && "Node not in AllNodes list??");
+    if (*I == N) {
+      // Erase from the vector, which is not ordered.
+      std::swap(*I, AllNodes.back());
+      AllNodes.pop_back();
+      break;
+    }
+  }
+    
+  // Drop all of the operands and decrement used nodes use counts.
+  while (!N->Operands.empty()) {
+    SDNode *O = N->Operands.back().Val;
+    N->Operands.pop_back();
+    O->removeUser(N);
+  }
+  
+  delete N;
+}
+
 /// RemoveNodeFromCSEMaps - Take the specified node out of the CSE map that
 /// correspond to it.  This is useful when we're about to delete or repurpose
 /// the node.  We don't want future request for structurally identical nodes






More information about the llvm-commits mailing list