mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Provide an isPowerOf2ByteWidth method for the IntegerType class. This will
mostly be used by back ends that wish to distinguish between integer types that fit evenly within a natural integer type and those that don't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -101,6 +101,12 @@ public:
|
|||||||
/// @brief Get the number of bits in this IntegerType
|
/// @brief Get the number of bits in this IntegerType
|
||||||
unsigned getBitWidth() const { return getSubclassData(); }
|
unsigned getBitWidth() const { return getSubclassData(); }
|
||||||
|
|
||||||
|
/// 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.
|
||||||
|
/// @brief Is this a power-of-2 byte-width IntegerType ?
|
||||||
|
bool isPowerOf2ByteWidth() const;
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const IntegerType *T) { return true; }
|
static inline bool classof(const IntegerType *T) { return true; }
|
||||||
static inline bool classof(const Type *T) {
|
static inline bool classof(const Type *T) {
|
||||||
|
@@ -975,6 +975,11 @@ const IntegerType *IntegerType::get(unsigned NumBits) {
|
|||||||
return ITy;
|
return ITy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IntegerType::isPowerOf2ByteWidth() const {
|
||||||
|
unsigned BitWidth = getBitWidth();
|
||||||
|
return (BitWidth > 7 && Log2_32(BitWidth) == Log2_32_Ceil(BitWidth));
|
||||||
|
}
|
||||||
|
|
||||||
// FunctionValType - Define a class to hold the key that goes into the TypeMap
|
// FunctionValType - Define a class to hold the key that goes into the TypeMap
|
||||||
//
|
//
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
Reference in New Issue
Block a user