LLVM 22.0.0git
llvm::ConstantRangeList Class Reference

This class represents a list of constant ranges. More...

#include "llvm/IR/ConstantRangeList.h"

Public Member Functions

 ConstantRangeList ()=default
 ConstantRangeList (ArrayRef< ConstantRange > RangesRef)
ArrayRef< ConstantRangerangesRef () const
SmallVectorImpl< ConstantRange >::iterator begin ()
SmallVectorImpl< ConstantRange >::iterator end ()
SmallVectorImpl< ConstantRange >::const_iterator begin () const
SmallVectorImpl< ConstantRange >::const_iterator end () const
ConstantRange getRange (unsigned i) const
bool empty () const
 Return true if this list contains no members.
uint32_t getBitWidth () const
 Get the bit width of this ConstantRangeList.
size_t size () const
 Return the number of ranges in this ConstantRangeList.
LLVM_ABI void insert (const ConstantRange &NewRange)
 Insert a new range to Ranges and keep the list ordered.
void insert (int64_t Lower, int64_t Upper)
LLVM_ABI void subtract (const ConstantRange &SubRange)
LLVM_ABI ConstantRangeList unionWith (const ConstantRangeList &CRL) const
 Return the range list that results from the union of this ConstantRangeList with another ConstantRangeList, "CRL".
LLVM_ABI ConstantRangeList intersectWith (const ConstantRangeList &CRL) const
 Return the range list that results from the intersection of this ConstantRangeList with another ConstantRangeList, "CRL".
bool operator== (const ConstantRangeList &CRL) const
 Return true if this range list is equal to another range list.
bool operator!= (const ConstantRangeList &CRL) const
LLVM_ABI void print (raw_ostream &OS) const
 Print out the ranges to a stream.
void dump () const

Static Public Member Functions

static LLVM_ABI bool isOrderedRanges (ArrayRef< ConstantRange > RangesRef)
static LLVM_ABI std::optional< ConstantRangeListgetConstantRangeList (ArrayRef< ConstantRange > RangesRef)

Detailed Description

This class represents a list of constant ranges.

Definition at line 31 of file ConstantRangeList.h.

Constructor & Destructor Documentation

◆ ConstantRangeList() [1/2]

llvm::ConstantRangeList::ConstantRangeList ( )
default

◆ ConstantRangeList() [2/2]

llvm::ConstantRangeList::ConstantRangeList ( ArrayRef< ConstantRange > RangesRef)
inline

Definition at line 36 of file ConstantRangeList.h.

References assert(), empty(), getBitWidth(), and isOrderedRanges().

Member Function Documentation

◆ begin() [1/2]

SmallVectorImpl< ConstantRange >::iterator llvm::ConstantRangeList::begin ( )
inline

Definition at line 50 of file ConstantRangeList.h.

◆ begin() [2/2]

SmallVectorImpl< ConstantRange >::const_iterator llvm::ConstantRangeList::begin ( ) const
inline

◆ dump()

LLVM_DUMP_METHOD void ConstantRangeList::dump ( ) const

Definition at line 242 of file ConstantRangeList.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, and print().

◆ empty()

bool llvm::ConstantRangeList::empty ( ) const
inline

Return true if this list contains no members.

Definition at line 61 of file ConstantRangeList.h.

Referenced by ConstantRangeList(), inferInitializes(), insert(), intersectWith(), subtract(), and unionWith().

◆ end() [1/2]

SmallVectorImpl< ConstantRange >::iterator llvm::ConstantRangeList::end ( )
inline

Definition at line 51 of file ConstantRangeList.h.

◆ end() [2/2]

SmallVectorImpl< ConstantRange >::const_iterator llvm::ConstantRangeList::end ( ) const
inline

◆ getBitWidth()

uint32_t llvm::ConstantRangeList::getBitWidth ( ) const
inline

Get the bit width of this ConstantRangeList.

It is invalid to call this with an empty range.

Definition at line 65 of file ConstantRangeList.h.

Referenced by ConstantRangeList(), insert(), intersectWith(), subtract(), and unionWith().

◆ getConstantRangeList()

std::optional< ConstantRangeList > ConstantRangeList::getConstantRangeList ( ArrayRef< ConstantRange > RangesRef)
static

Definition at line 31 of file ConstantRangeList.cpp.

References ConstantRangeList(), and isOrderedRanges().

◆ getRange()

ConstantRange llvm::ConstantRangeList::getRange ( unsigned i) const
inline

Definition at line 58 of file ConstantRangeList.h.

◆ insert() [1/2]

◆ insert() [2/2]

void llvm::ConstantRangeList::insert ( int64_t Lower,
int64_t Upper )
inline

Definition at line 72 of file ConstantRangeList.h.

References insert(), llvm::Lower, and llvm::Upper.

◆ intersectWith()

ConstantRangeList ConstantRangeList::intersectWith ( const ConstantRangeList & CRL) const

Return the range list that results from the intersection of this ConstantRangeList with another ConstantRangeList, "CRL".

Definition at line 197 of file ConstantRangeList.cpp.

References assert(), ConstantRangeList(), empty(), getBitWidth(), Range, size(), llvm::APIntOps::smax(), and llvm::APIntOps::smin().

Referenced by llvm::MDNode::getMostGenericNoaliasAddrspace(), and inferInitializes().

◆ isOrderedRanges()

bool ConstantRangeList::isOrderedRanges ( ArrayRef< ConstantRange > RangesRef)
static

◆ operator!=()

bool llvm::ConstantRangeList::operator!= ( const ConstantRangeList & CRL) const
inline

Definition at line 91 of file ConstantRangeList.h.

References ConstantRangeList(), and operator==().

◆ operator==()

bool llvm::ConstantRangeList::operator== ( const ConstantRangeList & CRL) const
inline

Return true if this range list is equal to another range list.

Definition at line 88 of file ConstantRangeList.h.

References ConstantRangeList().

◆ print()

void ConstantRangeList::print ( raw_ostream & OS) const

Print out the ranges to a stream.

Definition at line 235 of file ConstantRangeList.cpp.

References llvm::ConstantRange::getLower(), llvm::ConstantRange::getUpper(), and llvm::interleaveComma().

Referenced by dump(), and llvm::Attribute::getAsString().

◆ rangesRef()

ArrayRef< ConstantRange > llvm::ConstantRangeList::rangesRef ( ) const
inline

Definition at line 49 of file ConstantRangeList.h.

Referenced by inferInitializes().

◆ size()

size_t llvm::ConstantRangeList::size ( ) const
inline

Return the number of ranges in this ConstantRangeList.

Definition at line 68 of file ConstantRangeList.h.

Referenced by intersectWith(), and unionWith().

◆ subtract()

◆ unionWith()

ConstantRangeList ConstantRangeList::unionWith ( const ConstantRangeList & CRL) const

Return the range list that results from the union of this ConstantRangeList with another ConstantRangeList, "CRL".

Definition at line 146 of file ConstantRangeList.cpp.

References assert(), ConstantRangeList(), empty(), getBitWidth(), llvm::ConstantRange::getLower(), llvm::ConstantRange::getUpper(), size(), llvm::APInt::slt(), and llvm::APIntOps::smax().

Referenced by inferInitializes().


The documentation for this class was generated from the following files: