X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FTGValueTypes.cpp;h=f4893f50a6ff86032509a8b998f4cf39e5ae33d7;hb=d92ff21d6f526cadea7d6db21f493ba5c85e1411;hp=07400cf7447b528a187f5c90f1b645a8e7539c91;hpb=8b43dbf9ead694a011944f7b33ed194d901d2313;p=oota-llvm.git diff --git a/utils/TableGen/TGValueTypes.cpp b/utils/TableGen/TGValueTypes.cpp index 07400cf7447..f4893f50a6f 100644 --- a/utils/TableGen/TGValueTypes.cpp +++ b/utils/TableGen/TGValueTypes.cpp @@ -35,11 +35,15 @@ 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() {} + } +namespace { class ExtendedIntegerType : public Type { unsigned BitWidth; public: @@ -47,8 +51,8 @@ public: : Type(TK_ExtendedIntegerType), BitWidth(bits) {} static bool classof(const Type *T) { return T->getKind() == TK_ExtendedIntegerType; - }; - unsigned getSizeInBits() const { + } + virtual unsigned getSizeInBits() const { return getBitWidth(); } unsigned getBitWidth() const { @@ -64,8 +68,8 @@ public: : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {} 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 { @@ -75,6 +79,7 @@ public: return NumElements; } }; +} // end anonymous namespace static std::map ExtendedIntegerTypeMap;