[llvm-commits] CVS: llvm/include/llvm/Type.h DerivedTypes.h Constants.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 6 22:17:21 PST 2006
Changes in directory llvm/include/llvm:
Type.h updated: 1.82 -> 1.83
DerivedTypes.h updated: 1.70 -> 1.71
Constants.h updated: 1.77 -> 1.78
---
Log message:
add a new Type::getIntegralTypeMask() method, which is useful for clients that
want to do bitwise inspection of integer types.
---
Diffs of the changes: (+9 -2)
Constants.h | 1 -
DerivedTypes.h | 1 -
Type.h | 9 +++++++++
3 files changed, 9 insertions(+), 2 deletions(-)
Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.82 llvm/include/llvm/Type.h:1.83
--- llvm/include/llvm/Type.h:1.82 Mon Dec 26 02:36:53 2005
+++ llvm/include/llvm/Type.h Tue Feb 7 00:17:10 2006
@@ -36,6 +36,7 @@
#include "AbstractTypeUser.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/iterator"
#include <string>
@@ -232,6 +233,14 @@
/// getSignedVersion - If this is an integer type, return the signed variant
/// of this type. For example uint -> int.
const Type *getSignedVersion() const;
+
+ /// getIntegralTypeMask - Return a bitmask with ones set for all of the bits
+ /// that can be set by an unsigned version of this type. This is 0xFF for
+ /// sbyte/ubyte, 0xFFFF for shorts, etc.
+ uint64_t getIntegralTypeMask() const {
+ assert(isIntegral() && "This only works for integral types!");
+ return ~0ULL >> (64-getPrimitiveSizeInBits());
+ }
/// getForwaredType - Return the type that this type has been resolved to if
/// it has been resolved to anything. This is used to implement the
Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.70 llvm/include/llvm/DerivedTypes.h:1.71
--- llvm/include/llvm/DerivedTypes.h:1.70 Sat Nov 12 21:26:12 2005
+++ llvm/include/llvm/DerivedTypes.h Tue Feb 7 00:17:10 2006
@@ -19,7 +19,6 @@
#define LLVM_DERIVED_TYPES_H
#include "llvm/Type.h"
-#include "llvm/Support/DataTypes.h"
namespace llvm {
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.77 llvm/include/llvm/Constants.h:1.78
--- llvm/include/llvm/Constants.h:1.77 Tue Jan 17 14:05:59 2006
+++ llvm/include/llvm/Constants.h Tue Feb 7 00:17:10 2006
@@ -22,7 +22,6 @@
#include "llvm/Constant.h"
#include "llvm/Type.h"
-#include "llvm/Support/DataTypes.h"
namespace llvm {
More information about the llvm-commits
mailing list