mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-23 11:38:38 +00:00
Add getter methods for the extremes of a ConstantRange.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35056 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c1fb0473ed
commit
3400e6af6b
@ -102,6 +102,26 @@ class ConstantRange {
|
|||||||
///
|
///
|
||||||
APInt getSetSize() const;
|
APInt getSetSize() const;
|
||||||
|
|
||||||
|
/// getUnsignedMax - Return the largest unsigned value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt getUnsignedMax() const;
|
||||||
|
|
||||||
|
/// getUnsignedMin - Return the smallest unsigned value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt getUnsignedMin() const;
|
||||||
|
|
||||||
|
/// getSignedMax - Return the largest signed value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt getSignedMax() const;
|
||||||
|
|
||||||
|
/// getSignedMin - Return the smallest signed value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt getSignedMin() const;
|
||||||
|
|
||||||
/// operator== - Return true if this range is equal to another range.
|
/// operator== - Return true if this range is equal to another range.
|
||||||
///
|
///
|
||||||
bool operator==(const ConstantRange &CR) const {
|
bool operator==(const ConstantRange &CR) const {
|
||||||
|
@ -84,6 +84,70 @@ APInt ConstantRange::getSetSize() const {
|
|||||||
return Upper - Lower;
|
return Upper - Lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getUnsignedMax - Return the largest unsigned value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt ConstantRange::getUnsignedMax() const {
|
||||||
|
if (isFullSet() || isWrappedSet())
|
||||||
|
return APInt::getMaxValue(getBitWidth());
|
||||||
|
else
|
||||||
|
return getUpper() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// getUnsignedMin - Return the smallest unsigned value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt ConstantRange::getUnsignedMin() const {
|
||||||
|
if (isFullSet() || (isWrappedSet() && getUpper() != 0))
|
||||||
|
return APInt::getMinValue(getBitWidth());
|
||||||
|
else
|
||||||
|
return getLower();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// getSignedMax - Return the largest signed value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt ConstantRange::getSignedMax() const {
|
||||||
|
APInt SignedMax = APInt::getSignedMaxValue(getBitWidth());
|
||||||
|
if (!isWrappedSet()) {
|
||||||
|
if (getLower().slt(getUpper() - 1))
|
||||||
|
return getUpper() - 1;
|
||||||
|
else
|
||||||
|
return SignedMax;
|
||||||
|
} else {
|
||||||
|
if ((getUpper() - 1).slt(getLower())) {
|
||||||
|
if (getLower() != SignedMax)
|
||||||
|
return SignedMax;
|
||||||
|
else
|
||||||
|
return getUpper() - 1;
|
||||||
|
} else {
|
||||||
|
return getUpper() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// getSignedMin - Return the smallest signed value contained in the
|
||||||
|
/// ConstantRange.
|
||||||
|
///
|
||||||
|
APInt ConstantRange::getSignedMin() const {
|
||||||
|
APInt SignedMin = APInt::getSignedMinValue(getBitWidth());
|
||||||
|
if (!isWrappedSet()) {
|
||||||
|
if (getLower().slt(getUpper() - 1))
|
||||||
|
return getLower();
|
||||||
|
else
|
||||||
|
return SignedMin;
|
||||||
|
} else {
|
||||||
|
if ((getUpper() - 1).slt(getLower())) {
|
||||||
|
if (getUpper() != SignedMin)
|
||||||
|
return SignedMin;
|
||||||
|
else
|
||||||
|
return getLower();
|
||||||
|
} else {
|
||||||
|
return getLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// contains - Return true if the specified value is in the set.
|
/// contains - Return true if the specified value is in the set.
|
||||||
///
|
///
|
||||||
bool ConstantRange::contains(const APInt &V) const {
|
bool ConstantRange::contains(const APInt &V) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user