mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
add CFP::isNegative() and ConstnatInt::isNegative() methods.
Devirtualize the isNegativeZeroValue method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
/// isNegativeZeroValue - Return true if the value is what would be returned
|
/// isNegativeZeroValue - Return true if the value is what would be returned
|
||||||
/// by getZeroValueForNegation.
|
/// by getZeroValueForNegation.
|
||||||
virtual bool isNegativeZeroValue() const { return isNullValue(); }
|
bool isNegativeZeroValue() const;
|
||||||
|
|
||||||
/// canTrap - Return true if evaluation of this constant could trap. This is
|
/// canTrap - Return true if evaluation of this constant could trap. This is
|
||||||
/// true for things like constant expressions that could divide by zero.
|
/// true for things like constant expressions that could divide by zero.
|
||||||
|
@ -156,6 +156,8 @@ public:
|
|||||||
virtual bool isNullValue() const {
|
virtual bool isNullValue() const {
|
||||||
return Val == 0;
|
return Val == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isNegative() const { return Val.isNegative(); }
|
||||||
|
|
||||||
/// This is just a convenience method to make client code smaller for a
|
/// This is just a convenience method to make client code smaller for a
|
||||||
/// common code. It also correctly performs the comparison without the
|
/// common code. It also correctly performs the comparison without the
|
||||||
@ -263,22 +265,19 @@ public:
|
|||||||
|
|
||||||
/// isValueValidForType - return true if Ty is big enough to represent V.
|
/// isValueValidForType - return true if Ty is big enough to represent V.
|
||||||
static bool isValueValidForType(const Type *Ty, const APFloat &V);
|
static bool isValueValidForType(const Type *Ty, const APFloat &V);
|
||||||
inline const APFloat& getValueAPF() const { return Val; }
|
inline const APFloat &getValueAPF() const { return Val; }
|
||||||
|
|
||||||
/// 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. For ConstantFP, this is +0.0, but not -0.0. To handle the
|
/// getNullValue. For ConstantFP, this is +0.0, but not -0.0. To handle the
|
||||||
/// two the same, use isZero().
|
/// two the same, use isZero().
|
||||||
virtual bool isNullValue() const;
|
virtual bool isNullValue() const;
|
||||||
|
|
||||||
/// isNegativeZeroValue - Return true if the value is what would be returned
|
|
||||||
/// by getZeroValueForNegation.
|
|
||||||
virtual bool isNegativeZeroValue() const {
|
|
||||||
return Val.isZero() && Val.isNegative();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// isZero - Return true if the value is positive or negative zero.
|
/// isZero - Return true if the value is positive or negative zero.
|
||||||
bool isZero() const { return Val.isZero(); }
|
bool isZero() const { return Val.isZero(); }
|
||||||
|
|
||||||
|
/// isNegative - Return true if the sign bit is set.
|
||||||
|
bool isNegative() const { return Val.isNegative(); }
|
||||||
|
|
||||||
/// isNaN - Return true if the value is a NaN.
|
/// isNaN - Return true if the value is a NaN.
|
||||||
bool isNaN() const { return Val.isNaN(); }
|
bool isNaN() const { return Val.isNaN(); }
|
||||||
|
|
||||||
|
@ -40,6 +40,15 @@ using namespace llvm;
|
|||||||
// Constant Class
|
// Constant Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
bool Constant::isNegativeZeroValue() const {
|
||||||
|
// Floating point values have an explicit -0.0 value.
|
||||||
|
if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this))
|
||||||
|
return CFP->isZero() && CFP->isNegative();
|
||||||
|
|
||||||
|
// Otherwise, just use +0.0.
|
||||||
|
return isNullValue();
|
||||||
|
}
|
||||||
|
|
||||||
// Constructor to create a '0' constant of arbitrary type...
|
// Constructor to create a '0' constant of arbitrary type...
|
||||||
Constant *Constant::getNullValue(const Type *Ty) {
|
Constant *Constant::getNullValue(const Type *Ty) {
|
||||||
switch (Ty->getTypeID()) {
|
switch (Ty->getTypeID()) {
|
||||||
|
Reference in New Issue
Block a user