add a new Type::getIntegralTypeMask() method, which is useful for clients that

want to do bitwise inspection of integer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26032 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-02-07 06:17:10 +00:00
parent 8c9191c644
commit ab0e04c2f2
3 changed files with 9 additions and 2 deletions

View File

@ -22,7 +22,6 @@
#include "llvm/Constant.h"
#include "llvm/Type.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {

View File

@ -19,7 +19,6 @@
#define LLVM_DERIVED_TYPES_H
#include "llvm/Type.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {

View File

@ -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 @@ 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