14 #ifndef MLIR_INTERFACES_INFERINTRANGEINTERFACE_H 15 #define MLIR_INTERFACES_INFERINTRANGEINTERFACE_H 32 : uminVal(umin), umaxVal(umax), sminVal(smin), smaxVal(smax) {
33 assert(uminVal.getBitWidth() == umaxVal.getBitWidth() &&
34 umaxVal.getBitWidth() == sminVal.getBitWidth() &&
35 sminVal.getBitWidth() == smaxVal.getBitWidth() &&
36 "All bounds in the ranges must have the same bitwidth");
42 const APInt &
umin()
const;
45 const APInt &
umax()
const;
48 const APInt &
smin()
const;
51 const APInt &
smax()
const;
98 friend raw_ostream &
operator<<(raw_ostream &os,
102 APInt uminVal, umaxVal, sminVal, smaxVal;
111 #include "mlir/Interfaces/InferIntRangeInterface.h.inc" 113 #endif // MLIR_INTERFACES_INFERINTRANGEINTERFACE_H Include the generated interface declarations.
ConstantIntRanges rangeUnion(const ConstantIntRanges &other) const
Returns the union (computed separately for signed and unsigned bounds) of this range and other...
static ConstantIntRanges fromUnsigned(const APInt &umin, const APInt &umax)
Create an ConstantIntRanges with the unsigned minimum and maximum equal to umin and umax and the sign...
Optional< APInt > getConstantValue() const
If either the signed or unsigned interpretations of the range indicate that the value it bounds is a ...
ConstantIntRanges(const APInt &umin, const APInt &umax, const APInt &smin, const APInt &smax)
Bound umin <= (unsigned)x <= umax and smin <= signed(x) <= smax.
static constexpr const bool value
static unsigned getStorageBitwidth(Type type)
Return the bitwidth that should be used for integer ranges describing type.
friend raw_ostream & operator<<(raw_ostream &os, const ConstantIntRanges &range)
const APInt & umin() const
The minimum value of an integer when it is interpreted as unsigned.
static ConstantIntRanges fromSigned(const APInt &smin, const APInt &smax)
Create an ConstantIntRanges with the signed minimum and maximum equal to smin and smax...
const APInt & smin() const
The minimum value of an integer when it is interpreted as signed.
static ConstantIntRanges range(const APInt &min, const APInt &max, bool isSigned)
Create a ConstantIntRanges whose minimum is min and maximum is max with isSigned specifying if the mi...
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
static Value min(ImplicitLocOpBuilder &builder, Value value, Value bound)
const APInt & smax() const
The maximum value of an integer when it is interpreted as signed.
ConstantIntRanges intersection(const ConstantIntRanges &other) const
Returns the intersection (computed separately for signed and unsigned bounds) of this range and other...
static ConstantIntRanges constant(const APInt &value)
Create a ConstantIntRanges with a constant value - that is, with the bounds [value, value] for both its signed interpretations.
static ConstantIntRanges maxRange(unsigned bitwidth)
Create a ConstantIntRanges with the maximum bounds for the width bitwidth, that is - [0...
const APInt & umax() const
The maximum value of an integer when it is interpreted as unsigned.
A set of arbitrary-precision integers representing bounds on a given integer value.
bool operator==(const ConstantIntRanges &other) const
static Value max(ImplicitLocOpBuilder &builder, Value value, Value bound)