MLIR  20.0.0git
Namespaces | Typedefs | Enumerations | Functions | Variables
InferIntRangeCommon.h File Reference
#include "mlir/Interfaces/InferIntRangeInterface.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
#include <optional>

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::intrange
 

Typedefs

using mlir::intrange::InferRangeFn = std::function< 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...
 
using mlir::intrange::InferIntegerValueRangeFn = std::function< IntegerValueRange(ArrayRef< IntegerValueRange >)>
 Function that performs inferrence on an array of IntegerValueRange. More...
 
using mlir::intrange::InferRangeWithOvfFlagsFn = function_ref< ConstantIntRanges(ArrayRef< ConstantIntRanges >, OverflowFlags)>
 Function that performs inference on an array of ConstantIntRanges while taking special overflow behavior into account. More...
 

Enumerations

enum class  mlir::intrange::CmpMode : uint32_t { mlir::intrange::Both , mlir::intrange::Signed , mlir::intrange::Unsigned }
 
enum class  mlir::intrange::OverflowFlags : uint32_t { mlir::intrange::None = 0 , mlir::intrange::Nsw = 1 , mlir::intrange::Nuw = 2 }
 
enum class  mlir::intrange::CmpPredicate : uint64_t {
  mlir::intrange::eq , mlir::intrange::ne , mlir::intrange::slt , mlir::intrange::sle ,
  mlir::intrange::sgt , mlir::intrange::sge , mlir::intrange::ult , mlir::intrange::ule ,
  mlir::intrange::ugt , mlir::intrange::uge
}
 Copy of the enum from arith and index to allow the common integer range infrastructure to not depend on either dialect. More...
 

Functions

ConstantIntRanges mlir::intrange::inferIndexOp (const InferRangeFn &inferFn, ArrayRef< ConstantIntRanges > argRanges, CmpMode mode)
 Compute inferFn on ranges, whose size should be the index storage bitwidth. More...
 
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. More...
 
ConstantIntRanges mlir::intrange::extUIRange (const ConstantIntRanges &range, unsigned destWidth)
 Use the unsigned values in range to zero-extend it to destWidth. More...
 
ConstantIntRanges mlir::intrange::extSIRange (const ConstantIntRanges &range, unsigned destWidth)
 Use the signed values in range to sign-extend it to destWidth. More...
 
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. More...
 
ConstantIntRanges mlir::intrange::inferAdd (ArrayRef< ConstantIntRanges > argRanges, OverflowFlags ovfFlags=OverflowFlags::None)
 
ConstantIntRanges mlir::intrange::inferSub (ArrayRef< ConstantIntRanges > argRanges, OverflowFlags ovfFlags=OverflowFlags::None)
 
ConstantIntRanges mlir::intrange::inferMul (ArrayRef< ConstantIntRanges > argRanges, OverflowFlags ovfFlags=OverflowFlags::None)
 
ConstantIntRanges mlir::intrange::inferDivS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferDivU (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferCeilDivS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferCeilDivU (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferFloorDivS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferRemS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferRemU (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferMaxS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferMaxU (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferMinS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferMinU (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferAnd (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferOr (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferXor (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferShl (ArrayRef< ConstantIntRanges > argRanges, OverflowFlags ovfFlags=OverflowFlags::None)
 
ConstantIntRanges mlir::intrange::inferShrS (ArrayRef< ConstantIntRanges > argRanges)
 
ConstantIntRanges mlir::intrange::inferShrU (ArrayRef< ConstantIntRanges > argRanges)
 
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. More...
 

Variables

static constexpr unsigned mlir::intrange::indexMinWidth = 32
 
static constexpr unsigned mlir::intrange::indexMaxWidth = 64