mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Fix ConstantUInt::isAllOnesValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4f98c56936
commit
1680312867
@ -134,7 +134,6 @@ public:
|
|||||||
/// isNullValue - Return true if this is the value that would be returned by
|
/// isNullValue - Return true if this is the value that would be returned by
|
||||||
/// getNullValue.
|
/// getNullValue.
|
||||||
virtual bool isNullValue() const { return Val.Unsigned == 0; }
|
virtual bool isNullValue() const { return Val.Unsigned == 0; }
|
||||||
virtual bool isAllOnesValue() const { return Val.Signed == -1; }
|
|
||||||
virtual bool isMaxValue() const = 0;
|
virtual bool isMaxValue() const = 0;
|
||||||
virtual bool isMinValue() const = 0;
|
virtual bool isMinValue() const = 0;
|
||||||
|
|
||||||
@ -165,6 +164,8 @@ public:
|
|||||||
/// getValue - return the underlying value of this constant.
|
/// getValue - return the underlying value of this constant.
|
||||||
inline int64_t getValue() const { return Val.Signed; }
|
inline int64_t getValue() const { return Val.Signed; }
|
||||||
|
|
||||||
|
virtual bool isAllOnesValue() const { return getValue() == -1; }
|
||||||
|
|
||||||
/// isMaxValue - Return true if this is the largest value that may be
|
/// isMaxValue - Return true if this is the largest value that may be
|
||||||
/// represented by this type.
|
/// represented by this type.
|
||||||
///
|
///
|
||||||
@ -214,6 +215,7 @@ public:
|
|||||||
/// isMaxValue - Return true if this is the largest value that may be
|
/// isMaxValue - Return true if this is the largest value that may be
|
||||||
/// represented by this type.
|
/// represented by this type.
|
||||||
///
|
///
|
||||||
|
virtual bool isAllOnesValue() const;
|
||||||
virtual bool isMaxValue() const { return isAllOnesValue(); }
|
virtual bool isMaxValue() const { return isAllOnesValue(); }
|
||||||
virtual bool isMinValue() const { return getValue() == 0; }
|
virtual bool isMinValue() const { return getValue() == 0; }
|
||||||
|
|
||||||
|
@ -173,6 +173,13 @@ ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConstantUInt::isAllOnesValue() const {
|
||||||
|
unsigned TypeBits = getType()->getPrimitiveSize()*8;
|
||||||
|
uint64_t Val = ~0ULL; // All ones
|
||||||
|
Val >>= 64-TypeBits; // Shift out inappropriate bits
|
||||||
|
return getValue() == Val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ConstantXXX Classes
|
// ConstantXXX Classes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user