From 8f73ba7e05eca88428557087307f02f708c410ab Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 15 Nov 2006 03:02:41 +0000 Subject: [PATCH] Add a method to get the bit width of a packed type. llvm-svn: 31750 --- llvm/include/llvm/DerivedTypes.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/include/llvm/DerivedTypes.h b/llvm/include/llvm/DerivedTypes.h index e83679d04685..13344ba5a34c 100644 --- a/llvm/include/llvm/DerivedTypes.h +++ b/llvm/include/llvm/DerivedTypes.h @@ -299,8 +299,14 @@ public: /// static PackedType *get(const Type *ElementType, unsigned NumElements); + /// @brief Return the number of elements in the Packed type. inline unsigned getNumElements() const { return NumElements; } + /// @brief Return the number of bits in the Packed type. + inline unsigned getBitWidth() const { + return NumElements *getElementType()->getPrimitiveSizeInBits(); + } + // Implement the AbstractTypeUser interface. virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); virtual void typeBecameConcrete(const DerivedType *AbsTy);