Reverting dtor devirtualization patch.

_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed
_sabre_: the vtable lives to fight another day

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gordon Henriksen
2007-12-10 02:14:30 +00:00
parent 65b211807d
commit afba8fe662
21 changed files with 228 additions and 663 deletions

View File

@ -46,11 +46,6 @@ class ConstantInt : public Constant {
ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
ConstantInt(const IntegerType *Ty, const APInt& V);
APInt Val;
protected:
static void destroyThis(ConstantInt*v) {
Constant::destroyThis(v);
}
friend class Value;
public:
/// Return the constant as an APInt value reference. This allows clients to
/// obtain a copy of the value, with all its precision in tact.
@ -223,10 +218,6 @@ class ConstantFP : public Constant {
ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
protected:
ConstantFP(const Type *Ty, const APFloat& V);
static void destroyThis(ConstantFP*v) {
Constant::destroyThis(v);
}
friend class Value;
public:
/// get() - Static factory methods - Return objects of the specified value
static ConstantFP *get(const Type *Ty, const APFloat& V);
@ -275,11 +266,6 @@ class ConstantAggregateZero : public Constant {
protected:
explicit ConstantAggregateZero(const Type *Ty)
: Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
static void destroyThis(ConstantAggregateZero*v) {
Constant::destroyThis(v);
}
friend class Value;
public:
/// get() - static factory method for creating a null aggregate. It is
/// illegal to call this method with a non-aggregate type.
@ -309,8 +295,7 @@ class ConstantArray : public Constant {
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
protected:
ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
static void destroyThis(ConstantArray*);
friend class Value;
~ConstantArray();
public:
/// get() - Static factory methods - Return objects of the specified value
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
@ -376,8 +361,7 @@ class ConstantStruct : public Constant {
ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT
protected:
ConstantStruct(const StructType *T, const std::vector<Constant*> &Val);
static void destroyThis(ConstantStruct*);
friend class Value;
~ConstantStruct();
public:
/// get() - Static factory methods - Return objects of the specified value
///
@ -421,8 +405,7 @@ class ConstantVector : public Constant {
ConstantVector(const ConstantVector &); // DO NOT IMPLEMENT
protected:
ConstantVector(const VectorType *T, const std::vector<Constant*> &Val);
static void destroyThis(ConstantVector*v);
friend class Value;
~ConstantVector();
public:
/// get() - Static factory methods - Return objects of the specified value
static Constant *get(const VectorType *T, const std::vector<Constant*> &);
@ -479,10 +462,7 @@ protected:
explicit ConstantPointerNull(const PointerType *T)
: Constant(reinterpret_cast<const Type*>(T),
Value::ConstantPointerNullVal, 0, 0) {}
static void destroyThis(ConstantPointerNull*v) {
Constant::destroyThis(v);
}
friend class Value;
public:
/// get() - Static factory methods - Return objects of the specified value
@ -544,10 +524,6 @@ protected:
static Constant *getShuffleVectorTy(const Type *Ty, Constant *V1,
Constant *V2, Constant *Mask);
static void destroyThis(ConstantExpr* v) {
Constant::destroyThis(v);
}
friend class Value;
public:
// Static methods to construct a ConstantExpr of different kinds. Note that
// these methods may return a object that is not an instance of the
@ -733,10 +709,6 @@ class UndefValue : public Constant {
UndefValue(const UndefValue &); // DO NOT IMPLEMENT
protected:
explicit UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
static void destroyThis(UndefValue*v) {
Constant::destroyThis(v);
}
friend class Value;
public:
/// get() - Static factory methods - Return an 'undef' object of the specified
/// type.
@ -756,120 +728,6 @@ public:
}
};
/// GetElementPtrConstantExpr - Helper class for Constants.cpp,
/// used behind the scenes to implement getelementpr constant exprs.
class GetElementPtrConstantExpr : public ConstantExpr {
protected:
static void destroyThis(GetElementPtrConstantExpr*v) {
delete [] v->OperandList;
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
const Type *DestTy);
};
/// UnaryConstantExpr - Helper class for Constants.cpp, used
/// behind the scenes to implement unary constant exprs.
class UnaryConstantExpr : public ConstantExpr {
Use Op;
protected:
static void destroyThis(UnaryConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
UnaryConstantExpr(unsigned Opcode, Constant *C, const Type *Ty);
};
/// BinaryConstantExpr - Helper class for Constants.cpp, used
/// behind the scenes to implement binary constant exprs.
class BinaryConstantExpr : public ConstantExpr {
Use Ops[2];
protected:
static void destroyThis(BinaryConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2)
: ConstantExpr(C1->getType(), Opcode, Ops, 2) {
Ops[0].init(C1, this);
Ops[1].init(C2, this);
}
};
/// SelectConstantExpr - Helper class for Constants.cpp, used
/// behind the scenes to implement select constant exprs.
class SelectConstantExpr : public ConstantExpr {
Use Ops[3];
protected:
static void destroyThis(SelectConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3);
};
/// ExtractElementConstantExpr - Helper class for Constants.cpp, used
/// behind the scenes to implement extractelement constant exprs.
class ExtractElementConstantExpr : public ConstantExpr {
Use Ops[2];
protected:
static void destroyThis(ExtractElementConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
ExtractElementConstantExpr(Constant *C1, Constant *C2);
};
/// InsertElementConstantExpr - Helper class for Constants.cpp, used
/// behind the scenes to implement insertelement constant exprs.
class InsertElementConstantExpr : public ConstantExpr {
Use Ops[3];
protected:
static void destroyThis(InsertElementConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3);
};
/// ShuffleVectorConstantExpr - Helper class for Constants.cpp, used
/// behind the scenes to implement shufflevector constant exprs.
class ShuffleVectorConstantExpr : public ConstantExpr {
Use Ops[3];
protected:
static void destroyThis(ShuffleVectorConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3);
};
// CompareConstantExpr - Helper class for Constants.cpp, used
// behind the scenes to implement ICmp and FCmp constant expressions. This is
// needed in order to store the predicate value for these instructions.
class CompareConstantExpr : public ConstantExpr {
protected:
static void destroyThis(CompareConstantExpr*v) {
ConstantExpr::destroyThis(v);
}
friend class Value;
public:
unsigned short predicate;
Use Ops[2];
CompareConstantExpr(unsigned opc, unsigned short pred,
Constant* LHS, Constant* RHS);
};
} // End llvm namespace
#endif