LLVM 20.0.0git
|
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is small. More...
#include "llvm/ADT/SmallBitVector.h"
Classes | |
class | reference |
Public Types | |
using | size_type = uintptr_t |
using | const_set_bits_iterator = const_set_bits_iterator_impl< SmallBitVector > |
using | set_iterator = const_set_bits_iterator |
Public Member Functions | |
SmallBitVector ()=default | |
Creates an empty bitvector. | |
SmallBitVector (unsigned s, bool t=false) | |
Creates a bitvector of specified number of bits. | |
SmallBitVector (const SmallBitVector &RHS) | |
SmallBitVector copy ctor. | |
SmallBitVector (SmallBitVector &&RHS) | |
~SmallBitVector () | |
const_set_bits_iterator | set_bits_begin () const |
const_set_bits_iterator | set_bits_end () const |
iterator_range< const_set_bits_iterator > | set_bits () const |
bool | isSmall () const |
bool | empty () const |
Tests whether there are no bits in this bitvector. | |
size_type | size () const |
Returns the number of bits in this bitvector. | |
size_type | count () const |
Returns the number of bits which are set. | |
bool | any () const |
Returns true if any bit is set. | |
bool | all () const |
Returns true if all bits are set. | |
bool | none () const |
Returns true if none of the bits are set. | |
int | find_first () const |
Returns the index of the first set bit, -1 if none of the bits are set. | |
int | find_last () const |
int | find_first_unset () const |
Returns the index of the first unset bit, -1 if all of the bits are set. | |
int | find_last_unset () const |
int | find_next (unsigned Prev) const |
Returns the index of the next set bit following the "Prev" bit. | |
int | find_next_unset (unsigned Prev) const |
Returns the index of the next unset bit following the "Prev" bit. | |
int | find_prev (unsigned PriorTo) const |
find_prev - Returns the index of the first set bit that precedes the the bit at PriorTo . | |
void | clear () |
Clear all bits. | |
void | resize (unsigned N, bool t=false) |
Grow or shrink the bitvector. | |
void | reserve (unsigned N) |
SmallBitVector & | set () |
SmallBitVector & | set (unsigned Idx) |
SmallBitVector & | set (unsigned I, unsigned E) |
Efficiently set a range of bits in [I, E) | |
SmallBitVector & | reset () |
SmallBitVector & | reset (unsigned Idx) |
SmallBitVector & | reset (unsigned I, unsigned E) |
Efficiently reset a range of bits in [I, E) | |
SmallBitVector & | flip () |
SmallBitVector & | flip (unsigned Idx) |
SmallBitVector | operator~ () const |
reference | operator[] (unsigned Idx) |
bool | operator[] (unsigned Idx) const |
bool | back () const |
Return the last element in the vector. | |
bool | test (unsigned Idx) const |
void | push_back (bool Val) |
void | pop_back () |
Pop one bit from the end of the vector. | |
bool | anyCommon (const SmallBitVector &RHS) const |
Test if any common bits are set. | |
bool | operator== (const SmallBitVector &RHS) const |
bool | operator!= (const SmallBitVector &RHS) const |
SmallBitVector & | operator&= (const SmallBitVector &RHS) |
SmallBitVector & | reset (const SmallBitVector &RHS) |
Reset bits that are set in RHS. Same as *this &= ~RHS. | |
bool | test (const SmallBitVector &RHS) const |
Check if (This - RHS) is zero. This is the same as reset(RHS) and any(). | |
SmallBitVector & | operator|= (const SmallBitVector &RHS) |
SmallBitVector & | operator^= (const SmallBitVector &RHS) |
SmallBitVector & | operator<<= (unsigned N) |
SmallBitVector & | operator>>= (unsigned N) |
const SmallBitVector & | operator= (const SmallBitVector &RHS) |
const SmallBitVector & | operator= (SmallBitVector &&RHS) |
void | swap (SmallBitVector &RHS) |
void | setBitsInMask (const uint32_t *Mask, unsigned MaskWords=~0u) |
Add '1' bits from Mask to this vector. | |
void | clearBitsInMask (const uint32_t *Mask, unsigned MaskWords=~0u) |
Clear any bits in this vector that are set in Mask. | |
void | setBitsNotInMask (const uint32_t *Mask, unsigned MaskWords=~0u) |
Add a bit to this vector for every '0' bit in Mask. | |
void | clearBitsNotInMask (const uint32_t *Mask, unsigned MaskWords=~0u) |
Clear a bit in this vector for every '0' bit in Mask. | |
void | invalid () |
bool | isInvalid () const |
ArrayRef< uintptr_t > | getData (uintptr_t &Store) const |
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is small.
It contains one pointer-sized field, which is directly used as a plain collection of bits when possible, or as a pointer to a larger heap-allocated array when necessary. This allows normal "small" cases to be fast without losing generality for large inputs.
Definition at line 35 of file SmallBitVector.h.
Definition at line 172 of file SmallBitVector.h.
Definition at line 173 of file SmallBitVector.h.
using llvm::SmallBitVector::size_type = uintptr_t |
Definition at line 64 of file SmallBitVector.h.
|
default |
Creates an empty bitvector.
Referenced by operator~().
Creates a bitvector of specified number of bits.
All bits are initialized to the specified value.
Definition at line 148 of file SmallBitVector.h.
|
inline |
|
inline |
Definition at line 163 of file SmallBitVector.h.
References RHS.
|
inline |
Definition at line 167 of file SmallBitVector.h.
References isSmall().
|
inline |
Returns true if all bits are set.
Definition at line 216 of file SmallBitVector.h.
References llvm::BitVector::all(), and isSmall().
Referenced by llvm::OpenMPIRBuilder::emitOffloadingArrays(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), foldInsSequenceIntoSplat(), generateKeySubkey(), getShufflevectorNumGroups(), llvm::CombinerHelper::matchExtractAllEltsFromBuildVector(), performExtractsShuffleAction(), simplifyReductionOperand(), and llvm::LegalizationArtifactCombiner::ArtifactValueFinder::tryCombineUnmergeDefs().
|
inline |
Returns true if any bit is set.
Definition at line 209 of file SmallBitVector.h.
References llvm::BitVector::any(), and isSmall().
Referenced by llvm::DependenceInfo::depends(), llvm::OpenMPIRBuilder::emitOffloadingArrays(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), and llvm::DependenceInfo::getSplitIteration().
|
inline |
Test if any common bits are set.
Definition at line 488 of file SmallBitVector.h.
References llvm::BitVector::anyCommon(), isSmall(), RHS, size(), and test.
|
inline |
Return the last element in the vector.
Definition at line 467 of file SmallBitVector.h.
|
inline |
Clear all bits.
Definition at line 325 of file SmallBitVector.h.
References isSmall().
Referenced by llvm::StatepointLoweringState::clear(), operator=(), and llvm::StatepointLoweringState::startNewStatepoint().
|
inline |
Clear any bits in this vector that are set in Mask.
Don't resize. This computes "*this &= ~Mask".
Definition at line 655 of file SmallBitVector.h.
References llvm::BitVector::clearBitsInMask(), and isSmall().
|
inline |
Clear a bit in this vector for every '0' bit in Mask.
Don't resize. This computes "*this &= Mask".
Definition at line 673 of file SmallBitVector.h.
References llvm::BitVector::clearBitsNotInMask(), and isSmall().
|
inline |
Returns the number of bits which are set.
Definition at line 200 of file SmallBitVector.h.
References llvm::BitVector::count(), isSmall(), and llvm::popcount().
Referenced by llvm::DependenceInfo::depends(), find_first_unset(), find_last_unset(), fixupOrderingIndices(), llvm::DependenceInfo::getSplitIteration(), and lowerShuffleAsSplitOrBlend().
|
inline |
Tests whether there are no bits in this bitvector.
Definition at line 190 of file SmallBitVector.h.
References llvm::BitVector::empty(), and isSmall().
Referenced by back(), invalid(), and pop_back().
|
inline |
Returns the index of the first set bit, -1 if none of the bits are set.
Definition at line 230 of file SmallBitVector.h.
References llvm::countr_zero(), llvm::BitVector::find_first(), and isSmall().
Referenced by findMainViewFileID(), and fixupOrderingIndices().
|
inline |
Returns the index of the first unset bit, -1 if all of the bits are set.
Definition at line 251 of file SmallBitVector.h.
References count(), llvm::countr_one(), llvm::BitVector::find_first_unset(), and isSmall().
Referenced by llvm::LegalizeRuleSet::verifyImmIdxsCoverage(), and llvm::LegalizeRuleSet::verifyTypeIdxsCoverage().
|
inline |
Definition at line 240 of file SmallBitVector.h.
References llvm::countl_zero(), llvm::BitVector::find_last(), and isSmall().
|
inline |
Definition at line 262 of file SmallBitVector.h.
References count(), llvm::countl_one(), llvm::BitVector::find_last_unset(), and isSmall().
|
inline |
Returns the index of the next set bit following the "Prev" bit.
Returns -1 if the next set bit is not found.
Definition at line 277 of file SmallBitVector.h.
References llvm::countr_zero(), llvm::BitVector::find_next(), and isSmall().
Referenced by dumpSmallBitVector(), and fixupOrderingIndices().
|
inline |
Returns the index of the next unset bit following the "Prev" bit.
Returns -1 if the next unset bit is not found.
Definition at line 291 of file SmallBitVector.h.
References llvm::countr_one(), llvm::BitVector::find_next_unset(), and isSmall().
|
inline |
find_prev - Returns the index of the first set bit that precedes the the bit at PriorTo
.
Returns -1 if all previous bits are unset.
Definition at line 308 of file SmallBitVector.h.
References llvm::countl_zero(), llvm::BitVector::find_prev(), and isSmall().
|
inline |
Definition at line 432 of file SmallBitVector.h.
References llvm::BitVector::flip(), and isSmall().
|
inline |
Definition at line 440 of file SmallBitVector.h.
References llvm::BitVector::flip(), Idx, and isSmall().
|
inline |
Definition at line 686 of file SmallBitVector.h.
References llvm::BitVector::getData(), and isSmall().
|
inline |
Definition at line 680 of file SmallBitVector.h.
|
inline |
Definition at line 684 of file SmallBitVector.h.
|
inline |
Definition at line 187 of file SmallBitVector.h.
Referenced by all(), any(), anyCommon(), clear(), clearBitsInMask(), clearBitsNotInMask(), count(), empty(), find_first(), find_first_unset(), find_last(), find_last_unset(), find_next(), find_next_unset(), find_prev(), flip(), getData(), none(), operator&=(), operator<<=(), operator=(), operator==(), operator>>=(), operator[](), operator^=(), operator|=(), reserve(), reset(), resize(), set(), setBitsInMask(), setBitsNotInMask(), size(), test(), and ~SmallBitVector().
|
inline |
Returns true if none of the bits are set.
Definition at line 223 of file SmallBitVector.h.
References isSmall(), and llvm::BitVector::none().
Referenced by fixupOrderingIndices().
|
inline |
Definition at line 517 of file SmallBitVector.h.
References RHS.
|
inline |
|
inline |
Definition at line 598 of file SmallBitVector.h.
|
inline |
Definition at line 615 of file SmallBitVector.h.
|
inline |
Definition at line 632 of file SmallBitVector.h.
|
inline |
|
inline |
Definition at line 606 of file SmallBitVector.h.
Definition at line 454 of file SmallBitVector.h.
|
inline |
|
inline |
|
inline |
Definition at line 449 of file SmallBitVector.h.
References SmallBitVector().
|
inline |
|
inline |
Definition at line 477 of file SmallBitVector.h.
|
inline |
Definition at line 348 of file SmallBitVector.h.
References I, isSmall(), N, llvm::BitVector::reserve(), and llvm::BitVector::set().
|
inline |
Definition at line 401 of file SmallBitVector.h.
References isSmall(), and llvm::BitVector::reset().
Referenced by llvm::DependenceInfo::depends(), fixupOrderingIndices(), llvm::DependenceInfo::getSplitIteration(), operator&=(), llvm::SmallBitVector::reference::operator=(), and reset().
|
inline |
Reset bits that are set in RHS. Same as *this &= ~RHS.
Definition at line 540 of file SmallBitVector.h.
References isSmall(), llvm::BitVector::reset(), reset(), RHS, and size().
|
inline |
Efficiently reset a range of bits in [I, E)
Definition at line 418 of file SmallBitVector.h.
References assert(), E, I, isSmall(), llvm::BitVector::reset(), and size().
|
inline |
Definition at line 409 of file SmallBitVector.h.
References Idx, isSmall(), and llvm::BitVector::reset().
Grow or shrink the bitvector.
Definition at line 332 of file SmallBitVector.h.
References E, I, isSmall(), N, and llvm::BitVector::resize().
Referenced by llvm::StatepointLoweringState::allocateStackSlot(), lowerShuffleAsSplitOrBlend(), operator&=(), operator^=(), operator|=(), pop_back(), push_back(), and llvm::StatepointLoweringState::startNewStatepoint().
|
inline |
Definition at line 366 of file SmallBitVector.h.
References isSmall(), and llvm::BitVector::set().
Referenced by llvm::DwarfExpression::addMachineReg(), llvm::StatepointLoweringState::allocateStackSlot(), areTwoInsertFromSameBuildVector(), combineOrders(), llvm::DependenceInfo::depends(), llvm::OpenMPIRBuilder::emitOffloadingArrays(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), fixupOrderingIndices(), llvm::LegalizerInfo::getAction(), getAltInstrMask(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), getShufflevectorNumGroups(), llvm::DependenceInfo::getSplitIteration(), llvm::MachineInstr::getTypeToPrint(), llvm::LegalizeRuleSet::immIdx(), llvm::CombinerHelper::matchExtractAllEltsFromBuildVector(), llvm::SmallBitVector::reference::operator=(), llvm::slpvectorizer::BoUpSLP::VLOperands::reorder(), llvm::StatepointLoweringState::reserveStackSlot(), and simplifyReductionOperand().
|
inline |
Efficiently set a range of bits in [I, E)
Definition at line 387 of file SmallBitVector.h.
References assert(), E, I, isSmall(), llvm::BitVector::set(), and size().
|
inline |
Definition at line 374 of file SmallBitVector.h.
References assert(), Idx, isSmall(), and llvm::BitVector::set().
|
inline |
Definition at line 183 of file SmallBitVector.h.
References llvm::make_range(), set_bits_begin(), and set_bits_end().
Referenced by llvm::DependenceInfo::depends(), dumpSmallBitVector(), and llvm::DependenceInfo::getSplitIteration().
|
inline |
Definition at line 175 of file SmallBitVector.h.
Referenced by set_bits().
|
inline |
Definition at line 179 of file SmallBitVector.h.
Referenced by set_bits().
Add '1' bits from Mask to this vector.
Don't resize. This computes "*this |= Mask".
Definition at line 646 of file SmallBitVector.h.
References isSmall(), and llvm::BitVector::setBitsInMask().
|
inline |
Add a bit to this vector for every '0' bit in Mask.
Don't resize. This computes "*this |= ~Mask".
Definition at line 664 of file SmallBitVector.h.
References isSmall(), and llvm::BitVector::setBitsNotInMask().
|
inline |
Returns the number of bits in this bitvector.
Definition at line 195 of file SmallBitVector.h.
References isSmall(), and llvm::BitVector::size().
Referenced by llvm::StatepointLoweringState::allocateStackSlot(), anyCommon(), back(), llvm::X86TTIImpl::isLegalAltInstr(), llvm::StatepointLoweringState::isStackSlotAllocated(), operator&=(), operator==(), operator[](), operator^=(), operator|=(), pop_back(), push_back(), llvm::StatepointLoweringState::reserveStackSlot(), reset(), set(), and test().
|
inline |
Definition at line 640 of file SmallBitVector.h.
References RHS, and std::swap().
Referenced by operator=().
|
inline |
Check if (This - RHS) is zero. This is the same as reset(RHS) and any().
Definition at line 554 of file SmallBitVector.h.
References isSmall(), RHS, size(), llvm::BitVector::test(), and test.
Definition at line 472 of file SmallBitVector.h.
References Idx.
Referenced by llvm::DwarfExpression::addMachineReg(), llvm::StatepointLoweringState::allocateStackSlot(), areTwoInsertFromSameBuildVector(), combineOrders(), llvm::OpenMPIRBuilder::emitOffloadingArrays(), llvm::slpvectorizer::BoUpSLP::findReusedOrderedScalars(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), llvm::X86TTIImpl::isLegalAltInstr(), llvm::StatepointLoweringState::isStackSlotAllocated(), performExtractsShuffleAction(), llvm::StatepointLoweringState::reserveStackSlot(), and simplifyReductionOperand().