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);
213 bool isFullSet()
const;
216 bool isEmptySet()
const;
222 bool isWrappedSet()
const;
229 bool isUpperWrapped()
const;
235 bool isSignWrappedSet()
const;
242 bool isUpperSignWrapped()
const;
252 if (
Upper == Lower + 1)
260 if (Lower ==
Upper + 1)
269 bool isSizeStrictlySmallerThan(
const ConstantRange &CR)
const;
272 bool isSizeLargerThan(
uint64_t MaxSize)
const;
275 bool isAllNegative()
const;
278 bool isAllNonNegative()
const;
281 bool isAllPositive()
const;
284 APInt getUnsignedMax()
const;
287 APInt getUnsignedMin()
const;
290 APInt getSignedMax()
const;
293 APInt getSignedMin()
const;
297 return Lower == CR.Lower &&
Upper == CR.Upper;
305 unsigned getActiveBits()
const;
309 unsigned getMinSignedBits()
const;
333 PreferredRangeType
Type = Smallest)
const;
341 PreferredRangeType
Type = Smallest)
const;
345 std::optional<ConstantRange>
350 std::optional<ConstantRange> exactUnionWith(
const ConstantRange &CR)
const;
399 unsigned NoWrapKind)
const;
411 PreferredRangeType RangeType = Smallest)
const;
423 PreferredRangeType RangeType = Smallest)
const;
437 PreferredRangeType RangeType = Smallest)
const;
510 PreferredRangeType RangeType = Smallest)
const;
This file implements a class to represent arbitrary precision integral constant values and operations...
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
std::optional< std::vector< StOtherPiece > > Other
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This class represents a range of values.
PreferredRangeType
If represented precisely, the result of some range operations may consist of multiple disjoint ranges...
const APInt * getSingleElement() const
If this set contains a single element, return it, otherwise return null.
static ConstantRange getFull(uint32_t BitWidth)
Create full constant range with the given bit width.
const APInt * getSingleMissingElement() const
If this set contains all but a single element, return it, otherwise return null.
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.
void print(raw_ostream &OS) const
Print out the bounds to a stream.
bool isSingleElement() const
Return true if this set contains exactly one member.
const APInt & getUpper() const
Return the upper value for this range.
OverflowResult
Represents whether an operation on the given constant range is known to always or never overflow.
bool operator!=(const ConstantRange &CR) const
static ConstantRange getNonEmpty(APInt Lower, APInt Upper)
Create non-empty constant range with the given bounds.
uint32_t getBitWidth() const
Get the bit width of this ConstantRange.
static ConstantRange getEmpty(uint32_t BitWidth)
Create empty constant range with the given bit width.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
@ NeverOverflows
Never overflows.
@ AlwaysOverflowsHigh
Always overflows in the direction of signed/unsigned max value.
@ AlwaysOverflowsLow
Always overflows in the direction of signed/unsigned min value.
@ MayOverflow
May or may not overflow.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD)
Parse out a conservative ConstantRange from !range metadata.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)