LLVM API Documentation
#include <ConstantRange.h>
Collaboration diagram for llvm::ConstantRange:
Public Member Functions | |
ConstantRange (const Type *Ty, bool isFullSet=true) | |
ConstantRange (Constant *Value) | |
ConstantRange (Constant *Lower, Constant *Upper) | |
ConstantRange (unsigned SetCCOpcode, ConstantIntegral *C) | |
ConstantIntegral * | getLower () const |
ConstantIntegral * | getUpper () const |
const Type * | getType () const |
bool | isFullSet () const |
bool | isEmptySet () const |
bool | isWrappedSet () const |
bool | contains (ConstantInt *Val) const |
ConstantIntegral * | getSingleElement () const |
bool | isSingleElement () const |
uint64_t | getSetSize () const |
bool | operator== (const ConstantRange &CR) const |
bool | operator!= (const ConstantRange &CR) const |
ConstantRange | subtract (ConstantInt *CI) const |
ConstantRange | intersectWith (const ConstantRange &CR) const |
ConstantRange | unionWith (const ConstantRange &CR) const |
ConstantRange | zeroExtend (const Type *Ty) const |
ConstantRange | truncate (const Type *Ty) const |
void | print (std::ostream &OS) const |
void | dump () const |
Definition at line 36 of file ConstantRange.h.
ConstantRange::ConstantRange | ( | const Type * | Ty, | |
bool | isFullSet = true | |||
) |
Initialize a full (the default) or empty set for the specified type.
Definition at line 64 of file ConstantRange.cpp.
References llvm::ConstantIntegral::getMaxValue(), llvm::ConstantIntegral::getMinValue(), llvm::Type::isIntegral(), and Ty.
Referenced by intersectWith(), subtract(), truncate(), and zeroExtend().
ConstantRange::ConstantRange | ( | Constant * | Value | ) |
Initialize a range to hold the single specified value.
Definition at line 75 of file ConstantRange.cpp.
Initialize a range of values explicitly... this will assert out if Lower==Upper and Lower != Min or Max for its type, if the two constants have different types, or if the constant are not integral values.
Definition at line 83 of file ConstantRange.cpp.
References llvm::ConstantIntegral::getMaxValue(), llvm::ConstantIntegral::getMinValue(), llvm::Value::getType(), and U.
ConstantRange::ConstantRange | ( | unsigned | SetCCOpcode, | |
ConstantIntegral * | C | |||
) |
Initialize a set of values that all satisfy the condition with C.
Definition at line 96 of file ConstantRange.cpp.
References C, llvm::ConstantIntegral::getMinValue(), and Next.
ConstantIntegral* llvm::ConstantRange::getLower | ( | ) | const [inline] |
getLower - Return the lower value for this range...
Definition at line 59 of file ConstantRange.h.
Referenced by intersect1Wrapped(), truncate(), and zeroExtend().
ConstantIntegral* llvm::ConstantRange::getUpper | ( | ) | const [inline] |
getUpper - Return the upper value for this range...
Definition at line 63 of file ConstantRange.h.
Referenced by llvm::SCEVAddRecExpr::getNumIterationsInRange(), intersect1Wrapped(), truncate(), and zeroExtend().
const Type * ConstantRange::getType | ( | ) | const |
getType - Return the LLVM data type of this range.
Definition at line 122 of file ConstantRange.cpp.
References llvm::Value::getType().
Referenced by getSetSize(), intersect1Wrapped(), intersectWith(), isEmptySet(), isFullSet(), subtract(), truncate(), unionWith(), and zeroExtend().
bool ConstantRange::isFullSet | ( | ) | const |
isFullSet - Return true if this set contains all of the elements possible for this data-type
Definition at line 126 of file ConstantRange.cpp.
References llvm::ConstantIntegral::getMaxValue(), and getType().
Referenced by contains(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), intersectWith(), llvm::ScalarEvolution::print(), truncate(), and zeroExtend().
bool ConstantRange::isEmptySet | ( | ) | const |
isEmptySet - Return true if this set contains no members.
Definition at line 132 of file ConstantRange.cpp.
References llvm::ConstantIntegral::getMinValue(), and getType().
Referenced by getSetSize(), and intersectWith().
bool ConstantRange::isWrappedSet | ( | ) | const |
isWrappedSet - Return true if this set wraps around the top of the range, for example: [100, 8)
Definition at line 139 of file ConstantRange.cpp.
References GT().
Referenced by contains(), intersect1Wrapped(), and intersectWith().
bool ConstantRange::contains | ( | ConstantInt * | Val | ) | const |
contains - Return true if the specified value is in the set.
Definition at line 169 of file ConstantRange.cpp.
References isFullSet(), isWrappedSet(), LT(), LTE(), and Val.
Referenced by llvm::SCEVAddRecExpr::getNumIterationsInRange().
ConstantIntegral * ConstantRange::getSingleElement | ( | ) | const |
getSingleElement - If this set contains a single element, return it, otherwise return null.
Definition at line 146 of file ConstantRange.cpp.
References Next.
Referenced by isSingleElement().
bool llvm::ConstantRange::isSingleElement | ( | ) | const [inline] |
isSingleElement - Return true if this set contains exactly one member.
Definition at line 94 of file ConstantRange.h.
References getSingleElement().
uint64_t ConstantRange::getSetSize | ( | ) | const |
getSetSize - Return the number of elements in this set.
Definition at line 154 of file ConstantRange.cpp.
References llvm::Type::BoolTy, llvm::ConstantExpr::getSub(), getType(), and isEmptySet().
Referenced by intersect1Wrapped(), and truncate().
bool llvm::ConstantRange::operator== | ( | const ConstantRange & | CR | ) | const [inline] |
operator== - Return true if this range is equal to another range.
Definition at line 102 of file ConstantRange.h.
Referenced by operator!=().
bool llvm::ConstantRange::operator!= | ( | const ConstantRange & | CR | ) | const [inline] |
ConstantRange ConstantRange::subtract | ( | ConstantInt * | CI | ) | const |
subtract - Subtract the specified constant from the endpoints of this constant range.
Definition at line 184 of file ConstantRange.cpp.
References ConstantRange(), llvm::ConstantExpr::getSub(), getType(), llvm::Value::getType(), and llvm::Type::isInteger().
Referenced by llvm::SCEVAddRecExpr::getNumIterationsInRange().
ConstantRange ConstantRange::intersectWith | ( | const ConstantRange & | CR | ) | const |
intersect - Return the range that results from the intersection of this range with another range. The resultant range is pruned as much as possible, but there may be cases where elements are included that are in one of the sets but not the other. For example: [100, 8) intersect [3, 120) yields [3, 120)
Definition at line 236 of file ConstantRange.cpp.
References ConstantRange(), getType(), intersect1Wrapped(), isEmptySet(), isFullSet(), isWrappedSet(), Lower, LT(), Max(), Min(), U, and Upper.
ConstantRange ConstantRange::unionWith | ( | const ConstantRange & | CR | ) | const |
union - Return the range that results from the union of this range with another range. The resultant range is guaranteed to include the elements of both sets, but may contain more. For example, [3, 9) union [12,15) is [3, 15), which includes 9, 10, and 11, which were not included in either set before.
Definition at line 272 of file ConstantRange.cpp.
References getType().
ConstantRange ConstantRange::zeroExtend | ( | const Type * | Ty | ) | const |
zeroExtend - Return a new range in the specified integer type, which must be strictly larger than the current type. The returned range will correspond to the possible range of values if the source range had been zero extended.
Definition at line 284 of file ConstantRange.cpp.
References ConstantRange(), llvm::ConstantUInt::get(), llvm::ConstantExpr::getCast(), getLower(), llvm::Constant::getNullValue(), llvm::Type::getPrimitiveSize(), llvm::Value::getType(), getType(), llvm::Type::getUnsignedVersion(), getUpper(), isFullSet(), llvm::Type::isInteger(), llvm::Type::isUnsigned(), and Ty.
ConstantRange ConstantRange::truncate | ( | const Type * | Ty | ) | const |
truncate - Return a new range in the specified integer type, which must be strictly smaller than the current type. The returned range will correspond to the possible range of values if the source range had been truncated to the specified type.
Definition at line 310 of file ConstantRange.cpp.
References ConstantRange(), llvm::ConstantExpr::getCast(), getLower(), llvm::Type::getPrimitiveSize(), getSetSize(), getType(), getUpper(), isFullSet(), and Ty.
void ConstantRange::print | ( | std::ostream & | OS | ) | const |
print - Print out the bounds to a stream...
Definition at line 324 of file ConstantRange.cpp.
Referenced by dump(), and llvm::operator<<().
void ConstantRange::dump | ( | ) | const |
dump - Allow printing from a debugger easily...
Definition at line 330 of file ConstantRange.cpp.
References print().