31#ifndef LLVM_IR_CONSTANTRANGE_H
32#define LLVM_IR_CONSTANTRANGE_H
87 return getFull(Lower.getBitWidth());
147 areInsensitiveToSignednessOfICmpPredicate(
const ConstantRange &CR1,
153 areInsensitiveToSignednessOfInvertedICmpPredicate(
const ConstantRange &CR1,
190 unsigned NoWrapKind);
243 LLVM_ABI bool isUpperWrapped()
const;
249 LLVM_ABI bool isSignWrappedSet()
const;
256 LLVM_ABI bool isUpperSignWrapped()
const;
266 if (Upper == Lower + 1)
274 if (Lower == Upper + 1)
289 LLVM_ABI bool isAllNegative()
const;
292 LLVM_ABI bool isAllNonNegative()
const;
295 LLVM_ABI bool isAllPositive()
const;
311 return Lower == CR.Lower && Upper == CR.Upper;
319 LLVM_ABI unsigned getActiveBits()
const;
323 LLVM_ABI unsigned getMinSignedBits()
const;
355 PreferredRangeType
Type = Smallest)
const;
359 LLVM_ABI std::optional<ConstantRange>
364 LLVM_ABI std::optional<ConstantRange>
394 unsigned NoWrapKind = 0)
const;
416 unsigned NoWrapKind)
const;
429 PreferredRangeType RangeType = Smallest)
const;
442 PreferredRangeType RangeType = Smallest)
const;
456 PreferredRangeType RangeType = Smallest)
const;
530 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 void splitPosNeg(const APFloat &Lower, const APFloat &Upper, std::optional< SameSignRange > &NegPart, std::optional< SameSignRange > &PosPart)
Split the range into positive and negative components.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
bool operator==(const MergedFunctionsInfo &LHS, const MergedFunctionsInfo &RHS)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
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.
An abstraction over a floating-point predicate, and a pack of an integer predicate with samesign info...
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.
LLVM_ABI bool isFullSet() const
Return true if this set contains all of the elements possible for this data-type.
bool operator==(const ConstantRange &CR) const
Return true if this range is equal to another range.
LLVM_ABI void print(raw_ostream &OS) const
Print out the bounds to a stream.
LLVM_ABI ConstantRange(uint32_t BitWidth, bool isFullSet)
Initialize a full or empty set for the specified bit width.
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.
@ 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.
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.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
APFloat abs(APFloat X)
Returns the absolute value of the argument.
LLVM_ABI ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD)
Parse out a conservative ConstantRange from !range metadata.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
constexpr unsigned BitWidth