LLVM  6.0.0svn
Classes | Public Types | Public Member Functions | List of all members
llvm::BitVector Class Reference

#include "llvm/ADT/BitVector.h"

Classes

class  reference
 

Public Types

typedef unsigned size_type
 
typedef const_set_bits_iterator_impl< BitVectorconst_set_bits_iterator
 
typedef const_set_bits_iterator set_iterator
 

Public Member Functions

const_set_bits_iterator set_bits_begin () const
 
const_set_bits_iterator set_bits_end () const
 
iterator_range< const_set_bits_iteratorset_bits () const
 
 BitVector ()
 BitVector default ctor - Creates an empty bitvector. More...
 
 BitVector (unsigned s, bool t=false)
 BitVector ctor - Creates a bitvector of specified number of bits. More...
 
 BitVector (const BitVector &RHS)
 BitVector copy ctor. More...
 
 BitVector (BitVector &&RHS)
 
 ~BitVector ()
 
bool empty () const
 empty - Tests whether there are no bits in this bitvector. More...
 
size_type size () const
 size - Returns the number of bits in this bitvector. More...
 
size_type count () const
 count - Returns the number of bits which are set. More...
 
bool any () const
 any - Returns true if any bit is set. More...
 
bool all () const
 all - Returns true if all bits are set. More...
 
bool none () const
 none - Returns true if none of the bits are set. More...
 
int find_first_in (unsigned Begin, unsigned End) const
 find_first_in - Returns the index of the first set bit in the range [Begin, End). More...
 
int find_last_in (unsigned Begin, unsigned End) const
 find_last_in - Returns the index of the last set bit in the range [Begin, End). More...
 
int find_first_unset_in (unsigned Begin, unsigned End) const
 find_first_unset_in - Returns the index of the first unset bit in the range [Begin, End). More...
 
int find_last_unset_in (unsigned Begin, unsigned End) const
 find_last_unset_in - Returns the index of the last unset bit in the range [Begin, End). More...
 
int find_first () const
 find_first - Returns the index of the first set bit, -1 if none of the bits are set. More...
 
int find_last () const
 find_last - Returns the index of the last set bit, -1 if none of the bits are set. More...
 
int find_next (unsigned Prev) const
 find_next - Returns the index of the next set bit following the "Prev" bit. More...
 
int find_prev (unsigned PriorTo) const
 find_prev - Returns the index of the first set bit that precedes the the bit at PriorTo. More...
 
int find_first_unset () const
 find_first_unset - Returns the index of the first unset bit, -1 if all of the bits are set. More...
 
int find_next_unset (unsigned Prev) const
 find_next_unset - Returns the index of the next unset bit following the "Prev" bit. More...
 
int find_last_unset () const
 find_last_unset - Returns the index of the last unset bit, -1 if all of the bits are set. More...
 
int find_prev_unset (unsigned PriorTo)
 find_prev_unset - Returns the index of the first unset bit that precedes the bit at PriorTo. More...
 
void clear ()
 clear - Removes all bits from the bitvector. Does not change capacity. More...
 
void resize (unsigned N, bool t=false)
 resize - Grow or shrink the bitvector. More...
 
void reserve (unsigned N)
 
BitVectorset ()
 
BitVectorset (unsigned Idx)
 
BitVectorset (unsigned I, unsigned E)
 set - Efficiently set a range of bits in [I, E) More...
 
BitVectorreset ()
 
BitVectorreset (unsigned Idx)
 
BitVectorreset (unsigned I, unsigned E)
 reset - Efficiently reset a range of bits in [I, E) More...
 
BitVectorflip ()
 
BitVectorflip (unsigned Idx)
 
reference operator[] (unsigned Idx)
 
bool operator[] (unsigned Idx) const
 
bool test (unsigned Idx) const
 
bool anyCommon (const BitVector &RHS) const
 Test if any common bits are set. More...
 
bool operator== (const BitVector &RHS) const
 
bool operator!= (const BitVector &RHS) const
 
BitVectoroperator &= (const BitVector &RHS)
 Intersection, union, disjoint union. More...
 
BitVectorreset (const BitVector &RHS)
 reset - Reset bits that are set in RHS. Same as *this &= ~RHS. More...
 
bool test (const BitVector &RHS) const
 test - Check if (This - RHS) is zero. More...
 
BitVectoroperator|= (const BitVector &RHS)
 
BitVectoroperator^= (const BitVector &RHS)
 
BitVectoroperator>>= (unsigned N)
 
BitVectoroperator<<= (unsigned N)
 
const BitVectoroperator= (const BitVector &RHS)
 
const BitVectoroperator= (BitVector &&RHS)
 
void swap (BitVector &RHS)
 
void setBitsInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 setBitsInMask - Add '1' bits from Mask to this vector. More...
 
void clearBitsInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 clearBitsInMask - Clear any bits in this vector that are set in Mask. More...
 
void setBitsNotInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 setBitsNotInMask - Add a bit to this vector for every '0' bit in Mask. More...
 
void clearBitsNotInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 clearBitsNotInMask - Clear a bit in this vector for every '0' bit in Mask. More...
 
size_t getMemorySize () const
 Return the size (in bytes) of the bit vector. More...
 
size_t getBitCapacity () const
 

Detailed Description

Definition at line 74 of file BitVector.h.

Member Typedef Documentation

◆ const_set_bits_iterator

Definition at line 121 of file BitVector.h.

◆ set_iterator

Definition at line 122 of file BitVector.h.

◆ size_type

Definition at line 86 of file BitVector.h.

Constructor & Destructor Documentation

◆ BitVector() [1/4]

llvm::BitVector::BitVector ( )
inline

BitVector default ctor - Creates an empty bitvector.

Definition at line 135 of file BitVector.h.

◆ BitVector() [2/4]

llvm::BitVector::BitVector ( unsigned  s,
bool  t = false 
)
inlineexplicit

BitVector ctor - Creates a bitvector of specified number of bits.

All bits are initialized to the specified value.

Definition at line 139 of file BitVector.h.

◆ BitVector() [3/4]

llvm::BitVector::BitVector ( const BitVector RHS)
inline

BitVector copy ctor.

Definition at line 148 of file BitVector.h.

References llvm::MutableArrayRef< T >::data(), and size().

◆ BitVector() [4/4]

llvm::BitVector::BitVector ( BitVector &&  RHS)
inline

Definition at line 159 of file BitVector.h.

◆ ~BitVector()

llvm::BitVector::~BitVector ( )
inline

Definition at line 164 of file BitVector.h.

References llvm::MutableArrayRef< T >::data().

Member Function Documentation

◆ all()

bool llvm::BitVector::all ( ) const
inline

all - Returns true if all bits are set.

Definition at line 189 of file BitVector.h.

◆ any()

bool llvm::BitVector::any ( ) const
inline

◆ anyCommon()

bool llvm::BitVector::anyCommon ( const BitVector RHS) const
inline

Test if any common bits are set.

Definition at line 507 of file BitVector.h.

References size().

Referenced by isDebug(), and llvm::safestack::StackColoring::LiveRange::Overlaps().

◆ clear()

void llvm::BitVector::clear ( )
inline

◆ clearBitsInMask()

void llvm::BitVector::clearBitsInMask ( const uint32_t Mask,
unsigned  MaskWords = ~0u 
)
inline

clearBitsInMask - Clear any bits in this vector that are set in Mask.

Don't resize. This computes "*this &= ~Mask".

Definition at line 765 of file BitVector.h.

References llvm::BitmaskEnumDetail::Mask().

◆ clearBitsNotInMask()

void llvm::BitVector::clearBitsNotInMask ( const uint32_t Mask,
unsigned  MaskWords = ~0u 
)
inline

◆ count()

size_type llvm::BitVector::count ( ) const
inline

◆ empty()

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

◆ find_first()

int llvm::BitVector::find_first ( ) const
inline

◆ find_first_in()

int llvm::BitVector::find_first_in ( unsigned  Begin,
unsigned  End 
) const
inline

find_first_in - Returns the index of the first set bit in the range [Begin, End).

Returns -1 if all bits in the range are unset.

Definition at line 208 of file BitVector.h.

References assert(), and llvm::countTrailingZeros().

◆ find_first_unset()

int llvm::BitVector::find_first_unset ( ) const
inline

find_first_unset - Returns the index of the first unset bit, -1 if all of the bits are set.

Definition at line 348 of file BitVector.h.

◆ find_first_unset_in()

int llvm::BitVector::find_first_unset_in ( unsigned  Begin,
unsigned  End 
) const
inline

find_first_unset_in - Returns the index of the first unset bit in the range [Begin, End).

Returns -1 if all bits in the range are set.

Definition at line 268 of file BitVector.h.

References assert(), and llvm::countTrailingOnes().

◆ find_last()

int llvm::BitVector::find_last ( ) const
inline

find_last - Returns the index of the last set bit, -1 if none of the bits are set.

Definition at line 336 of file BitVector.h.

Referenced by llvm::pdb::UDTLayoutBase::initializeChildren(), and llvm::pdb::LayoutItemBase::tailPadding().

◆ find_last_in()

int llvm::BitVector::find_last_in ( unsigned  Begin,
unsigned  End 
) const
inline

find_last_in - Returns the index of the last set bit in the range [Begin, End).

Returns -1 if all bits in the range are unset.

Definition at line 237 of file BitVector.h.

References assert(), and llvm::countLeadingZeros().

◆ find_last_unset()

int llvm::BitVector::find_last_unset ( ) const
inline

find_last_unset - Returns the index of the last unset bit, -1 if all of the bits are set.

Definition at line 358 of file BitVector.h.

◆ find_last_unset_in()

int llvm::BitVector::find_last_unset_in ( unsigned  Begin,
unsigned  End 
) const
inline

find_last_unset_in - Returns the index of the last unset bit in the range [Begin, End).

Returns -1 if all bits in the range are set.

Definition at line 299 of file BitVector.h.

References assert(), and llvm::countLeadingOnes().

◆ find_next()

int llvm::BitVector::find_next ( unsigned  Prev) const
inline

◆ find_next_unset()

int llvm::BitVector::find_next_unset ( unsigned  Prev) const
inline

find_next_unset - Returns the index of the next unset bit following the "Prev" bit.

Returns -1 if all remaining bits are set.

Definition at line 352 of file BitVector.h.

◆ find_prev()

int llvm::BitVector::find_prev ( unsigned  PriorTo) const
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 344 of file BitVector.h.

◆ find_prev_unset()

int llvm::BitVector::find_prev_unset ( unsigned  PriorTo)
inline

find_prev_unset - Returns the index of the first unset bit that precedes the bit at PriorTo.

Returns -1 if all previous bits are set.

Definition at line 362 of file BitVector.h.

◆ flip() [1/2]

BitVector& llvm::BitVector::flip ( )
inline

Definition at line 478 of file BitVector.h.

Referenced by addLiveInRegs(), and llvm::TargetRegisterInfo::getAllocatableSet().

◆ flip() [2/2]

BitVector& llvm::BitVector::flip ( unsigned  Idx)
inline

Definition at line 485 of file BitVector.h.

◆ getBitCapacity()

size_t llvm::BitVector::getBitCapacity ( ) const
inline

Definition at line 911 of file BitVector.h.

References llvm::ArrayRef< T >::size().

◆ getMemorySize()

size_t llvm::BitVector::getMemorySize ( ) const
inline

Return the size (in bytes) of the bit vector.

Definition at line 910 of file BitVector.h.

References llvm::ArrayRef< T >::size().

Referenced by llvm::capacity_in_bytes().

◆ none()

bool llvm::BitVector::none ( ) const
inline

◆ operator &=()

BitVector& llvm::BitVector::operator&= ( const BitVector RHS)
inline

Intersection, union, disjoint union.

Definition at line 543 of file BitVector.h.

References for(), and size().

◆ operator!=()

bool llvm::BitVector::operator!= ( const BitVector RHS) const
inline

Definition at line 538 of file BitVector.h.

◆ operator<<=()

BitVector& llvm::BitVector::operator<<= ( unsigned  N)
inline

Definition at line 651 of file BitVector.h.

References assert(), I, LLVM_UNLIKELY, and llvm::BitmaskEnumDetail::Mask().

◆ operator=() [1/2]

const BitVector& llvm::BitVector::operator= ( const BitVector RHS)
inline

Definition at line 702 of file BitVector.h.

References assert(), llvm::MutableArrayRef< T >::data(), and size().

◆ operator=() [2/2]

const BitVector& llvm::BitVector::operator= ( BitVector &&  RHS)
inline

Definition at line 727 of file BitVector.h.

References llvm::MutableArrayRef< T >::data().

◆ operator==()

bool llvm::BitVector::operator== ( const BitVector RHS) const
inline

Definition at line 517 of file BitVector.h.

References size().

◆ operator>>=()

BitVector& llvm::BitVector::operator>>= ( unsigned  N)
inline

Definition at line 602 of file BitVector.h.

References assert(), I, LLVM_UNLIKELY, and llvm::BitmaskEnumDetail::Mask().

◆ operator[]() [1/2]

reference llvm::BitVector::operator[] ( unsigned  Idx)
inline

Definition at line 491 of file BitVector.h.

References assert().

Referenced by isDebug().

◆ operator[]() [2/2]

bool llvm::BitVector::operator[] ( unsigned  Idx) const
inline

Definition at line 496 of file BitVector.h.

References assert(), and llvm::BitmaskEnumDetail::Mask().

◆ operator^=()

BitVector& llvm::BitVector::operator^= ( const BitVector RHS)
inline

Definition at line 594 of file BitVector.h.

References size().

◆ operator|=()

BitVector& llvm::BitVector::operator|= ( const BitVector RHS)
inline

Definition at line 586 of file BitVector.h.

References size().

Referenced by isDebug().

◆ reserve()

void llvm::BitVector::reserve ( unsigned  N)
inline

Definition at line 392 of file BitVector.h.

Referenced by llvm::SmallBitVector::reserve().

◆ reset() [1/4]

BitVector& llvm::BitVector::reset ( )
inline

◆ reset() [2/4]

BitVector& llvm::BitVector::reset ( unsigned  Idx)
inline

Definition at line 444 of file BitVector.h.

◆ reset() [3/4]

BitVector& llvm::BitVector::reset ( unsigned  I,
unsigned  E 
)
inline

reset - Efficiently reset a range of bits in [I, E)

Definition at line 450 of file BitVector.h.

References llvm::alignTo(), assert(), E, and llvm::BitmaskEnumDetail::Mask().

◆ reset() [4/4]

BitVector& llvm::BitVector::reset ( const BitVector RHS)
inline

reset - Reset bits that are set in RHS. Same as *this &= ~RHS.

Definition at line 560 of file BitVector.h.

References size().

◆ resize()

void llvm::BitVector::resize ( unsigned  N,
bool  t = false 
)
inline

◆ set() [1/3]

BitVector& llvm::BitVector::set ( )
inline

Definition at line 398 of file BitVector.h.

Referenced by addLiveInRegs(), llvm::safestack::StackColoring::LiveRange::AddRange(), llvm::LiveRegUnits::addReg(), llvm::LiveRegUnits::addRegMasked(), llvm::LiveRegUnits::addRegsInMask(), llvm::pdb::BaseClassLayout::BaseClassLayout(), llvm::TargetRegisterInfo::checkAllSuperRegsMarked(), checkNumAlignedDPRCS2Regs(), llvm::pdb::ClassLayout::ClassLayout(), llvm::SplitAnalysis::clear(), collectChangingRegs(), llvm::createDwarfEHPass(), CriticalPathStep(), llvm::SystemZFrameLowering::determineCalleeSaves(), llvm::ARCFrameLowering::determineCalleeSaves(), llvm::Mips16FrameLowering::determineCalleeSaves(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::AArch64FrameLowering::determineCalleeSaves(), llvm::HexagonFrameLowering::determineCalleeSaves(), llvm::X86FrameLowering::determineCalleeSaves(), llvm::TargetFrameLowering::determineCalleeSaves(), llvm::RegScavenger::enterBasicBlockEnd(), finalizeFpmBlockStatus(), getAllocatableSetForRC(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getInterleavedMemoryOpCost(), llvm::R600RegisterInfo::getReservedRegs(), llvm::BPFRegisterInfo::getReservedRegs(), llvm::MSP430RegisterInfo::getReservedRegs(), llvm::SparcRegisterInfo::getReservedRegs(), llvm::XCoreRegisterInfo::getReservedRegs(), llvm::ARCRegisterInfo::getReservedRegs(), llvm::AVRRegisterInfo::getReservedRegs(), llvm::LanaiRegisterInfo::getReservedRegs(), llvm::WebAssemblyRegisterInfo::getReservedRegs(), llvm::HexagonRegisterInfo::getReservedRegs(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::SystemZRegisterInfo::getReservedRegs(), llvm::X86RegisterInfo::getReservedRegs(), getStartOrEndSlot(), llvm::ScheduleDAGTopologicalSort::GetSubGraph(), hasPressureSet(), INITIALIZE_PASS(), InstructionStoresToFI(), isDebug(), isIrreducibleCFG(), llvm::TargetRegisterInfo::markSuperRegs(), false::IntervalSorter::operator()(), llvm::BranchFolder::OptimizeFunction(), llvm::optimizeGlobalCtorsList(), processShaderInputArgs(), llvm::safestack::StackColoring::removeAllMarkers(), llvm::SmallBitVector::reserve(), llvm::R600InstrInfo::reserveIndirectRegisters(), setAliasRegs(), llvm::LiveRangeCalc::setLiveOutValue(), llvm::SystemZRegisterInfo::shouldCoalesce(), llvm::SIRegisterInfo::SIRegisterInfo(), llvm::LiveDebugVariables::splitRegister(), llvm::WebAssemblyFunctionInfo::stackifyVReg(), swapAntiDependences(), and trackRegDefsUses().

◆ set() [2/3]

BitVector& llvm::BitVector::set ( unsigned  Idx)
inline

Definition at line 404 of file BitVector.h.

References assert(), and llvm::MutableArrayRef< T >::data().

◆ set() [3/3]

BitVector& llvm::BitVector::set ( unsigned  I,
unsigned  E 
)
inline

set - Efficiently set a range of bits in [I, E)

Definition at line 411 of file BitVector.h.

References llvm::alignTo(), assert(), E, and llvm::BitmaskEnumDetail::Mask().

◆ set_bits()

iterator_range<const_set_bits_iterator> llvm::BitVector::set_bits ( ) const
inline

◆ set_bits_begin()

const_set_bits_iterator llvm::BitVector::set_bits_begin ( ) const
inline

Definition at line 124 of file BitVector.h.

◆ set_bits_end()

const_set_bits_iterator llvm::BitVector::set_bits_end ( ) const
inline

Definition at line 127 of file BitVector.h.

◆ setBitsInMask()

void llvm::BitVector::setBitsInMask ( const uint32_t Mask,
unsigned  MaskWords = ~0u 
)
inline

setBitsInMask - Add '1' bits from Mask to this vector.

Don't resize. This computes "*this |= Mask".

Definition at line 759 of file BitVector.h.

References llvm::BitmaskEnumDetail::Mask().

Referenced by llvm::TargetLoweringBase::findRepresentativeClass(), and llvm::RegisterBank::RegisterBank().

◆ setBitsNotInMask()

void llvm::BitVector::setBitsNotInMask ( const uint32_t Mask,
unsigned  MaskWords = ~0u 
)
inline

setBitsNotInMask - Add a bit to this vector for every '0' bit in Mask.

Don't resize. This computes "*this |= ~Mask".

Definition at line 771 of file BitVector.h.

References llvm::BitmaskEnumDetail::Mask().

Referenced by llvm::MachineRegisterInfo::addPhysRegsUsedFromRegMask(), collectChangingRegs(), InstructionStoresToFI(), and trackRegDefsUses().

◆ size()

size_type llvm::BitVector::size ( ) const
inline

◆ swap()

void llvm::BitVector::swap ( BitVector RHS)
inline

Definition at line 740 of file BitVector.h.

References std::swap().

Referenced by std::swap().

◆ test() [1/2]

bool llvm::BitVector::test ( unsigned  Idx) const
inline

Definition at line 502 of file BitVector.h.

Referenced by addLiveInRegs(), llvm::msf::MSFBuilder::addStream(), assignCalleeSavedSpillSlots(), llvm::LiveRegUnits::available(), llvm::CriticalAntiDepBreaker::BreakAntiDependencies(), llvm::AggressiveAntiDepBreaker::BreakAntiDependencies(), llvm::LiveRangeCalc::calculateValues(), llvm::MachineRegisterInfo::canReserveReg(), llvm::Thumb1FrameLowering::canUseAsEpilogue(), checkNumAlignedDPRCS2Regs(), llvm::LiveRegMatrix::checkRegMaskInterference(), llvm::RegisterBank::covers(), llvm::LiveRangeCalc::createDeadDefs(), llvm::createGenericSchedPostRA(), llvm::createGreedyRegisterAllocator(), llvm::createRegUsageInfoCollector(), CriticalPathStep(), llvm::SystemZFrameLowering::determineCalleeSaves(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::AArch64FrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineCalleeSaves(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), finalizeFpmBlockStatus(), findNextInsertLocation(), llvm::PPCRegisterInfo::getCalleeSavedRegsViaCopy(), llvm::pdb::PDBFileBuilder::getNamedStreamIndex(), llvm::RegScavenger::getRegsAvailable(), llvm::ARMBaseRegisterInfo::getReservedRegs(), getStartOrEndSlot(), llvm::ScheduleDAGTopologicalSort::GetSubGraph(), INITIALIZE_PASS(), InstructionStoresToFI(), isACalleeSavedRegister(), llvm::PPCRegisterInfo::isCallerPreservedPhysReg(), isDebug(), llvm::MachineRegisterInfo::isPhysRegModified(), llvm::MachineRegisterInfo::isPhysRegUsed(), llvm::MachineRegisterInfo::isReserved(), llvm::SIRegisterInfo::isSGPRPressureSet(), llvm::SplitAnalysis::isThroughBlock(), llvm::SIRegisterInfo::isVGPRPressureSet(), llvm::WebAssemblyFunctionInfo::isVRegStackified(), llvm::safestack::StackColoring::removeAllMarkers(), llvm::safestack::StackColoring::run(), llvm::RegisterClassInfo::runOnMachineFunction(), scavengeStackSlot(), llvm::CriticalAntiDepBreaker::StartBlock(), llvm::AggressiveAntiDepBreaker::StartBlock(), swapAntiDependences(), and llvm::MachineFunctionProperties::verifyRequiredProperties().

◆ test() [2/2]

bool llvm::BitVector::test ( const BitVector RHS) const
inline

test - Check if (This - RHS) is zero.

This is the same as reset(RHS) and any().

Definition at line 571 of file BitVector.h.

References size().


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