1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

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

want to do bitwise inspection of integer types.

llvm-svn: 26032
This commit is contained in:
Chris Lattner 2006-02-07 06:17:10 +00:00
parent e66383eb06
commit 0c8352628d
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