LLVM API Documentation
#include <SparseBitVector.h>


SparseBitVector is an implementation of a bitvector that is sparse by only storing the elements that have non-zero bits set. In order to make this fast for the most common cases, SparseBitVector is implemented as a linked list of SparseBitVectorElements. We maintain a pointer to the last SparseBitVectorElement accessed (in the form of a list iterator), in order to make multiple in-order test/set constant time after the first one is executed. Note that using vectors to store SparseBitVectorElement's does not work out very well because it causes insertion in the middle to take enormous amounts of time with a large amount of bits. Other structures that have better worst cases for insertion in the middle (various balanced trees, etc) do not perform as well in practice as a linked list with this iterator kept up to date. They are also significantly more memory intensive.
Definition at line 44 of file SparseBitVector.h.
| typedef unsigned long llvm::SparseBitVectorElement< ElementSize >::BitWord |
Definition at line 47 of file SparseBitVector.h.
| anonymous enum |
Definition at line 48 of file SparseBitVector.h.
| llvm::SparseBitVectorElement< ElementSize >::SparseBitVectorElement | ( | unsigned | Idx | ) | [inline, explicit] |
Definition at line 66 of file SparseBitVector.h.
References llvm::tgtok::Bits, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, and llvm::LibFunc::memset.
| unsigned llvm::SparseBitVectorElement< ElementSize >::count | ( | ) | const [inline] |
Definition at line 123 of file SparseBitVector.h.
References llvm::tgtok::Bits, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, llvm::CountPopulation_32(), llvm::CountPopulation_64(), and llvm_unreachable.
| bool llvm::SparseBitVectorElement< ElementSize >::empty | ( | ) | const [inline] |
Definition at line 95 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
| int llvm::SparseBitVectorElement< ElementSize >::find_first | ( | ) | const [inline] |
find_first - Returns the index of the first set bit.
Definition at line 136 of file SparseBitVector.h.
References llvm::tgtok::Bits, llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, llvm::CountTrailingZeros_32(), llvm::CountTrailingZeros_64(), and llvm_unreachable.
Referenced by llvm::SparseBitVector< ElementSize >::find_first().
| int llvm::SparseBitVectorElement< ElementSize >::find_next | ( | unsigned | Curr | ) | const [inline] |
find_next - Returns the index of the next set bit starting from the "Curr" bit. Returns -1 if the next set bit is not found.
Definition at line 150 of file SparseBitVector.h.
References llvm::tgtok::Bits, llvm::SparseBitVectorElement< ElementSize >::BITS_PER_ELEMENT, llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE, llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT, llvm::CountTrailingZeros_32(), llvm::CountTrailingZeros_64(), and llvm_unreachable.
| unsigned llvm::SparseBitVectorElement< ElementSize >::index | ( | ) | const [inline] |
Definition at line 91 of file SparseBitVector.h.
Referenced by llvm::SparseBitVector< ElementSize >::find_first().
| bool llvm::SparseBitVectorElement< ElementSize >::intersects | ( | const SparseBitVectorElement< ElementSize > & | RHS | ) | const [inline] |
Definition at line 197 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
| bool llvm::SparseBitVectorElement< ElementSize >::intersectWith | ( | const SparseBitVectorElement< ElementSize > & | RHS, |
| bool & | BecameZero | ||
| ) | [inline] |
Definition at line 207 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
| bool llvm::SparseBitVectorElement< ElementSize >::intersectWithComplement | ( | const SparseBitVectorElement< ElementSize > & | RHS, |
| bool & | BecameZero | ||
| ) | [inline] |
Definition at line 229 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
Referenced by llvm::SparseBitVector< ElementSize >::intersectWithComplement().
| void llvm::SparseBitVectorElement< ElementSize >::intersectWithComplement | ( | const SparseBitVectorElement< ElementSize > & | RHS1, |
| const SparseBitVectorElement< ElementSize > & | RHS2, | ||
| bool & | BecameZero | ||
| ) | [inline] |
Definition at line 250 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
| bool llvm::SparseBitVectorElement< ElementSize >::operator!= | ( | const SparseBitVectorElement< ElementSize > & | RHS | ) | const [inline] |
Definition at line 81 of file SparseBitVector.h.
| bool llvm::SparseBitVectorElement< ElementSize >::operator== | ( | const SparseBitVectorElement< ElementSize > & | RHS | ) | const [inline] |
Definition at line 72 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
| void llvm::SparseBitVectorElement< ElementSize >::reset | ( | unsigned | Idx | ) | [inline] |
Definition at line 115 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE.
| void llvm::SparseBitVectorElement< ElementSize >::set | ( | unsigned | Idx | ) | [inline] |
Definition at line 102 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE.
| bool llvm::SparseBitVectorElement< ElementSize >::test | ( | unsigned | Idx | ) | const [inline] |
Definition at line 119 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORD_SIZE.
Referenced by llvm::SparseBitVectorElement< ElementSize >::test_and_set().
| bool llvm::SparseBitVectorElement< ElementSize >::test_and_set | ( | unsigned | Idx | ) | [inline] |
Definition at line 106 of file SparseBitVector.h.
References llvm::SparseBitVectorElement< ElementSize >::test().
| bool llvm::SparseBitVectorElement< ElementSize >::unionWith | ( | const SparseBitVectorElement< ElementSize > & | RHS | ) | [inline] |
Definition at line 184 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
| BitWord llvm::SparseBitVectorElement< ElementSize >::word | ( | unsigned | Idx | ) | const [inline] |
Definition at line 86 of file SparseBitVector.h.
References llvm::tgtok::Bits, and llvm::SparseBitVectorElement< ElementSize >::BITWORDS_PER_ELEMENT.
friend struct ilist_sentinel_traits< SparseBitVectorElement > [friend] |
Definition at line 59 of file SparseBitVector.h.