diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-01 02:25:03 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-01 02:25:03 +0000 |
commit | 0bfd44918a1674a6e600cf58b8252930b793f61a (patch) | |
tree | 9694bd9f3c5eb0d3e56423f5f23ebc7a6452d773 | |
parent | a3756ee7fe384210eddcfd66e2934439960b13a1 (diff) | |
download | external_llvm-0bfd44918a1674a6e600cf58b8252930b793f61a.zip external_llvm-0bfd44918a1674a6e600cf58b8252930b793f61a.tar.gz external_llvm-0bfd44918a1674a6e600cf58b8252930b793f61a.tar.bz2 |
Add an IntegerType::getMask() method to get an APInt mask for the type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34771 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/DerivedTypes.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 08a7aef..13e127a 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -19,6 +19,7 @@ #define LLVM_DERIVED_TYPES_H #include "llvm/Type.h" +#include "llvm/ADT/APInt.h" namespace llvm { @@ -108,6 +109,13 @@ public: return ~uint64_t(0UL) >> (64-getPrimitiveSizeInBits()); } + /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc. + /// @returns a bit mask with ones set for all the bits of this type. + /// @brief Get a bit mask for this type. + APInt getMask() const { + return APInt::getAllOnesValue(getBitWidth()); + } + /// This method determines if the width of this IntegerType is a power-of-2 /// in terms of 8 bit bytes. /// @returns true if this is a power-of-2 byte width. |