correct the type of two intrinsics, add int_ppc_altivec_vmladduhm
[oota-llvm.git] / include / llvm / Type.h
index 0482d127bc28899fb4173077e1ac89bb5f40bd02..d507dd6a837292ef77209b583c77f4a9c1137011 100644 (file)
@@ -34,8 +34,9 @@
 #ifndef LLVM_TYPE_H
 #define LLVM_TYPE_H
 
-#include "AbstractTypeUser.h"
+#include "llvm/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 @@ public:
   /// 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