summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-01-19 22:39:36 +0000
committerDan Gohman <gohman@apple.com>2009-01-19 22:39:36 +0000
commit534c8a2d720982c819549fe41abb03f4b123528b (patch)
treeb118113dad7fd9cf238d24802e2e76598388bc9c /llvm/lib/CodeGen
parentd067ecd1c7dea124d7016a0fd8f2dd7dd93f2641 (diff)
downloadbcm5719-llvm-534c8a2d720982c819549fe41abb03f4b123528b.tar.gz
bcm5719-llvm-534c8a2d720982c819549fe41abb03f4b123528b.zip
Remove SDNode's virtual destructor. This makes it impossible for
SDNode subclasses to keep state that requires non-trivial destructors, however it was already effectively impossible, since the destructor isn't actually ever called. There currently aren't any SDNode subclasses affected by this, and in general it's desireable to keep SDNode objects light-weight. This eliminates the last virtual member function in the SDNode class, so it eliminates the need for a vtable pointer, making SDNode smaller. llvm-svn: 62539
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp67
1 files changed, 14 insertions, 53 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index d8124e6d7c3..2a456dce33d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -557,14 +557,7 @@ void SelectionDAG::RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes,
DeadNodes.push_back(Operand);
}
- if (N->OperandsNeedDelete)
- delete[] N->OperandList;
-
- N->OperandList = 0;
- N->NumOperands = 0;
-
- // Finally, remove N itself.
- NodeAllocator.Deallocate(AllNodes.remove(N));
+ DeallocateNode(N);
}
}
@@ -585,16 +578,23 @@ void SelectionDAG::DeleteNode(SDNode *N) {
}
void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) {
+ assert(N != AllNodes.begin());
+
// Drop all of the operands and decrement used node's use counts.
for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I)
I->getVal()->removeUser(std::distance(N->op_begin(), I), N);
- if (N->OperandsNeedDelete) {
+ DeallocateNode(N);
+}
+
+void SelectionDAG::DeallocateNode(SDNode *N) {
+ if (N->OperandsNeedDelete)
delete[] N->OperandList;
- N->OperandList = 0;
- }
- assert(N != AllNodes.begin());
+ // Set the opcode to DELETED_NODE to help catch bugs when node
+ // memory is reallocated.
+ N->NodeType = ISD::DELETED_NODE;
+
NodeAllocator.Deallocate(AllNodes.remove(N));
}
@@ -786,17 +786,8 @@ SelectionDAG::~SelectionDAG() {
void SelectionDAG::allnodes_clear() {
assert(&*AllNodes.begin() == &EntryNode);
AllNodes.remove(AllNodes.begin());
- while (!AllNodes.empty()) {
- SDNode *N = AllNodes.remove(AllNodes.begin());
- N->SetNextInBucket(0);
-
- if (N->OperandsNeedDelete) {
- delete [] N->OperandList;
- N->OperandList = 0;
- }
-
- NodeAllocator.Deallocate(N);
- }
+ while (!AllNodes.empty())
+ DeallocateNode(AllNodes.begin());
}
void SelectionDAG::clear() {
@@ -4737,36 +4728,6 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
// SDNode Class
//===----------------------------------------------------------------------===//
-// Out-of-line virtual method to give class a home.
-void SDNode::ANCHOR() {}
-void UnarySDNode::ANCHOR() {}
-void BinarySDNode::ANCHOR() {}
-void TernarySDNode::ANCHOR() {}
-void HandleSDNode::ANCHOR() {}
-void ConstantSDNode::ANCHOR() {}
-void ConstantFPSDNode::ANCHOR() {}
-void GlobalAddressSDNode::ANCHOR() {}
-void FrameIndexSDNode::ANCHOR() {}
-void JumpTableSDNode::ANCHOR() {}
-void ConstantPoolSDNode::ANCHOR() {}
-void BasicBlockSDNode::ANCHOR() {}
-void SrcValueSDNode::ANCHOR() {}
-void MemOperandSDNode::ANCHOR() {}
-void RegisterSDNode::ANCHOR() {}
-void DbgStopPointSDNode::ANCHOR() {}
-void LabelSDNode::ANCHOR() {}
-void ExternalSymbolSDNode::ANCHOR() {}
-void CondCodeSDNode::ANCHOR() {}
-void ARG_FLAGSSDNode::ANCHOR() {}
-void VTSDNode::ANCHOR() {}
-void MemSDNode::ANCHOR() {}
-void LoadSDNode::ANCHOR() {}
-void StoreSDNode::ANCHOR() {}
-void AtomicSDNode::ANCHOR() {}
-void MemIntrinsicSDNode::ANCHOR() {}
-void CallSDNode::ANCHOR() {}
-void CvtRndSatSDNode::ANCHOR() {}
-
HandleSDNode::~HandleSDNode() {
DropOperands();
}
OpenPOWER on IntegriCloud