summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-01 02:25:03 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-01 02:25:03 +0000
commit0f499769281f06b62ffef1c516c85d82a36b878c (patch)
tree57ab4e0ea6bbd67bd2968e40bf1a51a634f3435d /llvm
parent428eaa00590fed67877c777f86c1131608d4d61c (diff)
downloadbcm5719-llvm-0f499769281f06b62ffef1c516c85d82a36b878c.tar.gz
bcm5719-llvm-0f499769281f06b62ffef1c516c85d82a36b878c.zip
Add an IntegerType::getMask() method to get an APInt mask for the type.
llvm-svn: 34771
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/DerivedTypes.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/include/llvm/DerivedTypes.h b/llvm/include/llvm/DerivedTypes.h
index 08a7aeffe3b..13e127a612a 100644
--- a/llvm/include/llvm/DerivedTypes.h
+++ b/llvm/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.
OpenPOWER on IntegriCloud