mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-16 08:08:01 +00:00
add CFP::isNegative() and ConstnatInt::isNegative() methods.
Devirtualize the isNegativeZeroValue method. llvm-svn: 135249
This commit is contained in:
parent
20c6e388ef
commit
e99d93799f
@ -54,7 +54,7 @@ public:
|
||||
|
||||
/// isNegativeZeroValue - Return true if the value is what would be returned
|
||||
/// by getZeroValueForNegation.
|
||||
virtual bool isNegativeZeroValue() const { return isNullValue(); }
|
||||
bool isNegativeZeroValue() const;
|
||||
|
||||
/// canTrap - Return true if evaluation of this constant could trap. This is
|
||||
/// true for things like constant expressions that could divide by zero.
|
||||
|
@ -157,6 +157,8 @@ public:
|
||||
return Val == 0;
|
||||
}
|
||||
|
||||
bool isNegative() const { return Val.isNegative(); }
|
||||
|
||||
/// This is just a convenience method to make client code smaller for a
|
||||
/// common code. It also correctly performs the comparison without the
|
||||
/// potential for an assertion from getZExtValue().
|
||||
@ -270,15 +272,12 @@ public:
|
||||
/// two the same, use isZero().
|
||||
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.
|
||||
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.
|
||||
bool isNaN() const { return Val.isNaN(); }
|
||||
|
||||
|
@ -40,6 +40,15 @@ using namespace llvm;
|
||||
// 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...
|
||||
Constant *Constant::getNullValue(const Type *Ty) {
|
||||
switch (Ty->getTypeID()) {
|
||||
|
Loading…
Reference in New Issue
Block a user