[weak vtables] Remove a bunch of weak vtables

This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file. The memory leaks in this version have been fixed. Thanks
Alexey for pointing them out.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Juergen Ributzka
2013-11-19 00:57:56 +00:00
parent 26efdc5621
commit 354362524a
113 changed files with 506 additions and 152 deletions

View File

@@ -35,9 +35,12 @@ public:
}
Type(TypeKind K) : Kind(K) {}
virtual unsigned getSizeInBits() const = 0;
virtual ~Type() {}
virtual ~Type();
};
// Provide out-of-line definition to prevent weak vtable.
Type::~Type() {}
}
class ExtendedIntegerType : public Type {
@@ -45,10 +48,11 @@ class ExtendedIntegerType : public Type {
public:
explicit ExtendedIntegerType(unsigned bits)
: Type(TK_ExtendedIntegerType), BitWidth(bits) {}
virtual ~ExtendedIntegerType();
static bool classof(const Type *T) {
return T->getKind() == TK_ExtendedIntegerType;
}
unsigned getSizeInBits() const {
virtual unsigned getSizeInBits() const {
return getBitWidth();
}
unsigned getBitWidth() const {
@@ -56,16 +60,20 @@ public:
}
};
// Provide out-of-line definition to prevent weak vtable.
ExtendedIntegerType::~ExtendedIntegerType() {}
class ExtendedVectorType : public Type {
EVT ElementType;
unsigned NumElements;
public:
ExtendedVectorType(EVT elty, unsigned num)
: Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
virtual ~ExtendedVectorType();
static bool classof(const Type *T) {
return T->getKind() == TK_ExtendedVectorType;
}
unsigned getSizeInBits() const {
virtual unsigned getSizeInBits() const {
return getNumElements() * getElementType().getSizeInBits();
}
EVT getElementType() const {
@@ -76,6 +84,9 @@ public:
}
};
// Provide out-of-line definition to prevent weak vtable.
ExtendedVectorType::~ExtendedVectorType() {}
static std::map<unsigned, const Type *>
ExtendedIntegerTypeMap;
static std::map<std::pair<uintptr_t, uintptr_t>, const Type *>