aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/DerivedTypes.h6
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);