Go to the documentation of this file.
31 #ifndef LLVM_IR_CONSTANTRANGE_H
32 #define LLVM_IR_CONSTANTRANGE_H
86 return getFull(Lower.getBitWidth());
134 areInsensitiveToSignednessOfICmpPredicate(
const ConstantRange &CR1,
140 areInsensitiveToSignednessOfInvertedICmpPredicate(
const ConstantRange &CR1,
171 unsigned NoWrapKind);
177 unsigned NoWrapKind);
208 bool isFullSet()
const;
211 bool isEmptySet()
const;
217 bool isWrappedSet()
const;
224 bool isUpperWrapped()
const;
230 bool isSignWrappedSet()
const;
237 bool isUpperSignWrapped()
const;
247 if (
Upper == Lower + 1)
255 if (Lower ==
Upper + 1)
264 bool isSizeStrictlySmallerThan(
const ConstantRange &CR)
const;
267 bool isSizeLargerThan(
uint64_t MaxSize)
const;
270 bool isAllNegative()
const;
273 bool isAllNonNegative()
const;
276 APInt getUnsignedMax()
const;
279 APInt getUnsignedMin()
const;
282 APInt getSignedMax()
const;
285 APInt getSignedMin()
const;
289 return Lower == CR.Lower &&
Upper == CR.Upper;
297 unsigned getActiveBits()
const;
301 unsigned getMinSignedBits()
const;
325 PreferredRangeType
Type = Smallest)
const;
333 PreferredRangeType
Type = Smallest)
const;
390 unsigned NoWrapKind)
const;
402 PreferredRangeType RangeType = Smallest)
const;
414 PreferredRangeType RangeType = Smallest)
const;
578 #endif // LLVM_IR_CONSTANTRANGE_H
This is an optimization pass for GlobalISel generic memory operations.
QP Compare Ordered outs ins xscmpudp No intrinsic
@ NeverOverflows
Never overflows.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
return AArch64::GPR64RegClass contains(Reg)
The instances of the Type class are immutable: once they are created, they are never changed.
@ AlwaysOverflowsLow
Always overflows in the direction of signed/unsigned min value.
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD)
Parse out a conservative ConstantRange from !range metadata.
const APInt & umin(const APInt &A, const APInt &B)
Determine the smaller of two APInts considered to be unsigned.
OverflowResult
Represents whether an operation on the given constant range is known to always or never overflow.
We currently generate a but we really shouldn eax ecx xorl edx divl ecx eax divl ecx movl eax ret A similar code sequence works for division We currently compile i32 v2 eax eax jo LBB1_2 shl
@ MayOverflow
May or may not overflow.
PreferredRangeType
If represented precisely, the result of some range operations may consist of multiple disjoint ranges...
bool isSingleElement() const
Return true if this set contains exactly one member.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
static ConstantRange getEmpty(uint32_t BitWidth)
Create empty constant range with the given bit width.
uint32_t getBitWidth() const
Get the bit width of this ConstantRange.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
we currently eax ecx subl eax ret We would use one fewer register if codegen d eax neg eax eax ret Note that this isn t beneficial if the load can be folded into the sub In this we want a sub
bool operator==(uint64_t V1, const APInt &V2)
static ConstantRange getFull(uint32_t BitWidth)
Create full constant range with the given bit width.
Class for arbitrary precision integers.
const APInt * getSingleElement() const
If this set contains a single element, return it, otherwise return null.
const APInt & smin(const APInt &A, const APInt &B)
Determine the smaller of two APInts considered to be signed.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const APInt & umax(const APInt &A, const APInt &B)
Determine the larger of two APInts considered to be unsigned.
const APInt & getLower() const
Return the lower value for this range.
bool operator==(const ConstantRange &CR) const
Return true if this range is equal to another range.
constexpr unsigned BitWidth
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
@ AlwaysOverflowsHigh
Always overflows in the direction of signed/unsigned max value.
const APInt * getSingleMissingElement() const
If this set contains all but a single element, return it, otherwise return null.
This class represents a range of values.
static ConstantRange getNonEmpty(APInt Lower, APInt Upper)
Create non-empty constant range with the given bounds.
void print(raw_ostream &OS) const
Print out the bounds to a stream.
Vector Shift Left don t map to llvm shl and lshr
APFloat abs(APFloat X)
Returns the absolute value of the argument.
const APInt & getUpper() const
Return the upper value for this range.
LLVM Value Representation.
const APInt & smax(const APInt &A, const APInt &B)
Determine the larger of two APInts considered to be signed.
bool operator!=(const ConstantRange &CR) const