1 //===- llvm/ADT/SparseBitVector.h - Efficient Sparse BitVector -*- C++ -*- ===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the SparseBitVector class. See the doxygen comment for
11 // SparseBitVector for more details on the algorithm used.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ADT_SPARSEBITVECTOR_H
16 #define LLVM_ADT_SPARSEBITVECTOR_H
18 #include "llvm/ADT/ilist.h"
19 #include "llvm/ADT/ilist_node.h"
20 #include "llvm/Support/DataTypes.h"
21 #include "llvm/Support/ErrorHandling.h"
22 #include "llvm/Support/MathExtras.h"
23 #include "llvm/Support/raw_ostream.h"
29 /// SparseBitVector is an implementation of a bitvector that is sparse by only
30 /// storing the elements that have non-zero bits set. In order to make this
31 /// fast for the most common cases, SparseBitVector is implemented as a linked
32 /// list of SparseBitVectorElements. We maintain a pointer to the last
33 /// SparseBitVectorElement accessed (in the form of a list iterator), in order
34 /// to make multiple in-order test/set constant time after the first one is
35 /// executed. Note that using vectors to store SparseBitVectorElement's does
36 /// not work out very well because it causes insertion in the middle to take
37 /// enormous amounts of time with a large amount of bits. Other structures that
38 /// have better worst cases for insertion in the middle (various balanced trees,
39 /// etc) do not perform as well in practice as a linked list with this iterator
40 /// kept up to date. They are also significantly more memory intensive.
43 template <unsigned ElementSize = 128>
44 struct SparseBitVectorElement
45 : public ilist_node<SparseBitVectorElement<ElementSize> > {
47 typedef unsigned long BitWord;
49 BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT,
50 BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE,
51 BITS_PER_ELEMENT = ElementSize
55 // Index of Element in terms of where first bit starts.
56 unsigned ElementIndex;
57 BitWord Bits[BITWORDS_PER_ELEMENT];
58 // Needed for sentinels
59 friend struct ilist_sentinel_traits<SparseBitVectorElement>;
60 SparseBitVectorElement() {
62 memset(&Bits[0], 0, sizeof (BitWord) * BITWORDS_PER_ELEMENT);
66 explicit SparseBitVectorElement(unsigned Idx) {
68 memset(&Bits[0], 0, sizeof (BitWord) * BITWORDS_PER_ELEMENT);
72 bool operator==(const SparseBitVectorElement &RHS) const {
73 if (ElementIndex != RHS.ElementIndex)
75 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
76 if (Bits[i] != RHS.Bits[i])
81 bool operator!=(const SparseBitVectorElement &RHS) const {
82 return !(*this == RHS);
85 // Return the bits that make up word Idx in our element.
86 BitWord word(unsigned Idx) const {
87 assert (Idx < BITWORDS_PER_ELEMENT);
91 unsigned index() const {
96 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
102 void set(unsigned Idx) {
103 Bits[Idx / BITWORD_SIZE] |= 1L << (Idx % BITWORD_SIZE);
106 bool test_and_set (unsigned Idx) {
107 bool old = test(Idx);
115 void reset(unsigned Idx) {
116 Bits[Idx / BITWORD_SIZE] &= ~(1L << (Idx % BITWORD_SIZE));
119 bool test(unsigned Idx) const {
120 return Bits[Idx / BITWORD_SIZE] & (1L << (Idx % BITWORD_SIZE));
123 unsigned count() const {
124 unsigned NumBits = 0;
125 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
126 if (sizeof(BitWord) == 4)
127 NumBits += CountPopulation_32(Bits[i]);
128 else if (sizeof(BitWord) == 8)
129 NumBits += CountPopulation_64(Bits[i]);
131 llvm_unreachable("Unsupported!");
135 /// find_first - Returns the index of the first set bit.
136 int find_first() const {
137 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
139 if (sizeof(BitWord) == 4)
140 return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
141 if (sizeof(BitWord) == 8)
142 return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
143 llvm_unreachable("Unsupported!");
145 llvm_unreachable("Illegal empty element");
148 /// find_next - Returns the index of the next set bit starting from the
149 /// "Curr" bit. Returns -1 if the next set bit is not found.
150 int find_next(unsigned Curr) const {
151 if (Curr >= BITS_PER_ELEMENT)
154 unsigned WordPos = Curr / BITWORD_SIZE;
155 unsigned BitPos = Curr % BITWORD_SIZE;
156 BitWord Copy = Bits[WordPos];
157 assert (WordPos <= BITWORDS_PER_ELEMENT
158 && "Word Position outside of element");
160 // Mask off previous bits.
161 Copy &= ~0L << BitPos;
164 if (sizeof(BitWord) == 4)
165 return WordPos * BITWORD_SIZE + CountTrailingZeros_32(Copy);
166 if (sizeof(BitWord) == 8)
167 return WordPos * BITWORD_SIZE + CountTrailingZeros_64(Copy);
168 llvm_unreachable("Unsupported!");
171 // Check subsequent words.
172 for (unsigned i = WordPos+1; i < BITWORDS_PER_ELEMENT; ++i)
174 if (sizeof(BitWord) == 4)
175 return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
176 if (sizeof(BitWord) == 8)
177 return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
178 llvm_unreachable("Unsupported!");
183 // Union this element with RHS and return true if this one changed.
184 bool unionWith(const SparseBitVectorElement &RHS) {
185 bool changed = false;
186 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) {
187 BitWord old = changed ? 0 : Bits[i];
189 Bits[i] |= RHS.Bits[i];
190 if (!changed && old != Bits[i])
196 // Return true if we have any bits in common with RHS
197 bool intersects(const SparseBitVectorElement &RHS) const {
198 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) {
199 if (RHS.Bits[i] & Bits[i])
205 // Intersect this Element with RHS and return true if this one changed.
206 // BecameZero is set to true if this element became all-zero bits.
207 bool intersectWith(const SparseBitVectorElement &RHS,
209 bool changed = false;
213 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) {
214 BitWord old = changed ? 0 : Bits[i];
216 Bits[i] &= RHS.Bits[i];
220 if (!changed && old != Bits[i])
223 BecameZero = allzero;
226 // Intersect this Element with the complement of RHS and return true if this
227 // one changed. BecameZero is set to true if this element became all-zero
229 bool intersectWithComplement(const SparseBitVectorElement &RHS,
231 bool changed = false;
235 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) {
236 BitWord old = changed ? 0 : Bits[i];
238 Bits[i] &= ~RHS.Bits[i];
242 if (!changed && old != Bits[i])
245 BecameZero = allzero;
248 // Three argument version of intersectWithComplement that intersects
249 // RHS1 & ~RHS2 into this element
250 void intersectWithComplement(const SparseBitVectorElement &RHS1,
251 const SparseBitVectorElement &RHS2,
256 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) {
257 Bits[i] = RHS1.Bits[i] & ~RHS2.Bits[i];
261 BecameZero = allzero;
264 // Get a hash value for this element;
265 uint64_t getHashValue() const {
266 uint64_t HashVal = 0;
267 for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) {
274 template <unsigned ElementSize = 128>
275 class SparseBitVector {
276 typedef ilist<SparseBitVectorElement<ElementSize> > ElementList;
277 typedef typename ElementList::iterator ElementListIter;
278 typedef typename ElementList::const_iterator ElementListConstIter;
280 BITWORD_SIZE = SparseBitVectorElement<ElementSize>::BITWORD_SIZE
283 // Pointer to our current Element.
284 ElementListIter CurrElementIter;
285 ElementList Elements;
287 // This is like std::lower_bound, except we do linear searching from the
289 ElementListIter FindLowerBound(unsigned ElementIndex) {
291 if (Elements.empty()) {
292 CurrElementIter = Elements.begin();
293 return Elements.begin();
296 // Make sure our current iterator is valid.
297 if (CurrElementIter == Elements.end())
300 // Search from our current iterator, either backwards or forwards,
301 // depending on what element we are looking for.
302 ElementListIter ElementIter = CurrElementIter;
303 if (CurrElementIter->index() == ElementIndex) {
305 } else if (CurrElementIter->index() > ElementIndex) {
306 while (ElementIter != Elements.begin()
307 && ElementIter->index() > ElementIndex)
310 while (ElementIter != Elements.end() &&
311 ElementIter->index() < ElementIndex)
314 CurrElementIter = ElementIter;
318 // Iterator to walk set bits in the bitmap. This iterator is a lot uglier
319 // than it would be, in order to be efficient.
320 class SparseBitVectorIterator {
324 const SparseBitVector<ElementSize> *BitVector;
326 // Current element inside of bitmap.
327 ElementListConstIter Iter;
329 // Current bit number inside of our bitmap.
332 // Current word number inside of our element.
335 // Current bits from the element.
336 typename SparseBitVectorElement<ElementSize>::BitWord Bits;
338 // Move our iterator to the first non-zero bit in the bitmap.
339 void AdvanceToFirstNonZero() {
342 if (BitVector->Elements.empty()) {
346 Iter = BitVector->Elements.begin();
347 BitNumber = Iter->index() * ElementSize;
348 unsigned BitPos = Iter->find_first();
350 WordNumber = (BitNumber % ElementSize) / BITWORD_SIZE;
351 Bits = Iter->word(WordNumber);
352 Bits >>= BitPos % BITWORD_SIZE;
355 // Move our iterator to the next non-zero bit.
356 void AdvanceToNextNonZero() {
360 while (Bits && !(Bits & 1)) {
365 // See if we ran out of Bits in this word.
367 int NextSetBitNumber = Iter->find_next(BitNumber % ElementSize) ;
368 // If we ran out of set bits in this element, move to next element.
369 if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) {
373 // We may run out of elements in the bitmap.
374 if (Iter == BitVector->Elements.end()) {
378 // Set up for next non zero word in bitmap.
379 BitNumber = Iter->index() * ElementSize;
380 NextSetBitNumber = Iter->find_first();
381 BitNumber += NextSetBitNumber;
382 WordNumber = (BitNumber % ElementSize) / BITWORD_SIZE;
383 Bits = Iter->word(WordNumber);
384 Bits >>= NextSetBitNumber % BITWORD_SIZE;
386 WordNumber = (NextSetBitNumber % ElementSize) / BITWORD_SIZE;
387 Bits = Iter->word(WordNumber);
388 Bits >>= NextSetBitNumber % BITWORD_SIZE;
389 BitNumber = Iter->index() * ElementSize;
390 BitNumber += NextSetBitNumber;
396 inline SparseBitVectorIterator& operator++() {
399 AdvanceToNextNonZero();
404 inline SparseBitVectorIterator operator++(int) {
405 SparseBitVectorIterator tmp = *this;
410 // Return the current set bit number.
411 unsigned operator*() const {
415 bool operator==(const SparseBitVectorIterator &RHS) const {
416 // If they are both at the end, ignore the rest of the fields.
417 if (AtEnd && RHS.AtEnd)
419 // Otherwise they are the same if they have the same bit number and
421 return AtEnd == RHS.AtEnd && RHS.BitNumber == BitNumber;
423 bool operator!=(const SparseBitVectorIterator &RHS) const {
424 return !(*this == RHS);
426 SparseBitVectorIterator(): BitVector(NULL) {
430 SparseBitVectorIterator(const SparseBitVector<ElementSize> *RHS,
431 bool end = false):BitVector(RHS) {
432 Iter = BitVector->Elements.begin();
437 AdvanceToFirstNonZero();
441 typedef SparseBitVectorIterator iterator;
444 CurrElementIter = Elements.begin ();
450 // SparseBitVector copy ctor.
451 SparseBitVector(const SparseBitVector &RHS) {
452 ElementListConstIter ElementIter = RHS.Elements.begin();
453 while (ElementIter != RHS.Elements.end()) {
454 Elements.push_back(SparseBitVectorElement<ElementSize>(*ElementIter));
458 CurrElementIter = Elements.begin ();
467 SparseBitVector& operator=(const SparseBitVector& RHS) {
470 ElementListConstIter ElementIter = RHS.Elements.begin();
471 while (ElementIter != RHS.Elements.end()) {
472 Elements.push_back(SparseBitVectorElement<ElementSize>(*ElementIter));
476 CurrElementIter = Elements.begin ();
481 // Test, Reset, and Set a bit in the bitmap.
482 bool test(unsigned Idx) {
483 if (Elements.empty())
486 unsigned ElementIndex = Idx / ElementSize;
487 ElementListIter ElementIter = FindLowerBound(ElementIndex);
489 // If we can't find an element that is supposed to contain this bit, there
490 // is nothing more to do.
491 if (ElementIter == Elements.end() ||
492 ElementIter->index() != ElementIndex)
494 return ElementIter->test(Idx % ElementSize);
497 void reset(unsigned Idx) {
498 if (Elements.empty())
501 unsigned ElementIndex = Idx / ElementSize;
502 ElementListIter ElementIter = FindLowerBound(ElementIndex);
504 // If we can't find an element that is supposed to contain this bit, there
505 // is nothing more to do.
506 if (ElementIter == Elements.end() ||
507 ElementIter->index() != ElementIndex)
509 ElementIter->reset(Idx % ElementSize);
511 // When the element is zeroed out, delete it.
512 if (ElementIter->empty()) {
514 Elements.erase(ElementIter);
518 void set(unsigned Idx) {
519 unsigned ElementIndex = Idx / ElementSize;
520 SparseBitVectorElement<ElementSize> *Element;
521 ElementListIter ElementIter;
522 if (Elements.empty()) {
523 Element = new SparseBitVectorElement<ElementSize>(ElementIndex);
524 ElementIter = Elements.insert(Elements.end(), Element);
527 ElementIter = FindLowerBound(ElementIndex);
529 if (ElementIter == Elements.end() ||
530 ElementIter->index() != ElementIndex) {
531 Element = new SparseBitVectorElement<ElementSize>(ElementIndex);
532 // We may have hit the beginning of our SparseBitVector, in which case,
533 // we may need to insert right after this element, which requires moving
534 // the current iterator forward one, because insert does insert before.
535 if (ElementIter != Elements.end() &&
536 ElementIter->index() < ElementIndex)
537 ElementIter = Elements.insert(++ElementIter, Element);
539 ElementIter = Elements.insert(ElementIter, Element);
542 CurrElementIter = ElementIter;
544 ElementIter->set(Idx % ElementSize);
547 bool test_and_set (unsigned Idx) {
548 bool old = test(Idx);
556 bool operator!=(const SparseBitVector &RHS) const {
557 return !(*this == RHS);
560 bool operator==(const SparseBitVector &RHS) const {
561 ElementListConstIter Iter1 = Elements.begin();
562 ElementListConstIter Iter2 = RHS.Elements.begin();
564 for (; Iter1 != Elements.end() && Iter2 != RHS.Elements.end();
566 if (*Iter1 != *Iter2)
569 return Iter1 == Elements.end() && Iter2 == RHS.Elements.end();
572 // Union our bitmap with the RHS and return true if we changed.
573 bool operator|=(const SparseBitVector &RHS) {
574 bool changed = false;
575 ElementListIter Iter1 = Elements.begin();
576 ElementListConstIter Iter2 = RHS.Elements.begin();
578 // If RHS is empty, we are done
579 if (RHS.Elements.empty())
582 while (Iter2 != RHS.Elements.end()) {
583 if (Iter1 == Elements.end() || Iter1->index() > Iter2->index()) {
584 Elements.insert(Iter1,
585 new SparseBitVectorElement<ElementSize>(*Iter2));
588 } else if (Iter1->index() == Iter2->index()) {
589 changed |= Iter1->unionWith(*Iter2);
596 CurrElementIter = Elements.begin();
600 // Intersect our bitmap with the RHS and return true if ours changed.
601 bool operator&=(const SparseBitVector &RHS) {
602 bool changed = false;
603 ElementListIter Iter1 = Elements.begin();
604 ElementListConstIter Iter2 = RHS.Elements.begin();
606 // Check if both bitmaps are empty.
607 if (Elements.empty() && RHS.Elements.empty())
610 // Loop through, intersecting as we go, erasing elements when necessary.
611 while (Iter2 != RHS.Elements.end()) {
612 if (Iter1 == Elements.end()) {
613 CurrElementIter = Elements.begin();
617 if (Iter1->index() > Iter2->index()) {
619 } else if (Iter1->index() == Iter2->index()) {
621 changed |= Iter1->intersectWith(*Iter2, BecameZero);
623 ElementListIter IterTmp = Iter1;
625 Elements.erase(IterTmp);
631 ElementListIter IterTmp = Iter1;
633 Elements.erase(IterTmp);
636 Elements.erase(Iter1, Elements.end());
637 CurrElementIter = Elements.begin();
641 // Intersect our bitmap with the complement of the RHS and return true
643 bool intersectWithComplement(const SparseBitVector &RHS) {
644 bool changed = false;
645 ElementListIter Iter1 = Elements.begin();
646 ElementListConstIter Iter2 = RHS.Elements.begin();
648 // If either our bitmap or RHS is empty, we are done
649 if (Elements.empty() || RHS.Elements.empty())
652 // Loop through, intersecting as we go, erasing elements when necessary.
653 while (Iter2 != RHS.Elements.end()) {
654 if (Iter1 == Elements.end()) {
655 CurrElementIter = Elements.begin();
659 if (Iter1->index() > Iter2->index()) {
661 } else if (Iter1->index() == Iter2->index()) {
663 changed |= Iter1->intersectWithComplement(*Iter2, BecameZero);
665 ElementListIter IterTmp = Iter1;
667 Elements.erase(IterTmp);
676 CurrElementIter = Elements.begin();
680 bool intersectWithComplement(const SparseBitVector<ElementSize> *RHS) const {
681 return intersectWithComplement(*RHS);
685 // Three argument version of intersectWithComplement.
686 // Result of RHS1 & ~RHS2 is stored into this bitmap.
687 void intersectWithComplement(const SparseBitVector<ElementSize> &RHS1,
688 const SparseBitVector<ElementSize> &RHS2)
691 CurrElementIter = Elements.begin();
692 ElementListConstIter Iter1 = RHS1.Elements.begin();
693 ElementListConstIter Iter2 = RHS2.Elements.begin();
695 // If RHS1 is empty, we are done
696 // If RHS2 is empty, we still have to copy RHS1
697 if (RHS1.Elements.empty())
700 // Loop through, intersecting as we go, erasing elements when necessary.
701 while (Iter2 != RHS2.Elements.end()) {
702 if (Iter1 == RHS1.Elements.end())
705 if (Iter1->index() > Iter2->index()) {
707 } else if (Iter1->index() == Iter2->index()) {
708 bool BecameZero = false;
709 SparseBitVectorElement<ElementSize> *NewElement =
710 new SparseBitVectorElement<ElementSize>(Iter1->index());
711 NewElement->intersectWithComplement(*Iter1, *Iter2, BecameZero);
713 Elements.push_back(NewElement);
720 SparseBitVectorElement<ElementSize> *NewElement =
721 new SparseBitVectorElement<ElementSize>(*Iter1);
722 Elements.push_back(NewElement);
727 // copy the remaining elements
728 while (Iter1 != RHS1.Elements.end()) {
729 SparseBitVectorElement<ElementSize> *NewElement =
730 new SparseBitVectorElement<ElementSize>(*Iter1);
731 Elements.push_back(NewElement);
738 void intersectWithComplement(const SparseBitVector<ElementSize> *RHS1,
739 const SparseBitVector<ElementSize> *RHS2) {
740 intersectWithComplement(*RHS1, *RHS2);
743 bool intersects(const SparseBitVector<ElementSize> *RHS) const {
744 return intersects(*RHS);
747 // Return true if we share any bits in common with RHS
748 bool intersects(const SparseBitVector<ElementSize> &RHS) const {
749 ElementListConstIter Iter1 = Elements.begin();
750 ElementListConstIter Iter2 = RHS.Elements.begin();
752 // Check if both bitmaps are empty.
753 if (Elements.empty() && RHS.Elements.empty())
756 // Loop through, intersecting stopping when we hit bits in common.
757 while (Iter2 != RHS.Elements.end()) {
758 if (Iter1 == Elements.end())
761 if (Iter1->index() > Iter2->index()) {
763 } else if (Iter1->index() == Iter2->index()) {
764 if (Iter1->intersects(*Iter2))
775 // Return true iff all bits set in this SparseBitVector are
777 bool contains(const SparseBitVector<ElementSize> &RHS) const {
778 SparseBitVector<ElementSize> Result(*this);
780 return (Result == RHS);
783 // Return the first set bit in the bitmap. Return -1 if no bits are set.
784 int find_first() const {
785 if (Elements.empty())
787 const SparseBitVectorElement<ElementSize> &First = *(Elements.begin());
788 return (First.index() * ElementSize) + First.find_first();
791 // Return true if the SparseBitVector is empty
793 return Elements.empty();
796 unsigned count() const {
797 unsigned BitCount = 0;
798 for (ElementListConstIter Iter = Elements.begin();
799 Iter != Elements.end();
801 BitCount += Iter->count();
805 iterator begin() const {
806 return iterator(this);
809 iterator end() const {
810 return iterator(this, true);
813 // Get a hash value for this bitmap.
814 uint64_t getHashValue() const {
815 uint64_t HashVal = 0;
816 for (ElementListConstIter Iter = Elements.begin();
817 Iter != Elements.end();
819 HashVal ^= Iter->index();
820 HashVal ^= Iter->getHashValue();
826 // Convenience functions to allow Or and And without dereferencing in the user
829 template <unsigned ElementSize>
830 inline bool operator |=(SparseBitVector<ElementSize> &LHS,
831 const SparseBitVector<ElementSize> *RHS) {
835 template <unsigned ElementSize>
836 inline bool operator |=(SparseBitVector<ElementSize> *LHS,
837 const SparseBitVector<ElementSize> &RHS) {
838 return LHS->operator|=(RHS);
841 template <unsigned ElementSize>
842 inline bool operator &=(SparseBitVector<ElementSize> *LHS,
843 const SparseBitVector<ElementSize> &RHS) {
844 return LHS->operator&=(RHS);
847 template <unsigned ElementSize>
848 inline bool operator &=(SparseBitVector<ElementSize> &LHS,
849 const SparseBitVector<ElementSize> *RHS) {
853 // Convenience functions for infix union, intersection, difference operators.
855 template <unsigned ElementSize>
856 inline SparseBitVector<ElementSize>
857 operator|(const SparseBitVector<ElementSize> &LHS,
858 const SparseBitVector<ElementSize> &RHS) {
859 SparseBitVector<ElementSize> Result(LHS);
864 template <unsigned ElementSize>
865 inline SparseBitVector<ElementSize>
866 operator&(const SparseBitVector<ElementSize> &LHS,
867 const SparseBitVector<ElementSize> &RHS) {
868 SparseBitVector<ElementSize> Result(LHS);
873 template <unsigned ElementSize>
874 inline SparseBitVector<ElementSize>
875 operator-(const SparseBitVector<ElementSize> &LHS,
876 const SparseBitVector<ElementSize> &RHS) {
877 SparseBitVector<ElementSize> Result;
878 Result.intersectWithComplement(LHS, RHS);
885 // Dump a SparseBitVector to a stream
886 template <unsigned ElementSize>
887 void dump(const SparseBitVector<ElementSize> &LHS, raw_ostream &out) {
890 typename SparseBitVector<ElementSize>::iterator bi = LHS.begin(),
894 for (++bi; bi != be; ++bi) {
900 } // end namespace llvm