Static Value-Flow Analysis
|
#include <CoreBitVector.h>
Classes | |
class | CoreBitVectorIterator |
Public Types | |
typedef unsigned long long | Word |
typedef CoreBitVectorIterator | const_iterator |
typedef const_iterator | iterator |
Public Member Functions | |
CoreBitVector (void) | |
Construct empty CBV. | |
CoreBitVector (size_t n) | |
Construct empty CBV with space reserved for n Words. | |
CoreBitVector (const CoreBitVector &cbv) | |
Copy constructor. | |
CoreBitVector (CoreBitVector &&cbv) | |
Move constructor. | |
CoreBitVector & | operator= (const CoreBitVector &rhs) |
Copy assignment. | |
CoreBitVector & | operator= (CoreBitVector &&rhs) |
Move assignment. | |
bool | empty (void) const |
Returns true if no bits are set. | |
u32_t | count (void) const |
Returns number of bits set. | |
void | clear (void) |
Empty the CBV. | |
bool | test (u32_t bit) const |
Returns true if bit is set in this CBV. | |
bool | test_and_set (u32_t bit) |
void | set (u32_t bit) |
Sets bit in the CBV. | |
void | reset (u32_t bit) |
Resets bit in the CBV. | |
bool | contains (const CoreBitVector &rhs) const |
Returns true if this CBV is a superset of rhs. | |
bool | intersects (const CoreBitVector &rhs) const |
Returns true if this CBV and rhs share any set bits. | |
bool | operator== (const CoreBitVector &rhs) const |
Returns true if this CBV and rhs have the same bits set. | |
bool | operator!= (const CoreBitVector &rhs) const |
Returns true if either this CBV or rhs has a bit set unique to the other. | |
bool | operator|= (const CoreBitVector &rhs) |
bool | operator&= (const CoreBitVector &rhs) |
bool | operator-= (const CoreBitVector &rhs) |
bool | intersectWithComplement (const CoreBitVector &rhs) |
void | intersectWithComplement (const CoreBitVector &lhs, const CoreBitVector &rhs) |
Put intersection of lhs with complement of rhs into this CBV. | |
size_t | hash (void) const |
Hash for this CBV. | |
const_iterator | begin (void) const |
const_iterator | end (void) const |
Static Public Attributes | |
static const size_t | WordSize = sizeof(Word) * CHAR_BIT |
Private Member Functions | |
void | extendBackward (u32_t bit) |
Add enough words (prepend) to be able to include bit. | |
void | extendForward (u32_t bit) |
Add enough words (append) to be able to include bit. | |
void | extendTo (u32_t bit) |
Add enough words (append xor prepend) to be able to include bit. | |
size_t | indexForBit (u32_t bit) const |
Returns the index into words which would hold bit. | |
bool | canHold (u32_t bit) const |
Returns true if bit can fit in this CBV without resizing. | |
u32_t | finalBit (void) const |
Returns the last bit that this CBV can hold. | |
u32_t | firstCommonBit (const CoreBitVector &rhs) const |
Returns the first bit position that both this CBV and rhs can hold. | |
size_t | nextSetIndex (const size_t start) const |
Private Attributes | |
u32_t | offset |
The first bit of the first word. | |
std::vector< Word > | words |
Our actual bit vector. | |
A contiguous bit vector that only contains what it needs according to the operations carried. For example, when two bit vectors are unioned, their sizes may be increased to fit all the bits from the other set. This implementation never shrinks. Since points-to sets (generally) grow monotonically, does not have too big an impact on points-to analysis and so it isn't implemented. Abbreviated CBV.
Definition at line 30 of file CoreBitVector.h.
Definition at line 37 of file CoreBitVector.h.
Definition at line 38 of file CoreBitVector.h.
Definition at line 33 of file CoreBitVector.h.
SVF::CoreBitVector::CoreBitVector | ( | void | ) |
Construct empty CBV.
Definition at line 24 of file CoreBitVector.cpp.
SVF::CoreBitVector::CoreBitVector | ( | size_t | n | ) |
Construct empty CBV with space reserved for n Words.
Definition at line 27 of file CoreBitVector.cpp.
SVF::CoreBitVector::CoreBitVector | ( | const CoreBitVector & | cbv | ) |
Copy constructor.
Definition at line 30 of file CoreBitVector.cpp.
SVF::CoreBitVector::CoreBitVector | ( | CoreBitVector && | cbv | ) |
Move constructor.
Definition at line 33 of file CoreBitVector.cpp.
CoreBitVector::const_iterator SVF::CoreBitVector::begin | ( | void | ) | const |
Definition at line 315 of file CoreBitVector.cpp.
Returns true if bit can fit in this CBV without resizing.
Definition at line 366 of file CoreBitVector.cpp.
void SVF::CoreBitVector::clear | ( | void | ) |
Empty the CBV.
Definition at line 65 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::contains | ( | const CoreBitVector & | rhs | ) | const |
Returns true if this CBV is a superset of rhs.
Definition at line 105 of file CoreBitVector.cpp.
u32_t SVF::CoreBitVector::count | ( | void | ) | const |
bool SVF::CoreBitVector::empty | ( | void | ) | const |
Returns true if no bits are set.
Definition at line 50 of file CoreBitVector.cpp.
CoreBitVector::const_iterator SVF::CoreBitVector::end | ( | void | ) | const |
Definition at line 310 of file CoreBitVector.cpp.
|
private |
Add enough words (prepend) to be able to include bit.
Definition at line 320 of file CoreBitVector.cpp.
|
private |
Add enough words (append) to be able to include bit.
Definition at line 333 of file CoreBitVector.cpp.
|
private |
Add enough words (append xor prepend) to be able to include bit.
Definition at line 347 of file CoreBitVector.cpp.
|
private |
Returns the last bit that this CBV can hold.
Definition at line 371 of file CoreBitVector.cpp.
|
private |
Returns the first bit position that both this CBV and rhs can hold.
size_t SVF::CoreBitVector::hash | ( | void | ) | const |
Returns the index into words which would hold bit.
Definition at line 358 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::intersects | ( | const CoreBitVector & | rhs | ) | const |
Returns true if this CBV and rhs share any set bits.
Definition at line 112 of file CoreBitVector.cpp.
void SVF::CoreBitVector::intersectWithComplement | ( | const CoreBitVector & | lhs, |
const CoreBitVector & | rhs | ||
) |
Put intersection of lhs with complement of rhs into this CBV.
Definition at line 291 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::intersectWithComplement | ( | const CoreBitVector & | rhs | ) |
Put intersection of this CBV with complement of rhs into this CBV. Returns true if this CBV changed.
Definition at line 286 of file CoreBitVector.cpp.
Returns the next index in the words array at or after start which contains set bits. This index and start are indices into the words array not accounting for the offset. Returns a value greater than or equal to words.size() when there are no more set bits.
Definition at line 376 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::operator!= | ( | const CoreBitVector & | rhs | ) | const |
Returns true if either this CBV or rhs has a bit set unique to the other.
Definition at line 169 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::operator&= | ( | const CoreBitVector & | rhs | ) |
Put intersection of this CBV and rhs into this CBV. Returns true if CBV changed.
Definition at line 214 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::operator-= | ( | const CoreBitVector & | rhs | ) |
Remove set bits in rhs from this CBV. Returns true if CBV changed.
Definition at line 263 of file CoreBitVector.cpp.
CoreBitVector & SVF::CoreBitVector::operator= | ( | const CoreBitVector & | rhs | ) |
CoreBitVector & SVF::CoreBitVector::operator= | ( | CoreBitVector && | rhs | ) |
bool SVF::CoreBitVector::operator== | ( | const CoreBitVector & | rhs | ) | const |
Returns true if this CBV and rhs have the same bits set.
Definition at line 141 of file CoreBitVector.cpp.
bool SVF::CoreBitVector::operator|= | ( | const CoreBitVector & | rhs | ) |
Put union of this CBV and rhs into this CBV. Returns true if CBV changed.
Definition at line 174 of file CoreBitVector.cpp.
void SVF::CoreBitVector::reset | ( | u32_t | bit | ) |
void SVF::CoreBitVector::set | ( | u32_t | bit | ) |
Sets bit in the CBV.
Definition at line 88 of file CoreBitVector.cpp.
Check if bit is set. If it is, returns false. Otherwise, sets bit and returns true.
Definition at line 80 of file CoreBitVector.cpp.
|
private |
The first bit of the first word.
Definition at line 198 of file CoreBitVector.h.
|
private |
Our actual bit vector.
Definition at line 200 of file CoreBitVector.h.
Definition at line 34 of file CoreBitVector.h.