diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-11-15 03:02:41 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-11-15 03:02:41 +0000 |
commit | 30d8e29db8f179b06f09d6e75df537fb928e700d (patch) | |
tree | 01797f35652db2ccbb54f4daf74f3ad80d74a65b | |
parent | f8e07f448a241789ff987179d67fd7c87d844ee8 (diff) |
Add a method to get the bit width of a packed type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31750 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/DerivedTypes.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index e83679d046..13344ba5a3 100644 --- a/include/llvm/DerivedTypes.h +++ b/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); |