LLVM: llvm::ConstantFPRange Class Reference (original) (raw)
This class represents a range of floating-point values. More...
#include "[llvm/IR/ConstantFPRange.h](ConstantFPRange%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| LLVM_ABI | ConstantFPRange (const APFloat &Value) |
| Initialize a range to hold the single specified value. | |
| LLVM_ABI | ConstantFPRange (APFloat LowerVal, APFloat UpperVal, bool MayBeQNaN, bool MayBeSNaN) |
| Initialize a range of values explicitly. | |
| LLVM_ABI bool | fcmp (FCmpInst::Predicate Pred, const ConstantFPRange &Other) const |
| Does the predicate Pred hold between ranges this and Other? | |
| const APFloat & | getLower () const |
| Return the lower value for this range. | |
| const APFloat & | getUpper () const |
| Return the upper value for this range. | |
| bool | containsNaN () const |
| bool | containsQNaN () const |
| bool | containsSNaN () const |
| LLVM_ABI bool | isNaNOnly () const |
| const fltSemantics & | getSemantics () const |
| Get the semantics of this ConstantFPRange. | |
| LLVM_ABI bool | isFullSet () const |
| Return true if this set contains all of the elements possible for this data-type. | |
| LLVM_ABI bool | isEmptySet () const |
| Return true if this set contains no members. | |
| LLVM_ABI bool | contains (const APFloat &Val) const |
| Return true if the specified value is in the set. | |
| LLVM_ABI bool | contains (const ConstantFPRange &CR) const |
| Return true if the other range is a subset of this one. | |
| LLVM_ABI const APFloat * | getSingleElement (bool ExcludesNaN=false) const |
| If this set contains a single element, return it, otherwise return null. | |
| bool | isSingleElement (bool ExcludesNaN=false) const |
| Return true if this set contains exactly one member. | |
| LLVM_ABI std::optional< bool > | getSignBit () const |
| Return true if the sign bit of all values in this range is 1. | |
| LLVM_ABI bool | operator== (const ConstantFPRange &CR) const |
| Return true if this range is equal to another range. | |
| bool | operator!= (const ConstantFPRange &CR) const |
| Return true if this range is not equal to another range. | |
| LLVM_ABI FPClassTest | classify () const |
| Return the FPClassTest which will return true for the value. | |
| LLVM_ABI void | print (raw_ostream &OS) const |
| Print out the bounds to a stream. | |
| LLVM_ABI void | dump () const |
| Allow printing from a debugger easily. | |
| LLVM_ABI ConstantFPRange | intersectWith (const ConstantFPRange &CR) const |
| Return the range that results from the intersection of this range with another range. | |
| LLVM_ABI ConstantFPRange | unionWith (const ConstantFPRange &CR) const |
| Return the smallest range that results from the union of this range with another range. | |
| LLVM_ABI ConstantFPRange | abs () const |
| Calculate absolute value range. | |
| LLVM_ABI ConstantFPRange | negate () const |
| Calculate range of negated values. | |
| ConstantFPRange | getWithoutNaN () const |
| Get the range without NaNs. | |
| LLVM_ABI ConstantFPRange | getWithoutInf () const |
| Get the range without infinities. | |
| LLVM_ABI ConstantFPRange | cast (const fltSemantics &DstSem, APFloat::roundingMode RM=APFloat::rmNearestTiesToEven) const |
| Return a new range in the specified format with the specified rounding mode. | |
| LLVM_ABI ConstantFPRange | add (const ConstantFPRange &Other) const |
| Return a new range representing the possible values resulting from an addition of a value in this range and a value in Other. | |
| LLVM_ABI ConstantFPRange | sub (const ConstantFPRange &Other) const |
| Return a new range representing the possible values resulting from a subtraction of a value in this range and a value in Other. | |
| LLVM_ABI ConstantFPRange | mul (const ConstantFPRange &Other) const |
| Return a new range representing the possible values resulting from a multiplication of a value in this range and a value in Other. | |
| LLVM_ABI ConstantFPRange | div (const ConstantFPRange &Other) const |
| Return a new range representing the possible values resulting from a division of a value in this range and a value in Other. | |
| LLVM_ABI void | flushDenormals (DenormalMode::DenormalModeKind Mode) |
| Flush denormal values to zero according to the specified mode. |
| Static Public Member Functions | |
|---|---|
| static ConstantFPRange | getEmpty (const fltSemantics &Sem) |
| Create empty constant range with the given semantics. | |
| static ConstantFPRange | getFull (const fltSemantics &Sem) |
| Create full constant range with the given semantics. | |
| static LLVM_ABI ConstantFPRange | getFinite (const fltSemantics &Sem) |
| Helper for (-inf, inf) to represent all finite values. | |
| static LLVM_ABI ConstantFPRange | getNonNaN (const fltSemantics &Sem) |
| Helper for [-inf, inf] to represent all non-NaN values. | |
| static ConstantFPRange | getNonNaN (APFloat LowerVal, APFloat UpperVal) |
| Create a range which doesn't contain NaNs. | |
| static ConstantFPRange | getMayBeNaN (APFloat LowerVal, APFloat UpperVal) |
| Create a range which may contain NaNs. | |
| static LLVM_ABI ConstantFPRange | getNaNOnly (const fltSemantics &Sem, bool MayBeQNaN, bool MayBeSNaN) |
| Create a range which only contains NaNs. | |
| static LLVM_ABI ConstantFPRange | makeAllowedFCmpRegion (FCmpInst::Predicate Pred, const ConstantFPRange &Other) |
| Produce the smallest range such that all values that may satisfy the given predicate with any value contained within Other is contained in the returned range. | |
| static LLVM_ABI ConstantFPRange | makeSatisfyingFCmpRegion (FCmpInst::Predicate Pred, const ConstantFPRange &Other) |
| Produce the largest range such that all values in the returned range satisfy the given predicate with all values contained within Other. | |
| static LLVM_ABI std::optional< ConstantFPRange > | makeExactFCmpRegion (FCmpInst::Predicate Pred, const APFloat &Other) |
| Produce the exact range such that all values in the returned range satisfy the given predicate with any value contained within Other. |
This class represents a range of floating-point values.
Definition at line 37 of file ConstantFPRange.h.
| ConstantFPRange::ConstantFPRange ( const APFloat & Value) | explicit |
|---|
◆ ConstantFPRange() [2/2]
◆ abs()
◆ add()
◆ cast()
◆ classify()
◆ contains() [1/2]
◆ contains() [2/2]
◆ containsNaN()
| bool llvm::ConstantFPRange::containsNaN ( ) const | inline |
|---|
◆ containsQNaN()
| bool llvm::ConstantFPRange::containsQNaN ( ) const | inline |
|---|
◆ containsSNaN()
| bool llvm::ConstantFPRange::containsSNaN ( ) const | inline |
|---|
◆ div()
Return a new range representing the possible values resulting from a division of a value in this range and a value in Other.
Definition at line 614 of file ConstantFPRange.cpp.
References assert(), llvm::APFloat::getInf(), getNaNOnly(), getSemantics(), llvm::APFloat::getSmallest(), llvm::APFloat::getZero(), isEmptySet(), isNaNOnly(), llvm::maxnum(), llvm::minnum(), llvm::Other, and splitPosNeg().
◆ dump()
◆ fcmp()
◆ flushDenormals()
Flush denormal values to zero according to the specified mode.
For dynamic mode, we return the union of all possible results.
Definition at line 511 of file ConstantFPRange.cpp.
References assert(), classify(), llvm::fcNegSubnormal, llvm::fcPosSubnormal, llvm::fcSubnormal, getSemantics(), llvm::APFloat::getZero(), llvm::DenormalMode::IEEE, llvm::maxnum(), llvm::minnum(), llvm::DenormalMode::PositiveZero, and llvm::DenormalMode::PreserveSign.
◆ getEmpty()
Create empty constant range with the given semantics.
Definition at line 69 of file ConstantFPRange.h.
◆ getFinite()
◆ getFull()
Create full constant range with the given semantics.
Definition at line 74 of file ConstantFPRange.h.
◆ getLower()
| const APFloat & llvm::ConstantFPRange::getLower ( ) const | inline |
|---|
◆ getMayBeNaN()
◆ getNaNOnly()
◆ getNonNaN() [1/2]
◆ getNonNaN() [2/2]
◆ getSemantics()
Get the semantics of this ConstantFPRange.
Definition at line 150 of file ConstantFPRange.h.
Referenced by abs(), add(), ConstantFPRange(), contains(), contains(), div(), flushDenormals(), intersectWith(), mul(), operator==(), and unionWith().
◆ getSignBit()
| std::optional< bool > ConstantFPRange::getSignBit | ( | ) | const |
|---|
Return true if the sign bit of all values in this range is 1.
Return false if the sign bit of all values in this range is 0. Otherwise, return std::nullopt.
Definition at line 323 of file ConstantFPRange.cpp.
◆ getSingleElement()
| const APFloat * ConstantFPRange::getSingleElement | ( | bool | ExcludesNaN = false | ) | const |
|---|
◆ getUpper()
| const APFloat & llvm::ConstantFPRange::getUpper ( ) const | inline |
|---|
◆ getWithoutInf()
◆ getWithoutNaN()
Get the range without NaNs.
It is useful when we apply nnan flag to range of operands/results.
Definition at line 212 of file ConstantFPRange.h.
◆ intersectWith()
◆ isEmptySet()
| bool ConstantFPRange::isEmptySet | ( | ) | const |
|---|
◆ isFullSet()
| bool ConstantFPRange::isFullSet | ( | ) | const |
|---|
Return true if this set contains all of the elements possible for this data-type.
Definition at line 283 of file ConstantFPRange.cpp.
Referenced by print().
◆ isNaNOnly()
| bool ConstantFPRange::isNaNOnly | ( | ) | const |
|---|
◆ isSingleElement()
| bool llvm::ConstantFPRange::isSingleElement ( bool ExcludesNaN = false) const | inline |
|---|
Return true if this set contains exactly one member.
If ExcludesNaN is true, return true if this set contains exactly one non-NaN member.
Definition at line 172 of file ConstantFPRange.h.
References getSingleElement().
◆ makeAllowedFCmpRegion()
Produce the smallest range such that all values that may satisfy the given predicate with any value contained within Other is contained in the returned range.
Formally, this returns a superset of 'union over all y in Other . { x : fcmp op x y is true }'. If the exact answer is not representable as a ConstantFPRange, the return value will be a proper superset of the above.
Example: Pred = ole and Other = float [2, 5] returns Result = [-inf, 5]
Definition at line 165 of file ConstantFPRange.cpp.
References extendZeroIfEqual(), llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::APFloat::getInf(), llvm::APFloat::getLargest(), getNaNOnly(), getNonNaN(), llvm::CmpInst::isOrdered(), llvm::CmpInst::isUnordered(), llvm_unreachable, makeGreaterThan(), makeLessThan(), llvm::Other, and setNaNField().
◆ makeExactFCmpRegion()
◆ makeSatisfyingFCmpRegion()
Produce the largest range such that all values in the returned range satisfy the given predicate with all values contained within Other.
Formally, this returns a subset of 'intersection over all y in Other . { x : fcmp op x y is true }'. If the exact answer is not representable as a ConstantFPRange, the return value will be a proper subset of the above.
Example: Pred = ole and Other = float [2, 5] returns [-inf, 2]
Definition at line 223 of file ConstantFPRange.cpp.
References extendZeroIfEqual(), llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::fcNan, llvm::fcZero, getNaNOnly(), getNonNaN(), llvm::CmpInst::isOrdered(), llvm::CmpInst::isUnordered(), llvm_unreachable, makeGreaterThan(), makeLessThan(), llvm::Other, and setNaNField().
Referenced by fcmp(), and makeExactFCmpRegion().
◆ mul()
◆ negate()
◆ operator!=()
◆ operator==()
◆ print()
◆ sub()
Return a new range representing the possible values resulting from a subtraction of a value in this range and a value in Other.
Definition at line 506 of file ConstantFPRange.cpp.
References add(), and llvm::Other.
◆ unionWith()
The documentation for this class was generated from the following files:
- include/llvm/IR/ConstantFPRange.h
- lib/IR/ConstantFPRange.cpp