mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
don't repeat function names in documentation comments; NFC
llvm-svn: 258699
This commit is contained in:
parent
d5075eb344
commit
3bb30646d9
@ -21,13 +21,11 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
/// SmallBitVector - This is a 'bitvector' (really, a variable-sized bit array),
|
/// This is a 'bitvector' (really, a variable-sized bit array), optimized for
|
||||||
/// optimized for the case when the array is small. It contains one
|
/// the case when the array is small. It contains one pointer-sized field, which
|
||||||
/// pointer-sized field, which is directly used as a plain collection of bits
|
/// is directly used as a plain collection of bits when possible, or as a
|
||||||
/// when possible, or as a pointer to a larger heap-allocated array when
|
/// pointer to a larger heap-allocated array when necessary. This allows normal
|
||||||
/// necessary. This allows normal "small" cases to be fast without losing
|
/// "small" cases to be fast without losing generality for large inputs.
|
||||||
/// generality for large inputs.
|
|
||||||
///
|
|
||||||
class SmallBitVector {
|
class SmallBitVector {
|
||||||
// TODO: In "large" mode, a pointer to a BitVector is used, leading to an
|
// TODO: In "large" mode, a pointer to a BitVector is used, leading to an
|
||||||
// unnecessary level of indirection. It would be more efficient to use a
|
// unnecessary level of indirection. It would be more efficient to use a
|
||||||
@ -139,11 +137,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// SmallBitVector default ctor - Creates an empty bitvector.
|
/// Creates an empty bitvector.
|
||||||
SmallBitVector() : X(1) {}
|
SmallBitVector() : X(1) {}
|
||||||
|
|
||||||
/// SmallBitVector ctor - Creates a bitvector of specified number of bits. All
|
/// Creates a bitvector of specified number of bits. All bits are initialized
|
||||||
/// bits are initialized to the specified value.
|
/// to the specified value.
|
||||||
explicit SmallBitVector(unsigned s, bool t = false) {
|
explicit SmallBitVector(unsigned s, bool t = false) {
|
||||||
if (s <= SmallNumDataBits)
|
if (s <= SmallNumDataBits)
|
||||||
switchToSmall(t ? ~uintptr_t(0) : 0, s);
|
switchToSmall(t ? ~uintptr_t(0) : 0, s);
|
||||||
@ -168,17 +166,17 @@ public:
|
|||||||
delete getPointer();
|
delete getPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// empty - Tests whether there are no bits in this bitvector.
|
/// Tests whether there are no bits in this bitvector.
|
||||||
bool empty() const {
|
bool empty() const {
|
||||||
return isSmall() ? getSmallSize() == 0 : getPointer()->empty();
|
return isSmall() ? getSmallSize() == 0 : getPointer()->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// size - Returns the number of bits in this bitvector.
|
/// Returns the number of bits in this bitvector.
|
||||||
size_t size() const {
|
size_t size() const {
|
||||||
return isSmall() ? getSmallSize() : getPointer()->size();
|
return isSmall() ? getSmallSize() : getPointer()->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// count - Returns the number of bits which are set.
|
/// Returns the number of bits which are set.
|
||||||
size_type count() const {
|
size_type count() const {
|
||||||
if (isSmall()) {
|
if (isSmall()) {
|
||||||
uintptr_t Bits = getSmallBits();
|
uintptr_t Bits = getSmallBits();
|
||||||
@ -187,29 +185,28 @@ public:
|
|||||||
return getPointer()->count();
|
return getPointer()->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// any - Returns true if any bit is set.
|
/// Returns true if any bit is set.
|
||||||
bool any() const {
|
bool any() const {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
return getSmallBits() != 0;
|
return getSmallBits() != 0;
|
||||||
return getPointer()->any();
|
return getPointer()->any();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// all - Returns true if all bits are set.
|
/// Returns true if all bits are set.
|
||||||
bool all() const {
|
bool all() const {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
return getSmallBits() == (uintptr_t(1) << getSmallSize()) - 1;
|
return getSmallBits() == (uintptr_t(1) << getSmallSize()) - 1;
|
||||||
return getPointer()->all();
|
return getPointer()->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// none - Returns true if none of the bits are set.
|
/// Returns true if none of the bits are set.
|
||||||
bool none() const {
|
bool none() const {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
return getSmallBits() == 0;
|
return getSmallBits() == 0;
|
||||||
return getPointer()->none();
|
return getPointer()->none();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find_first - Returns the index of the first set bit, -1 if none
|
/// Returns the index of the first set bit, -1 if none of the bits are set.
|
||||||
/// of the bits are set.
|
|
||||||
int find_first() const {
|
int find_first() const {
|
||||||
if (isSmall()) {
|
if (isSmall()) {
|
||||||
uintptr_t Bits = getSmallBits();
|
uintptr_t Bits = getSmallBits();
|
||||||
@ -220,8 +217,8 @@ public:
|
|||||||
return getPointer()->find_first();
|
return getPointer()->find_first();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find_next - Returns the index of the next set bit following the
|
/// Returns the index of the next set bit following the "Prev" bit.
|
||||||
/// "Prev" bit. Returns -1 if the next set bit is not found.
|
/// Returns -1 if the next set bit is not found.
|
||||||
int find_next(unsigned Prev) const {
|
int find_next(unsigned Prev) const {
|
||||||
if (isSmall()) {
|
if (isSmall()) {
|
||||||
uintptr_t Bits = getSmallBits();
|
uintptr_t Bits = getSmallBits();
|
||||||
@ -234,14 +231,14 @@ public:
|
|||||||
return getPointer()->find_next(Prev);
|
return getPointer()->find_next(Prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// clear - Clear all bits.
|
/// Clear all bits.
|
||||||
void clear() {
|
void clear() {
|
||||||
if (!isSmall())
|
if (!isSmall())
|
||||||
delete getPointer();
|
delete getPointer();
|
||||||
switchToSmall(0, 0);
|
switchToSmall(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// resize - Grow or shrink the bitvector.
|
/// Grow or shrink the bitvector.
|
||||||
void resize(unsigned N, bool t = false) {
|
void resize(unsigned N, bool t = false) {
|
||||||
if (!isSmall()) {
|
if (!isSmall()) {
|
||||||
getPointer()->resize(N, t);
|
getPointer()->resize(N, t);
|
||||||
@ -296,7 +293,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// set - Efficiently set a range of bits in [I, E)
|
/// Efficiently set a range of bits in [I, E)
|
||||||
SmallBitVector &set(unsigned I, unsigned E) {
|
SmallBitVector &set(unsigned I, unsigned E) {
|
||||||
assert(I <= E && "Attempted to set backwards range!");
|
assert(I <= E && "Attempted to set backwards range!");
|
||||||
assert(E <= size() && "Attempted to set out-of-bounds range!");
|
assert(E <= size() && "Attempted to set out-of-bounds range!");
|
||||||
@ -327,7 +324,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// reset - Efficiently reset a range of bits in [I, E)
|
/// Efficiently reset a range of bits in [I, E)
|
||||||
SmallBitVector &reset(unsigned I, unsigned E) {
|
SmallBitVector &reset(unsigned I, unsigned E) {
|
||||||
assert(I <= E && "Attempted to reset backwards range!");
|
assert(I <= E && "Attempted to reset backwards range!");
|
||||||
assert(E <= size() && "Attempted to reset out-of-bounds range!");
|
assert(E <= size() && "Attempted to reset out-of-bounds range!");
|
||||||
@ -422,7 +419,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// reset - Reset bits that are set in RHS. Same as *this &= ~RHS.
|
/// Reset bits that are set in RHS. Same as *this &= ~RHS.
|
||||||
SmallBitVector &reset(const SmallBitVector &RHS) {
|
SmallBitVector &reset(const SmallBitVector &RHS) {
|
||||||
if (isSmall() && RHS.isSmall())
|
if (isSmall() && RHS.isSmall())
|
||||||
setSmallBits(getSmallBits() & ~RHS.getSmallBits());
|
setSmallBits(getSmallBits() & ~RHS.getSmallBits());
|
||||||
@ -436,8 +433,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// test - Check if (This - RHS) is zero.
|
/// Check if (This - RHS) is zero. This is the same as reset(RHS) and any().
|
||||||
/// This is the same as reset(RHS) and any().
|
|
||||||
bool test(const SmallBitVector &RHS) const {
|
bool test(const SmallBitVector &RHS) const {
|
||||||
if (isSmall() && RHS.isSmall())
|
if (isSmall() && RHS.isSmall())
|
||||||
return (getSmallBits() & ~RHS.getSmallBits()) != 0;
|
return (getSmallBits() & ~RHS.getSmallBits()) != 0;
|
||||||
@ -514,7 +510,7 @@ public:
|
|||||||
std::swap(X, RHS.X);
|
std::swap(X, RHS.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setBitsInMask - Add '1' bits from Mask to this vector. Don't resize.
|
/// Add '1' bits from Mask to this vector. Don't resize.
|
||||||
/// This computes "*this |= Mask".
|
/// This computes "*this |= Mask".
|
||||||
void setBitsInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
void setBitsInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
@ -523,8 +519,8 @@ public:
|
|||||||
getPointer()->setBitsInMask(Mask, MaskWords);
|
getPointer()->setBitsInMask(Mask, MaskWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// clearBitsInMask - Clear any bits in this vector that are set in Mask.
|
/// Clear any bits in this vector that are set in Mask. Don't resize.
|
||||||
/// Don't resize. This computes "*this &= ~Mask".
|
/// This computes "*this &= ~Mask".
|
||||||
void clearBitsInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
void clearBitsInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
applyMask<false, false>(Mask, MaskWords);
|
applyMask<false, false>(Mask, MaskWords);
|
||||||
@ -532,8 +528,8 @@ public:
|
|||||||
getPointer()->clearBitsInMask(Mask, MaskWords);
|
getPointer()->clearBitsInMask(Mask, MaskWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setBitsNotInMask - Add a bit to this vector for every '0' bit in Mask.
|
/// Add a bit to this vector for every '0' bit in Mask. Don't resize.
|
||||||
/// Don't resize. This computes "*this |= ~Mask".
|
/// This computes "*this |= ~Mask".
|
||||||
void setBitsNotInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
void setBitsNotInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
applyMask<true, true>(Mask, MaskWords);
|
applyMask<true, true>(Mask, MaskWords);
|
||||||
@ -541,8 +537,8 @@ public:
|
|||||||
getPointer()->setBitsNotInMask(Mask, MaskWords);
|
getPointer()->setBitsNotInMask(Mask, MaskWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// clearBitsNotInMask - Clear a bit in this vector for every '0' bit in Mask.
|
/// Clear a bit in this vector for every '0' bit in Mask. Don't resize.
|
||||||
/// Don't resize. This computes "*this &= Mask".
|
/// This computes "*this &= Mask".
|
||||||
void clearBitsNotInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
void clearBitsNotInMask(const uint32_t *Mask, unsigned MaskWords = ~0u) {
|
||||||
if (isSmall())
|
if (isSmall())
|
||||||
applyMask<false, true>(Mask, MaskWords);
|
applyMask<false, true>(Mask, MaskWords);
|
||||||
|
Loading…
Reference in New Issue
Block a user