MLIR
18.0.0git
|
Typedefs | |
using | InferRangeFn = function_ref< ConstantIntRanges(ArrayRef< ConstantIntRanges >)> |
Function that performs inference on an array of ConstantIntRanges , abstracted away here to permit writing the function that handles both 64- and 32-bit index types. More... | |
Enumerations | |
enum class | CmpMode : uint32_t { Both , Signed , Unsigned } |
enum class | CmpPredicate : uint64_t { eq , ne , slt , sle , sgt , sge , ult , ule , ugt , uge } |
Copy of the enum from arith and index to allow the common integer range infrastructure to not depend on either dialect. More... | |
Variables | |
static constexpr unsigned | indexMinWidth = 32 |
static constexpr unsigned | indexMaxWidth = 64 |
using mlir::intrange::InferRangeFn = typedef function_ref<ConstantIntRanges(ArrayRef<ConstantIntRanges>)> |
Function that performs inference on an array of ConstantIntRanges
, abstracted away here to permit writing the function that handles both 64- and 32-bit index types.
Definition at line 26 of file InferIntRangeCommon.h.
|
strong |
Enumerator | |
---|---|
Both | |
Signed | |
Unsigned |
Definition at line 32 of file InferIntRangeCommon.h.
|
strong |
Copy of the enum from arith
and index
to allow the common integer range infrastructure to not depend on either dialect.
Enumerator | |
---|---|
eq | |
ne | |
slt | |
sle | |
sgt | |
sge | |
ult | |
ule | |
ugt | |
uge |
Definition at line 105 of file InferIntRangeCommon.h.
std::optional< bool > mlir::intrange::evaluatePred | ( | CmpPredicate | pred, |
const ConstantIntRanges & | lhs, | ||
const ConstantIntRanges & | rhs | ||
) |
Returns a boolean value if pred
is statically true or false for anypossible inputs falling within lhs
and rhs
, and std::nullopt if the value of the predicate cannot be determined.
Definition at line 655 of file InferIntRangeCommon.cpp.
References invertPredicate(), and isStaticallyTrue().
ConstantIntRanges mlir::intrange::extRange | ( | const ConstantIntRanges & | range, |
unsigned | destWidth | ||
) |
Independently zero-extend the unsigned values and sign-extend the signed values in range
to destWidth
bits, returning the resulting range.
Referenced by inferIndexCast(), and inferIndexOp().
ConstantIntRanges mlir::intrange::extSIRange | ( | const ConstantIntRanges & | range, |
unsigned | destWidth | ||
) |
Use the signed values in range
to sign-extend it to destWidth
.
Definition at line 133 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromSigned(), mlir::ConstantIntRanges::smax(), and mlir::ConstantIntRanges::smin().
Referenced by makeLikeDest().
ConstantIntRanges mlir::intrange::extUIRange | ( | const ConstantIntRanges & | range, |
unsigned | destWidth | ||
) |
Use the unsigned values in range
to zero-extend it to destWidth
.
Definition at line 126 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromUnsigned(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
Referenced by makeLikeDest().
ConstantIntRanges mlir::intrange::inferAdd | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 181 of file InferIntRangeCommon.cpp.
References computeBoundsBy(), mlir::ConstantIntRanges::intersection(), mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferAnd | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 508 of file InferIntRangeCommon.cpp.
References minMaxBy(), and widenBitwiseBounds().
ConstantIntRanges mlir::intrange::inferCeilDivS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 344 of file InferIntRangeCommon.cpp.
References inferDivSRange().
ConstantIntRanges mlir::intrange::inferCeilDivU | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 295 of file InferIntRangeCommon.cpp.
References inferDivURange().
ConstantIntRanges mlir::intrange::inferDivS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 337 of file InferIntRangeCommon.cpp.
References inferDivSRange().
ConstantIntRanges mlir::intrange::inferDivU | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 288 of file InferIntRangeCommon.cpp.
References inferDivURange().
ConstantIntRanges mlir::intrange::inferFloorDivS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 362 of file InferIntRangeCommon.cpp.
References inferDivSRange().
ConstantIntRanges mlir::intrange::inferIndexOp | ( | InferRangeFn | inferFn, |
ArrayRef< ConstantIntRanges > | argRanges, | ||
intrange::CmpMode | mode | ||
) |
Compute inferFn
on ranges
, whose size should be the index storage bitwidth.
Then, compute the function on argRanges
again after truncating the ranges to 32 bits. Finally, if the truncation of the 64-bit result is equal to the 32-bit result, use it (to preserve compatibility with folders and inference precision), and take the union of the results otherwise.
The mode
argument specifies if the unsigned, signed, or both results of the inference computation should be used when comparing the results.
Definition at line 79 of file InferIntRangeCommon.cpp.
References Both, extRange(), indexMaxWidth, indexMinWidth, mlir::ConstantIntRanges::rangeUnion(), Signed, mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), truncRange(), mlir::ConstantIntRanges::umax(), mlir::ConstantIntRanges::umin(), and Unsigned.
ConstantIntRanges mlir::intrange::inferMaxS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 454 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromSigned(), mlir::ConstantIntRanges::smax(), and mlir::ConstantIntRanges::smin().
ConstantIntRanges mlir::intrange::inferMaxU | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 463 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromUnsigned(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferMinS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 472 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromSigned(), mlir::ConstantIntRanges::smax(), and mlir::ConstantIntRanges::smin().
ConstantIntRanges mlir::intrange::inferMinU | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 481 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromUnsigned(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferMul | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 235 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::intersection(), minMaxBy(), mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferOr | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 519 of file InferIntRangeCommon.cpp.
References minMaxBy(), and widenBitwiseBounds().
ConstantIntRanges mlir::intrange::inferRemS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 384 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromSigned(), getZero(), mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), and ult.
ConstantIntRanges mlir::intrange::inferRemU | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 423 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::fromUnsigned(), getZero(), ult, mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferShl | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 545 of file InferIntRangeCommon.cpp.
References mlir::ConstantIntRanges::intersection(), minMaxBy(), mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferShrS | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 561 of file InferIntRangeCommon.cpp.
References minMaxBy(), mlir::ConstantIntRanges::smax(), and mlir::ConstantIntRanges::smin().
ConstantIntRanges mlir::intrange::inferShrU | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 574 of file InferIntRangeCommon.cpp.
References minMaxBy(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferSub | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 208 of file InferIntRangeCommon.cpp.
References computeBoundsBy(), mlir::ConstantIntRanges::intersection(), mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), mlir::ConstantIntRanges::umax(), and mlir::ConstantIntRanges::umin().
ConstantIntRanges mlir::intrange::inferXor | ( | ArrayRef< ConstantIntRanges > | argRanges | ) |
Definition at line 530 of file InferIntRangeCommon.cpp.
References minMaxBy(), and widenBitwiseBounds().
ConstantIntRanges mlir::intrange::truncRange | ( | const ConstantIntRanges & | range, |
unsigned | destWidth | ||
) |
Truncate range
to destWidth
bits, taking care to handle cases such as the truncation of [255, 256] to i8 not being a uniform range.
Referenced by inferIndexOp(), and makeLikeDest().
|
staticconstexpr |
Definition at line 30 of file InferIntRangeCommon.h.
Referenced by inferIndexOp().
|
staticconstexpr |
Definition at line 29 of file InferIntRangeCommon.h.
Referenced by inferIndexCast(), and inferIndexOp().