Otawa
0.10
|
This class implements a set as a bit vector. More...
#include <otawa/dfa/BitSet.h>
Classes | |
class | Iterator |
Iterator on the item contained in a bit set. More... | |
Public Member Functions | |
BitSet (void) | |
BitSet (int size) | |
Build a bitset with the given size. More... | |
BitSet (const BitSet &set) | |
Build a bit set from by copying an existing one. More... | |
~BitSet (void) | |
bool | isEmpty (void) const |
Test if the bit set is empty. More... | |
bool | isFull (void) const |
Test if the bit set contains all existing items. More... | |
void | fill (void) |
Fill the bit set with all items. More... | |
void | empty (void) |
Remove all items from the bit set. More... | |
bool | contains (int index) const |
Test if the bit set contains an item. More... | |
void | add (int index) |
Add an item to the bit set. More... | |
void | remove (int index) |
Remove an item from the bit set. More... | |
bool | equals (const BitSet &set) const |
Test if two bit sets are equals. More... | |
bool | includes (const BitSet &set) const |
Test if the current bit set contains the given one. More... | |
bool | includesStrictly (const BitSet &set) const |
Test if the current bit set contains strictly the given one, that is, both bit sets are equals. More... | |
void | complement (void) |
Complement the current bit set. More... | |
int | size (void) const |
void | add (const BitSet &set) |
Add the items of the given bit set to the current one. More... | |
void | remove (const BitSet &set) |
Remove the items contained in the given bit set from the current one. More... | |
void | mask (const BitSet &set) |
Keep only in this set the items also containted in the given one (performs intersection operation). More... | |
int | count (void) const |
BitSet | doComp (void) const |
Compute a bit set complement of the current one. More... | |
BitSet | doUnion (const BitSet &set) const |
Build a new bit set as union between the current and the given one. More... | |
BitSet | doInter (const BitSet &set) const |
Build a new bit set as intersection between the current and the given one. More... | |
BitSet | doDiff (const BitSet &set) const |
Build a new bit set as difference between the current and the given one. More... | |
BitSet & | operator= (const BitSet &set) |
Assignment with bit sets. More... | |
BitSet & | operator+= (int index) |
Same as add(int). More... | |
BitSet & | operator+= (const BitSet &set) |
Same as add(const BitSet&). More... | |
BitSet & | operator-= (int index) |
Same as remove(int). More... | |
BitSet & | operator-= (const BitSet &set) |
Same as remove(const BitSet&). More... | |
BitSet | operator+ (const BitSet &set) |
Same as doUnion(). More... | |
BitSet | operator- (const BitSet &set) |
Same as doDiff(). More... | |
BitSet & | operator|= (const BitSet &set) |
Same as add(const BitSet&). More... | |
BitSet & | operator&= (const BitSet &set) |
Same as remove(const BitSet&). More... | |
BitSet | operator| (const BitSet &set) |
Same as doUnion(). More... | |
BitSet | operator& (const BitSet &set) |
Same as doInter(). More... | |
bool | operator== (const BitSet &set) const |
Same as equals(). More... | |
bool | operator!= (const BitSet &set) const |
Same as !equals(). More... | |
bool | operator>= (const BitSet &set) const |
Same as includes(). More... | |
bool | operator<= (const BitSet &set) const |
Same as !includesStrictly(). More... | |
bool | operator> (const BitSet &set) const |
Same as includesStrictly(). More... | |
bool | operator< (const BitSet &set) const |
Same as !includes(). More... | |
Static Public Attributes | |
static int | __used_size = 0 |
static int | __max_size = 0 |
static int | __total_size = 0 |
Private Types | |
typedef elm::BitVector | vec_t |
Private Member Functions | |
BitSet (const vec_t &ivec) | |
Private Attributes | |
vec_t | vec |
This class implements a set as a bit vector.
You must assign each object of the set to an index in the bit vector and use it to process sets containing it.
|
private |
|
inline |
References OTAWA_BITSET_ALLOC.
|
inline |
Build a bitset with the given size.
size | Maximum set item count. |
References OTAWA_BITSET_ALLOC.
|
inline |
Build a bit set from by copying an existing one.
set | Set to copy. |
References OTAWA_BITSET_ALLOC.
|
inline |
References OTAWA_BITSET_FREE.
|
inlineprivate |
|
inline |
Add an item to the bit set.
index | Index identifying the added item. |
References OTAWA_BITSET_ALLOC, OTAWA_BITSET_FREE, elm::BitVector::set(), and vec.
Referenced by otawa::cat::CATBuilder::buildLBLOCKSET(), otawa::ccg::Problem::gen(), otawa::cat::CATProblem::gen(), otawa::ccg::Domain::join(), otawa::cat::CATDomain::join(), otawa::bpred::BPredProcessor::lshift_BitSet(), operator+=(), operator|=(), otawa::bpred::BPredProcessor::setMitraInit(), and otawa::dcache::DirtyManager::update().
|
inline |
Add the items of the given bit set to the current one.
set | Set to add. |
References elm::BitVector::applyOr(), OTAWA_BITSET_ALLOC, OTAWA_BITSET_FREE, and vec.
|
inline |
Complement the current bit set.
References elm::BitVector::applyNot(), and vec.
Referenced by otawa::cat::CATProblem::preserve().
|
inline |
Test if the bit set contains an item.
index | Index identifying the looked item. |
References elm::BitVector::bit(), and vec.
Referenced by otawa::bpred::BPredProcessor::BitSet_to_String(), otawa::Dominance::dominates(), otawa::bpred::BPredProcessor::lshift_BitSet(), otawa::dcache::DirtyManager::t::mayBeDirty(), otawa::dcache::DirtyManager::mayBeDirty(), otawa::dcache::DirtyManager::t::mustBeDirty(), otawa::dcache::DirtyManager::mustBeDirty(), otawa::dfa::operator<<(), otawa::PostDominance::postDominates(), otawa::dcache::DirtyManager::t::print(), otawa::ccg::Builder::processLBlockSet(), otawa::LoopReductor::reduce(), otawa::cat::CATBuilder::setCATEGORISATION(), and otawa::cat::CATBuilder::worst().
|
inline |
References elm::BitVector::countBits(), and vec.
Referenced by otawa::ccg::Problem::gen(), otawa::cat::CATProblem::gen(), otawa::LoopReductor::reduce(), and otawa::cat::CATBuilder::worst().
|
inline |
Compute a bit set complement of the current one.
References BitSet(), elm::BitVector::makeNot(), and vec.
Build a new bit set as difference between the current and the given one.
set | Set to do difference with. |
References BitSet(), elm::BitVector::makeReset(), and vec.
Referenced by operator-().
Build a new bit set as intersection between the current and the given one.
set | Set to do intersection with. |
References BitSet(), elm::BitVector::makeAnd(), and vec.
Referenced by operator&().
Build a new bit set as union between the current and the given one.
set | Set to do union with. |
References BitSet(), elm::BitVector::makeOr(), and vec.
Referenced by operator+(), and operator|().
|
inline |
Remove all items from the bit set.
References elm::BitVector::clear(), and vec.
Referenced by otawa::dcache::DirtyManager::DirtyManager(), otawa::bpred::BPredProcessor::lshift_BitSet(), otawa::ccg::Domain::reset(), otawa::cat::CATDomain::reset(), and otawa::dcache::DirtyManager::update().
|
inline |
Test if two bit sets are equals.
set | Bit set to compare the current one with. |
References elm::BitVector::equals(), and vec.
Referenced by otawa::ccg::Domain::equals(), otawa::dcache::DirtyManager::equals(), operator!=(), and operator==().
|
inline |
Fill the bit set with all items.
References elm::BitVector::set(), and vec.
Referenced by otawa::dcache::DirtyManager::DirtyManager(), otawa::ccg::Problem::preserve(), otawa::cat::CATProblem::preserve(), and otawa::dcache::DirtyManager::update().
|
inline |
Test if the current bit set contains the given one.
set | Set to test for inclusion. |
References elm::BitVector::includes(), and vec.
Referenced by operator<=(), and operator>=().
|
inline |
Test if the current bit set contains strictly the given one, that is, both bit sets are equals.
set | Set to test for inclusion. |
References elm::BitVector::includesStrictly(), and vec.
Referenced by operator<(), and operator>().
|
inline |
Test if the bit set is empty.
References elm::BitVector::isEmpty(), and vec.
|
inline |
Test if the bit set contains all existing items.
References elm::BitVector::countBits(), elm::BitVector::size(), and vec.
|
inline |
Keep only in this set the items also containted in the given one (performs intersection operation).
set | Set to intersect with. |
References elm::BitVector::applyAnd(), OTAWA_BITSET_ALLOC, OTAWA_BITSET_FREE, and vec.
Referenced by otawa::ccg::Domain::meet(), otawa::cat::CATDomain::meet(), operator&=(), and otawa::cat::CATBuilder::worst().
|
inline |
Same as remove(const BitSet&).
References mask().
Same as add(const BitSet&).
References add().
|
inline |
Same as remove(int).
Same as remove(const BitSet&).
|
inline |
Same as !includes().
References includesStrictly().
|
inline |
Same as !includesStrictly().
References includes().
Assignment with bit sets.
set | Set to assign. |
References OTAWA_BITSET_ALLOC, OTAWA_BITSET_FREE, and vec.
|
inline |
|
inline |
Same as includesStrictly().
References includesStrictly().
|
inline |
Same as includes().
References includes().
Same as add(const BitSet&).
References add().
|
inline |
Remove an item from the bit set.
index | Index identifying the removed item. |
References elm::BitVector::clear(), OTAWA_BITSET_ALLOC, OTAWA_BITSET_FREE, and vec.
Referenced by otawa::cat::CATProblem::preserve(), otawa::LoopReductor::reduce(), otawa::dcache::DirtyManager::update(), and otawa::cat::CATBuilder::worst().
|
inline |
Remove the items contained in the given bit set from the current one.
set | Set containing items to remove. |
References elm::BitVector::applyReset(), OTAWA_BITSET_ALLOC, OTAWA_BITSET_FREE, and vec.
|
inline |
|
static |
|
static |
|
static |
|
private |
Referenced by add(), complement(), contains(), count(), doComp(), doDiff(), doInter(), doUnion(), empty(), equals(), fill(), includes(), includesStrictly(), isEmpty(), isFull(), mask(), operator=(), remove(), and size().