LLVM  4.0.0
Classes | Public Types | Public Member Functions | List of all members
llvm::SmallBitVector Class Reference

This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is small. More...

#include <SmallBitVector.h>

Classes

class  reference
 

Public Types

typedef unsigned size_type
 

Public Member Functions

 SmallBitVector ()
 Creates an empty bitvector. More...
 
 SmallBitVector (unsigned s, bool t=false)
 Creates a bitvector of specified number of bits. More...
 
 SmallBitVector (const SmallBitVector &RHS)
 SmallBitVector copy ctor. More...
 
 SmallBitVector (SmallBitVector &&RHS)
 
 ~SmallBitVector ()
 
bool empty () const
 Tests whether there are no bits in this bitvector. More...
 
size_t size () const
 Returns the number of bits in this bitvector. More...
 
size_type count () const
 Returns the number of bits which are set. More...
 
bool any () const
 Returns true if any bit is set. More...
 
bool all () const
 Returns true if all bits are set. More...
 
bool none () const
 Returns true if none of the bits are set. More...
 
int find_first () const
 Returns the index of the first set bit, -1 if none of the bits are set. More...
 
int find_next (unsigned Prev) const
 Returns the index of the next set bit following the "Prev" bit. More...
 
void clear ()
 Clear all bits. More...
 
void resize (unsigned N, bool t=false)
 Grow or shrink the bitvector. More...
 
void reserve (unsigned N)
 
SmallBitVectorset ()
 
SmallBitVectorset (unsigned Idx)
 
SmallBitVectorset (unsigned I, unsigned E)
 Efficiently set a range of bits in [I, E) More...
 
SmallBitVectorreset ()
 
SmallBitVectorreset (unsigned Idx)
 
SmallBitVectorreset (unsigned I, unsigned E)
 Efficiently reset a range of bits in [I, E) More...
 
SmallBitVectorflip ()
 
SmallBitVectorflip (unsigned Idx)
 
SmallBitVector operator~ () const
 
reference operator[] (unsigned Idx)
 
bool operator[] (unsigned Idx) const
 
bool test (unsigned Idx) const
 
bool anyCommon (const SmallBitVector &RHS) const
 Test if any common bits are set. More...
 
bool operator== (const SmallBitVector &RHS) const
 
bool operator!= (const SmallBitVector &RHS) const
 
SmallBitVectoroperator&= (const SmallBitVector &RHS)
 
SmallBitVectorreset (const SmallBitVector &RHS)
 Reset bits that are set in RHS. Same as *this &= ~RHS. More...
 
bool test (const SmallBitVector &RHS) const
 Check if (This - RHS) is zero. This is the same as reset(RHS) and any(). More...
 
SmallBitVectoroperator|= (const SmallBitVector &RHS)
 
SmallBitVectoroperator^= (const SmallBitVector &RHS)
 
const SmallBitVectoroperator= (const SmallBitVector &RHS)
 
const SmallBitVectoroperator= (SmallBitVector &&RHS)
 
void swap (SmallBitVector &RHS)
 
void setBitsInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 Add '1' bits from Mask to this vector. More...
 
void clearBitsInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 Clear any bits in this vector that are set in Mask. More...
 
void setBitsNotInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 Add a bit to this vector for every '0' bit in Mask. More...
 
void clearBitsNotInMask (const uint32_t *Mask, unsigned MaskWords=~0u)
 Clear a bit in this vector for every '0' bit in Mask. More...
 

Detailed Description

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 28 of file SmallBitVector.h.

Member Typedef Documentation

Definition at line 54 of file SmallBitVector.h.

Constructor & Destructor Documentation

llvm::SmallBitVector::SmallBitVector ( )
inline

Creates an empty bitvector.

Definition at line 140 of file SmallBitVector.h.

Referenced by operator~().

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

Creates a bitvector of specified number of bits.

All bits are initialized to the specified value.

Definition at line 144 of file SmallBitVector.h.

References t.

llvm::SmallBitVector::SmallBitVector ( const SmallBitVector RHS)
inline

SmallBitVector copy ctor.

Definition at line 152 of file SmallBitVector.h.

llvm::SmallBitVector::SmallBitVector ( SmallBitVector &&  RHS)
inline

Definition at line 159 of file SmallBitVector.h.

llvm::SmallBitVector::~SmallBitVector ( )
inline

Definition at line 163 of file SmallBitVector.h.

Member Function Documentation

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

Returns true if all bits are set.

Definition at line 195 of file SmallBitVector.h.

References llvm::BitVector::all().

Referenced by lowerVectorShuffle(), and lowerVectorShuffleWithSSE4A().

bool llvm::SmallBitVector::any ( ) const
inline
bool llvm::SmallBitVector::anyCommon ( const SmallBitVector RHS) const
inline

Test if any common bits are set.

Definition at line 380 of file SmallBitVector.h.

References llvm::BitVector::anyCommon(), i, fuzzer::min(), size(), and test().

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

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

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

Definition at line 523 of file SmallBitVector.h.

References llvm::BitVector::clearBitsInMask(), and llvm::BitmaskEnumDetail::Mask().

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

Clear a bit in this vector for every '0' bit in Mask.

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

Definition at line 541 of file SmallBitVector.h.

References llvm::BitVector::clearBitsNotInMask(), and llvm::BitmaskEnumDetail::Mask().

size_type llvm::SmallBitVector::count ( ) const
inline
bool llvm::SmallBitVector::empty ( ) const
inline

Tests whether there are no bits in this bitvector.

Definition at line 169 of file SmallBitVector.h.

References llvm::BitVector::empty().

Referenced by getTargetConstantBitsFromNode().

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

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

Definition at line 209 of file SmallBitVector.h.

References llvm::tgtok::Bits, llvm::countTrailingZeros(), and llvm::BitVector::find_first().

Referenced by llvm::DependenceInfo::depends(), dumpSmallBitVector(), EltsFromConsecutiveLoads(), and llvm::DependenceInfo::getSplitIteration().

int llvm::SmallBitVector::find_next ( unsigned  Prev) const
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 221 of file SmallBitVector.h.

References llvm::tgtok::Bits, llvm::countTrailingZeros(), and llvm::BitVector::find_next().

Referenced by llvm::DependenceInfo::depends(), dumpSmallBitVector(), and llvm::DependenceInfo::getSplitIteration().

SmallBitVector& llvm::SmallBitVector::flip ( )
inline

Definition at line 341 of file SmallBitVector.h.

References llvm::BitVector::flip().

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

Definition at line 349 of file SmallBitVector.h.

References llvm::BitVector::flip().

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

Returns true if none of the bits are set.

Definition at line 202 of file SmallBitVector.h.

References llvm::BitVector::none().

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

Definition at line 402 of file SmallBitVector.h.

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

Definition at line 407 of file SmallBitVector.h.

References resize(), and size().

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

Definition at line 483 of file SmallBitVector.h.

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

Definition at line 500 of file SmallBitVector.h.

References clear(), and swap().

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

Definition at line 393 of file SmallBitVector.h.

References size().

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

Definition at line 363 of file SmallBitVector.h.

References assert(), and size().

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

Definition at line 368 of file SmallBitVector.h.

References assert(), and size().

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

Definition at line 468 of file SmallBitVector.h.

References resize(), and size().

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

Definition at line 454 of file SmallBitVector.h.

References resize(), and size().

SmallBitVector llvm::SmallBitVector::operator~ ( ) const
inline

Definition at line 358 of file SmallBitVector.h.

References SmallBitVector().

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

Definition at line 257 of file SmallBitVector.h.

References i, llvm::BitVector::reserve(), and llvm::BitVector::set().

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

Definition at line 318 of file SmallBitVector.h.

References llvm::BitVector::reset().

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

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

Definition at line 327 of file SmallBitVector.h.

References assert(), E, I, llvm::BitmaskEnumDetail::Mask(), llvm::BitVector::reset(), and size().

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

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

Definition at line 422 of file SmallBitVector.h.

References i, fuzzer::min(), llvm::BitVector::reset(), reset(), size(), and test().

void llvm::SmallBitVector::resize ( unsigned  N,
bool  t = false 
)
inline
SmallBitVector& llvm::SmallBitVector::set ( )
inline
SmallBitVector& llvm::SmallBitVector::set ( unsigned  Idx)
inline

Definition at line 283 of file SmallBitVector.h.

References assert(), and llvm::BitVector::set().

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

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

Definition at line 296 of file SmallBitVector.h.

References assert(), E, I, llvm::BitmaskEnumDetail::Mask(), llvm::BitVector::set(), and size().

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

Add '1' bits from Mask to this vector.

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

Definition at line 514 of file SmallBitVector.h.

References llvm::BitmaskEnumDetail::Mask(), and llvm::BitVector::setBitsInMask().

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

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

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

Definition at line 532 of file SmallBitVector.h.

References llvm::BitmaskEnumDetail::Mask(), and llvm::BitVector::setBitsNotInMask().

size_t llvm::SmallBitVector::size ( ) const
inline
void llvm::SmallBitVector::swap ( SmallBitVector RHS)
inline

Definition at line 508 of file SmallBitVector.h.

References std::swap().

Referenced by operator=(), and std::swap().

bool llvm::SmallBitVector::test ( unsigned  Idx) const
inline
bool llvm::SmallBitVector::test ( const SmallBitVector RHS) const
inline

Check if (This - RHS) is zero. This is the same as reset(RHS) and any().

Definition at line 436 of file SmallBitVector.h.

References i, fuzzer::min(), size(), llvm::BitVector::test(), and test().


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