LLVM: include/llvm/ADT/BitVector.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_ADT_BITVECTOR_H
15#define LLVM_ADT_BITVECTOR_H
16
21#include
22#include
23#include
24#include
25#include
26#include
27#include
28#include
29
30namespace llvm {
31
32
33
35 const BitVectorT &Parent;
36 int Current = 0;
37
38 void advance() {
39 assert(Current != -1 && "Trying to advance past end.");
40 Current = Parent.find_next(Current);
41 }
42
43 void retreat() {
44 if (Current == -1) {
45 Current = Parent.find_last();
46 } else {
47 Current = Parent.find_prev(Current);
48 }
49 }
50
51public:
57
59 : Parent(Parent), Current(Current) {}
63
65 auto Prev = *this;
66 advance();
67 return Prev;
68 }
69
71 advance();
72 return *this;
73 }
74
76 auto Prev = *this;
77 retreat();
78 return Prev;
79 }
80
82 retreat();
83 return *this;
84 }
85
86 unsigned operator*() const { return Current; }
87
90 "Comparing iterators from different BitVectors");
91 return Current == Other.Current;
92 }
93
96 "Comparing iterators from different BitVectors");
97 return Current != Other.Current;
98 }
99};
100
102 using BitWord = uintptr_t;
103
104 enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * CHAR_BIT };
105
106 static_assert(BITWORD_SIZE == 64 || BITWORD_SIZE == 32,
107 "Unsupported word size");
108
110
111 Storage Bits;
112 unsigned Size = 0;
113
114public:
116
117
119
120 BitWord *WordRef;
121 unsigned BitPos;
122
123 public:
125 WordRef = &b.Bits[Idx / BITWORD_SIZE];
126 BitPos = Idx % BITWORD_SIZE;
127 }
128
131
133 *this = bool(t);
134 return *this;
135 }
136
138 if (t)
139 *WordRef |= BitWord(1) << BitPos;
140 else
141 *WordRef &= ~(BitWord(1) << BitPos);
142 return *this;
143 }
144
146 return ((*WordRef) & (BitWord(1) << BitPos)) != 0;
147 }
148 };
149
152
162
163
165
166
167
168 explicit BitVector(unsigned s, bool t = false)
169 : Bits(NumBitWords(s), 0 - (BitWord)t), Size(s) {
170 if (t)
171 clear_unused_bits();
172 }
173
174
175 bool empty() const { return Size == 0; }
176
177
179
180
182 unsigned NumBits = 0;
183 for (auto Bit : Bits)
185 return NumBits;
186 }
187
188
190 return any_of(Bits, [](BitWord Bit) { return Bit != 0; });
191 }
192
193
195 for (unsigned i = 0; i < Size / BITWORD_SIZE; ++i)
196 if (Bits[i] != ~BitWord(0))
197 return false;
198
199
200 if (unsigned Remainder = Size % BITWORD_SIZE)
201 return Bits[Size / BITWORD_SIZE] == (BitWord(1) << Remainder) - 1;
202
203 return true;
204 }
205
206
210
211
212
213
214 int find_first_in(unsigned Begin, unsigned End, bool Set = true) const {
215 assert(Begin <= End && End <= Size);
216 if (Begin == End)
217 return -1;
218
219 unsigned FirstWord = Begin / BITWORD_SIZE;
220 unsigned LastWord = (End - 1) / BITWORD_SIZE;
221
222
223
224
225
226
227 for (unsigned i = FirstWord; i <= LastWord; ++i) {
228 BitWord Copy = Bits[i];
229 if (!Set)
230 Copy = ~Copy;
231
232 if (i == FirstWord) {
233 unsigned FirstBit = Begin % BITWORD_SIZE;
235 }
236
237 if (i == LastWord) {
238 unsigned LastBit = (End - 1) % BITWORD_SIZE;
240 }
241 if (Copy != 0)
243 }
244 return -1;
245 }
246
247
248
250 assert(Begin <= End && End <= Size);
251 if (Begin == End)
252 return -1;
253
254 unsigned LastWord = (End - 1) / BITWORD_SIZE;
255 unsigned FirstWord = Begin / BITWORD_SIZE;
256
257 for (unsigned i = LastWord + 1; i >= FirstWord + 1; --i) {
258 unsigned CurrentWord = i - 1;
259
260 BitWord Copy = Bits[CurrentWord];
261 if (CurrentWord == LastWord) {
262 unsigned LastBit = (End - 1) % BITWORD_SIZE;
264 }
265
266 if (CurrentWord == FirstWord) {
267 unsigned FirstBit = Begin % BITWORD_SIZE;
269 }
270
271 if (Copy != 0)
272 return (CurrentWord + 1) * BITWORD_SIZE - llvm::countl_zero(Copy) - 1;
273 }
274
275 return -1;
276 }
277
278
279
283
284
285
287 assert(Begin <= End && End <= Size);
288 if (Begin == End)
289 return -1;
290
291 unsigned LastWord = (End - 1) / BITWORD_SIZE;
292 unsigned FirstWord = Begin / BITWORD_SIZE;
293
294 for (unsigned i = LastWord + 1; i >= FirstWord + 1; --i) {
295 unsigned CurrentWord = i - 1;
296
297 BitWord Copy = Bits[CurrentWord];
298 if (CurrentWord == LastWord) {
299 unsigned LastBit = (End - 1) % BITWORD_SIZE;
301 }
302
303 if (CurrentWord == FirstWord) {
304 unsigned FirstBit = Begin % BITWORD_SIZE;
306 }
307
308 if (Copy != ~BitWord(0)) {
309 unsigned Result =
310 (CurrentWord + 1) * BITWORD_SIZE - llvm::countl_one(Copy) - 1;
311 return Result < Size ? Result : -1;
312 }
313 }
314 return -1;
315 }
316
317
318
320
321
322
324
325
326
328
329
330
332
333
334
336
337
338
342
343
344
346
347
348
352
353
355 Size = 0;
356 Bits.clear();
357 }
358
359
360 void resize(unsigned N, bool t = false) {
361 set_unused_bits(t);
362 Size = N;
363 Bits.resize(NumBitWords(N), 0 - BitWord(t));
364 clear_unused_bits();
365 }
366
367 void reserve(unsigned N) { Bits.reserve(NumBitWords(N)); }
368
369
371 init_words(true);
372 clear_unused_bits();
373 return *this;
374 }
375
377 assert(Idx < Size && "access in bound");
378 Bits[Idx / BITWORD_SIZE] |= BitWord(1) << (Idx % BITWORD_SIZE);
379 return *this;
380 }
381
382
384 assert(I <= E && "Attempted to set backwards range!");
385 assert(E <= size() && "Attempted to set out-of-bounds range!");
386
388
389 if (I / BITWORD_SIZE == E / BITWORD_SIZE) {
390 BitWord EMask = BitWord(1) << (E % BITWORD_SIZE);
391 BitWord IMask = BitWord(1) << (I % BITWORD_SIZE);
392 BitWord Mask = EMask - IMask;
393 Bits[I / BITWORD_SIZE] |= Mask;
394 return *this;
395 }
396
397 BitWord PrefixMask = ~BitWord(0) << (I % BITWORD_SIZE);
398 Bits[I / BITWORD_SIZE] |= PrefixMask;
400
401 for (; I + BITWORD_SIZE <= E; I += BITWORD_SIZE)
402 Bits[I / BITWORD_SIZE] = ~BitWord(0);
403
404 BitWord PostfixMask = (BitWord(1) << (E % BITWORD_SIZE)) - 1;
406 Bits[I / BITWORD_SIZE] |= PostfixMask;
407
408 return *this;
409 }
410
412 init_words(false);
413 return *this;
414 }
415
417 Bits[Idx / BITWORD_SIZE] &= ~(BitWord(1) << (Idx % BITWORD_SIZE));
418 return *this;
419 }
420
421
423 assert(I <= E && "Attempted to reset backwards range!");
424 assert(E <= size() && "Attempted to reset out-of-bounds range!");
425
427
428 if (I / BITWORD_SIZE == E / BITWORD_SIZE) {
429 BitWord EMask = BitWord(1) << (E % BITWORD_SIZE);
430 BitWord IMask = BitWord(1) << (I % BITWORD_SIZE);
431 BitWord Mask = EMask - IMask;
432 Bits[I / BITWORD_SIZE] &= ~Mask;
433 return *this;
434 }
435
436 BitWord PrefixMask = ~BitWord(0) << (I % BITWORD_SIZE);
437 Bits[I / BITWORD_SIZE] &= ~PrefixMask;
439
440 for (; I + BITWORD_SIZE <= E; I += BITWORD_SIZE)
441 Bits[I / BITWORD_SIZE] = BitWord(0);
442
443 BitWord PostfixMask = (BitWord(1) << (E % BITWORD_SIZE)) - 1;
445 Bits[I / BITWORD_SIZE] &= ~PostfixMask;
446
447 return *this;
448 }
449
451 for (auto &Bit : Bits)
452 Bit = ~Bit;
453 clear_unused_bits();
454 return *this;
455 }
456
458 Bits[Idx / BITWORD_SIZE] ^= BitWord(1) << (Idx % BITWORD_SIZE);
459 return *this;
460 }
461
462
464 assert (Idx < Size && "Out-of-bounds Bit access.");
466 }
467
469 assert (Idx < Size && "Out-of-bounds Bit access.");
470 BitWord Mask = BitWord(1) << (Idx % BITWORD_SIZE);
471 return (Bits[Idx / BITWORD_SIZE] & Mask) != 0;
472 }
473
474
476 assert(() && "Getting last element of empty vector.");
477 return (*this)[size() - 1];
478 }
479
480 bool test(unsigned Idx) const {
481 return (*this)[Idx];
482 }
483
484
486 unsigned OldSize = Size;
487 unsigned NewSize = Size + 1;
488
489
490
492 resize(NewSize, false);
493 else
494 Size = NewSize;
495
496
497 if (Val)
498 set(OldSize);
499 }
500
501
503 assert(() && "Empty vector has no element to pop.");
505 }
506
507
509 unsigned ThisWords = Bits.size();
510 unsigned RHSWords = RHS.Bits.size();
511 for (unsigned i = 0, e = std::min(ThisWords, RHSWords); i != e; ++i)
512 if (Bits[i] & RHS.Bits[i])
513 return true;
514 return false;
515 }
516
517
520 return false;
521 unsigned NumWords = Bits.size();
522 return std::equal(Bits.begin(), Bits.begin() + NumWords, RHS.Bits.begin());
523 }
524
526
527
529 unsigned ThisWords = Bits.size();
530 unsigned RHSWords = RHS.Bits.size();
531 unsigned i;
532 for (i = 0; i != std::min(ThisWords, RHSWords); ++i)
533 Bits[i] &= RHS.Bits[i];
534
535
536
537
538 for (; i != ThisWords; ++i)
539 Bits[i] = 0;
540
541 return *this;
542 }
543
544
546 unsigned ThisWords = Bits.size();
547 unsigned RHSWords = RHS.Bits.size();
548 for (unsigned i = 0; i != std::min(ThisWords, RHSWords); ++i)
549 Bits[i] &= ~RHS.Bits[i];
550 return *this;
551 }
552
553
554
556 unsigned ThisWords = Bits.size();
557 unsigned RHSWords = RHS.Bits.size();
558 unsigned i;
559 for (i = 0; i != std::min(ThisWords, RHSWords); ++i)
560 if ((Bits[i] & ~RHS.Bits[i]) != 0)
561 return true;
562
563 for (; i != ThisWords ; ++i)
564 if (Bits[i] != 0)
565 return true;
566
567 return false;
568 }
569
570 template <class F, class... ArgTys>
572 ArgTys const &...Args) {
573 assert(((Arg.size() == Args.size()) && ...) && "consistent sizes");
576 Out.Bits[I] = f(Arg.Bits[I], Args.Bits[I]...);
577 Out.clear_unused_bits();
578 return Out;
579 }
580
586 return *this;
587 }
588
594 return *this;
595 }
596
600 return *this;
601
602 unsigned NumWords = Bits.size();
603 assert(NumWords >= 1);
604
605 wordShr(N / BITWORD_SIZE);
606
607 unsigned BitDistance = N % BITWORD_SIZE;
608 if (BitDistance == 0)
609 return *this;
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
634 const unsigned LSH = BITWORD_SIZE - BitDistance;
635
636 for (unsigned I = 0; I < NumWords - 1; ++I) {
637 Bits[I] >>= BitDistance;
638 Bits[I] |= (Bits[I + 1] & Mask) << LSH;
639 }
640
641 Bits[NumWords - 1] >>= BitDistance;
642
643 return *this;
644 }
645
649 return *this;
650
651 unsigned NumWords = Bits.size();
652 assert(NumWords >= 1);
653
654 wordShl(N / BITWORD_SIZE);
655
656 unsigned BitDistance = N % BITWORD_SIZE;
657 if (BitDistance == 0)
658 return *this;
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
684 const unsigned RSH = BITWORD_SIZE - BitDistance;
685
686 for (int I = NumWords - 1; I > 0; --I) {
687 Bits[I] <<= BitDistance;
688 Bits[I] |= (Bits[I - 1] & Mask) >> RSH;
689 }
690 Bits[0] <<= BitDistance;
691 clear_unused_bits();
692
693 return *this;
694 }
695
700
702 assert(!Size && Bits.empty());
704 }
706
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
724 applyMask<true, false>(Mask, MaskWords);
725 }
726
727
728
730 applyMask<false, false>(Mask, MaskWords);
731 }
732
733
734
736 applyMask<true, true>(Mask, MaskWords);
737 }
738
739
740
742 applyMask<false, true>(Mask, MaskWords);
743 }
744
745private:
746
747
748
749
750
751
752
753
754
755
756
757
758
759
762 return;
763
764 uint32_t NumWords = Bits.size();
765
766
767
768
769 std::copy(Bits.begin(), Bits.begin() + NumWords - Count,
770 Bits.begin() + Count);
771 std::fill(Bits.begin(), Bits.begin() + Count, 0);
772 clear_unused_bits();
773 }
774
775
776
777
780 return;
781
782 uint32_t NumWords = Bits.size();
783
784 std::copy(Bits.begin() + Count, Bits.begin() + NumWords, Bits.begin());
785 std::fill(Bits.begin() + NumWords - Count, Bits.begin() + NumWords, 0);
786 }
787
788 unsigned NumBitWords(unsigned S) const {
789 return (S + BITWORD_SIZE-1) / BITWORD_SIZE;
790 }
791
792
793 void set_unused_bits(bool t = true) {
794
795 if (unsigned ExtraBits = Size % BITWORD_SIZE) {
796 BitWord ExtraBitMask = ~BitWord(0) << ExtraBits;
797 if (t)
798 Bits.back() |= ExtraBitMask;
799 else
800 Bits.back() &= ~ExtraBitMask;
801 }
802 }
803
804
805 void clear_unused_bits() {
806 set_unused_bits(false);
807 }
808
809 void init_words(bool t) { llvm::fill(Bits, 0 - (BitWord)t); }
810
811 template<bool AddBits, bool InvertMask>
812 void applyMask(const uint32_t *Mask, unsigned MaskWords) {
813 static_assert(BITWORD_SIZE % 32 == 0, "Unsupported BitWord size.");
814 MaskWords = std::min(MaskWords, (size() + 31) / 32);
815 const unsigned Scale = BITWORD_SIZE / 32;
816 unsigned i;
817 for (i = 0; MaskWords >= Scale; ++i, MaskWords -= Scale) {
818 BitWord BW = Bits[i];
819
820 for (unsigned b = 0; b != BITWORD_SIZE; b += 32) {
822 if (InvertMask) M = ~M;
823 if (AddBits) BW |= BitWord(M) << b;
824 else BW &= ~(BitWord(M) << b);
825 }
826 Bits[i] = BW;
827 }
828 for (unsigned b = 0; MaskWords; b += 32, --MaskWords) {
830 if (InvertMask) M = ~M;
831 if (AddBits) Bits[i] |= BitWord(M) << b;
832 else Bits[i] &= ~(BitWord(M) << b);
833 }
834 if (AddBits)
835 clear_unused_bits();
836 }
837
838public:
839
842};
843
845 return X.getMemorySize();
846}
847
857 getHashValue(std::make_pair(V.size(), V.getData()));
858 }
860 if (LHS.isInvalid() || RHS.isInvalid())
861 return LHS.isInvalid() == RHS.isInvalid();
863 }
864};
865}
866
871
872#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_UNLIKELY(EXPR)
This file defines DenseMapInfo traits for DenseMap.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition BitVector.h:118
reference & operator=(bool t)
Definition BitVector.h:137
reference(BitVector &b, unsigned Idx)
Definition BitVector.h:124
reference & operator=(reference t)
Definition BitVector.h:132
reference(const reference &)=default
Definition BitVector.h:101
BitVector & operator>>=(unsigned N)
Definition BitVector.h:597
bool test(unsigned Idx) const
Definition BitVector.h:480
BitVector & reset()
Definition BitVector.h:411
void swap(BitVector &RHS)
Definition BitVector.h:696
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
Definition BitVector.h:319
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
Definition BitVector.h:360
bool anyCommon(const BitVector &RHS) const
Test if any common bits are set.
Definition BitVector.h:508
void clear()
clear - Removes all bits from the bitvector.
Definition BitVector.h:354
bool test(const BitVector &RHS) const
test - Check if (This - RHS) is zero.
Definition BitVector.h:555
BitVector()=default
BitVector default ctor - Creates an empty bitvector.
bool back() const
Return the last element in the vector.
Definition BitVector.h:475
bool operator!=(const BitVector &RHS) const
Definition BitVector.h:525
void clearBitsNotInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
clearBitsNotInMask - Clear a bit in this vector for every '0' bit in Mask.
Definition BitVector.h:741
int find_last() const
find_last - Returns the index of the last set bit, -1 if none of the bits are set.
Definition BitVector.h:323
int find_first_unset_in(unsigned Begin, unsigned End) const
find_first_unset_in - Returns the index of the first unset bit in the range [Begin,...
Definition BitVector.h:280
size_type count() const
count - Returns the number of bits which are set.
Definition BitVector.h:181
BitVector & operator<<=(unsigned N)
Definition BitVector.h:646
ArrayRef< BitWord > getData() const
Definition BitVector.h:707
const_set_bits_iterator set_bits_end() const
Definition BitVector.h:156
BitVector & reset(unsigned Idx)
Definition BitVector.h:416
BitVector & set()
Definition BitVector.h:370
int find_last_unset() const
find_last_unset - Returns the index of the last unset bit, -1 if all of the bits are set.
Definition BitVector.h:345
void reserve(unsigned N)
Definition BitVector.h:367
void invalid()
Definition BitVector.h:701
void setBitsInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
setBitsInMask - Add '1' bits from Mask to this vector.
Definition BitVector.h:723
const_set_bits_iterator set_iterator
Definition BitVector.h:151
bool any() const
any - Returns true if any bit is set.
Definition BitVector.h:189
bool all() const
all - Returns true if all bits are set.
Definition BitVector.h:194
void push_back(bool Val)
Definition BitVector.h:485
BitVector(unsigned s, bool t=false)
BitVector ctor - Creates a bitvector of specified number of bits.
Definition BitVector.h:168
BitVector & reset(const BitVector &RHS)
reset - Reset bits that are set in RHS. Same as *this &= ~RHS.
Definition BitVector.h:545
BitVector & operator|=(const BitVector &RHS)
Definition BitVector.h:581
void pop_back()
Pop one bit from the end of the vector.
Definition BitVector.h:502
void clearBitsInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
clearBitsInMask - Clear any bits in this vector that are set in Mask.
Definition BitVector.h:729
int find_prev(unsigned PriorTo) const
find_prev - Returns the index of the first set bit that precedes the the bit at PriorTo.
Definition BitVector.h:331
const_set_bits_iterator_impl< BitVector > const_set_bits_iterator
Definition BitVector.h:150
int find_last_in(unsigned Begin, unsigned End) const
find_last_in - Returns the index of the last set bit in the range [Begin, End).
Definition BitVector.h:249
void setBitsNotInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
setBitsNotInMask - Add a bit to this vector for every '0' bit in Mask.
Definition BitVector.h:735
BitVector & flip()
Definition BitVector.h:450
BitVector & reset(unsigned I, unsigned E)
reset - Efficiently reset a range of bits in [I, E)
Definition BitVector.h:422
bool operator==(const BitVector &RHS) const
Definition BitVector.h:518
int find_next(unsigned Prev) const
find_next - Returns the index of the next set bit following the "Prev" bit.
Definition BitVector.h:327
bool none() const
none - Returns true if none of the bits are set.
Definition BitVector.h:207
const_set_bits_iterator set_bits_begin() const
Definition BitVector.h:153
iterator_range< const_set_bits_iterator > set_bits() const
Definition BitVector.h:159
BitVector & set(unsigned I, unsigned E)
set - Efficiently set a range of bits in [I, E)
Definition BitVector.h:383
size_type getBitCapacity() const
Definition BitVector.h:841
int find_first_in(unsigned Begin, unsigned End, bool Set=true) const
find_first_in - Returns the index of the first set / unset bit, depending on Set, in the range [Begin...
Definition BitVector.h:214
size_type size() const
size - Returns the number of bits in this bitvector.
Definition BitVector.h:178
BitVector & operator^=(const BitVector &RHS)
Definition BitVector.h:589
BitVector & flip(unsigned Idx)
Definition BitVector.h:457
size_type getMemorySize() const
Return the size (in bytes) of the bit vector.
Definition BitVector.h:840
static BitVector & apply(F &&f, BitVector &Out, BitVector const &Arg, ArgTys const &...Args)
Definition BitVector.h:571
unsigned size_type
Definition BitVector.h:115
bool empty() const
empty - Tests whether there are no bits in this bitvector.
Definition BitVector.h:175
int find_next_unset(unsigned Prev) const
find_next_unset - Returns the index of the next unset bit following the "Prev" bit.
Definition BitVector.h:339
BitVector & set(unsigned Idx)
Definition BitVector.h:376
int find_prev_unset(unsigned PriorTo) const
find_prev_unset - Returns the index of the first unset bit that precedes the bit at PriorTo.
Definition BitVector.h:349
BitVector & operator&=(const BitVector &RHS)
Intersection, union, disjoint union.
Definition BitVector.h:528
int find_first_unset() const
find_first_unset - Returns the index of the first unset bit, -1 if all of the bits are set.
Definition BitVector.h:335
bool isInvalid() const
Definition BitVector.h:705
int find_last_unset_in(unsigned Begin, unsigned End) const
find_last_unset_in - Returns the index of the last unset bit in the range [Begin, End).
Definition BitVector.h:286
bool operator[](unsigned Idx) const
Definition BitVector.h:468
reference operator[](unsigned Idx)
Definition BitVector.h:463
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
ForwardIterator for the bits that are set.
Definition BitVector.h:34
const_set_bits_iterator_impl operator--(int)
Definition BitVector.h:75
const_set_bits_iterator_impl(const BitVectorT &Parent)
Definition BitVector.h:60
value_type reference
Definition BitVector.h:56
std::bidirectional_iterator_tag iterator_category
Definition BitVector.h:52
bool operator==(const const_set_bits_iterator_impl &Other) const
Definition BitVector.h:88
const_set_bits_iterator_impl(const const_set_bits_iterator_impl &)=default
const_set_bits_iterator_impl & operator++()
Definition BitVector.h:70
const_set_bits_iterator_impl & operator--()
Definition BitVector.h:81
const_set_bits_iterator_impl operator++(int)
Definition BitVector.h:64
std::ptrdiff_t difference_type
Definition BitVector.h:53
const_set_bits_iterator_impl(const BitVectorT &Parent, int Current)
Definition BitVector.h:58
bool operator!=(const const_set_bits_iterator_impl &Other) const
Definition BitVector.h:94
const value_type * pointer
Definition BitVector.h:55
unsigned value_type
Definition BitVector.h:54
unsigned operator*() const
Definition BitVector.h:86
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This is an optimization pass for GlobalISel generic memory operations.
void fill(R &&Range, T &&Value)
Provide wrappers to std::fill which take ranges instead of having to pass begin/end explicitly.
BitVector::size_type capacity_in_bytes(const BitVector &X)
Definition BitVector.h:844
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
constexpr T maskLeadingOnes(unsigned N)
Create a bitmask with the N left-most bits set to 1, and all other bits set to 0.
constexpr int popcount(T Value) noexcept
Count the number of set bits in a value.
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
int countl_zero(T Val)
Count number of 0's from the most significant bit to the least stopping at the first 1.
FunctionAddr VTableAddr Count
int countl_one(T Value)
Count the number of ones from the most significant bit to the first zero bit.
constexpr T maskTrailingZeros(unsigned N)
Create a bitmask with the N right-most bits set to 0, and all other bits set to 1.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:867
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:869
static BitVector getEmptyKey()
Definition BitVector.h:849
static bool isEqual(const BitVector &LHS, const BitVector &RHS)
Definition BitVector.h:859
static unsigned getHashValue(const BitVector &V)
Definition BitVector.h:855
static BitVector getTombstoneKey()
Definition BitVector.h:850
An information struct used to provide DenseMap with the various necessary components for a given valu...