Reverting dtor devirtualization patch.
[oota-llvm.git] / lib / VMCore / Instructions.cpp
index 84adc50994a76400ba26c88d8dac919e9351a4e8..0df0466112bc797aeeacb2ef1fcad8486687d905 100644 (file)
@@ -67,6 +67,20 @@ bool CallSite::onlyReadsMemory() const {
 }
 
 
+
+//===----------------------------------------------------------------------===//
+//                            TerminatorInst Class
+//===----------------------------------------------------------------------===//
+
+// Out of line virtual method, so the vtable, etc has a home.
+TerminatorInst::~TerminatorInst() {
+}
+
+// Out of line virtual method, so the vtable, etc has a home.
+UnaryInstruction::~UnaryInstruction() {
+}
+
+
 //===----------------------------------------------------------------------===//
 //                               PHINode Class
 //===----------------------------------------------------------------------===//
@@ -82,9 +96,8 @@ PHINode::PHINode(const PHINode &PN)
   }
 }
 
-void PHINode::destroyThis(PHINode*v) {
-  delete [] v->OperandList;
-  Instruction::destroyThis(v);
+PHINode::~PHINode() {
+  delete [] OperandList;
 }
 
 // removeIncomingValue - Remove an incoming value.  This is useful if a
@@ -201,11 +214,10 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
 //                        CallInst Implementation
 //===----------------------------------------------------------------------===//
 
-void CallInst::destroyThis(CallInst*v) {
-  delete [] v->OperandList;
-  if (v->ParamAttrs)
-    v->ParamAttrs->dropRef();
-  Instruction::destroyThis(v);
+CallInst::~CallInst() {
+  delete [] OperandList;
+  if (ParamAttrs)
+    ParamAttrs->dropRef();
 }
 
 void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
@@ -394,11 +406,10 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
 //                        InvokeInst Implementation
 //===----------------------------------------------------------------------===//
 
-void InvokeInst::destroyThis(InvokeInst*v) {
-  delete [] v->OperandList;
-  if (v->ParamAttrs)
-    v->ParamAttrs->dropRef();
-  TerminatorInst::destroyThis(v);
+InvokeInst::~InvokeInst() {
+  delete [] OperandList;
+  if (ParamAttrs)
+    ParamAttrs->dropRef();
 }
 
 void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
@@ -672,6 +683,10 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
   setName(Name);
 }
 
+// Out of line virtual method, so the vtable, etc has a home.
+AllocationInst::~AllocationInst() {
+}
+
 bool AllocationInst::isArrayAllocation() const {
   if (ConstantInt *CI = dyn_cast<ConstantInt>(getOperand(0)))
     return CI->getZExtValue() != 1;
@@ -936,8 +951,8 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
   setName(Name);
 }
 
-void GetElementPtrInst::destroyThis(GetElementPtrInst*v) {
-  delete[] v->OperandList;
+GetElementPtrInst::~GetElementPtrInst() {
+  delete[] OperandList;
 }
 
 // getIndexedType - Returns the type of the element that would be loaded with
@@ -2454,9 +2469,8 @@ SwitchInst::SwitchInst(const SwitchInst &SI)
   }
 }
 
-void SwitchInst::destroyThis(SwitchInst*v) {
-  delete [] v->OperandList;
-  TerminatorInst::destroyThis(v);
+SwitchInst::~SwitchInst() {
+  delete [] OperandList;
 }