aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/TGValueTypes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen/TGValueTypes.cpp')
-rw-r--r--utils/TableGen/TGValueTypes.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/utils/TableGen/TGValueTypes.cpp b/utils/TableGen/TGValueTypes.cpp
index 3ac71a4..b0bbdf9 100644
--- a/utils/TableGen/TGValueTypes.cpp
+++ b/utils/TableGen/TGValueTypes.cpp
@@ -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 *>