summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-11-15 03:02:41 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-11-15 03:02:41 +0000
commit8f73ba7e05eca88428557087307f02f708c410ab (patch)
treefebc8a059f3f933102ca6ed6db3837184044bc65
parent1396961e85b6423773097ead0cace12038147980 (diff)
downloadbcm5719-llvm-8f73ba7e05eca88428557087307f02f708c410ab.tar.gz
bcm5719-llvm-8f73ba7e05eca88428557087307f02f708c410ab.zip
Add a method to get the bit width of a packed type.
llvm-svn: 31750
-rw-r--r--llvm/include/llvm/DerivedTypes.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/include/llvm/DerivedTypes.h b/llvm/include/llvm/DerivedTypes.h
index e83679d0468..13344ba5a34 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);
OpenPOWER on IntegriCloud