summaryrefslogtreecommitdiff
path: root/unittests/ADT
Commit message (Collapse)AuthorAge
...
* Add ADT/IntervalMap.Jakob Stoklund Olesen2010-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a sorted interval map data structure for small keys and values with automatic coalescing and bidirectional iteration over coalesced intervals. Except for coalescing intervals, it provides similar functionality to std::map. It is however much more compact for small keys and values, and hopefully faster too. The container object itself can hold the first few intervals without any allocations, then it switches to a cache conscious B+-tree representation. A recycling allocator can be shared between many containers, even between containers holding different types. The IntervalMap is initially intended to be used with SlotIndex intervals for: - Backing store for LiveIntervalUnion that is smaller and faster than std::set. - Backing store for LiveInterval with less overhead than std::vector for typical intervals and O(N log N) merging of large intervals. 99% of virtual registers need 4 entries or less and would benefit from the small object optimization. - Backing store for LiveDebugVariable which doesn't exist yet, but will track debug variables during register allocation. This is a work in progress. Missing items are: - Performance metrics. - erase(). - insert() shrinkage. - clear(). - More performance metrics. - Simplification and detemplatization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119772 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch attribute macros to use 'LLVM_' as a prefix. We retain the old namesChandler Carruth2010-10-23
| | | | | | | until other LLVM projects using these are cleaned up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117200 91177308-0d34-0410-b5e6-96231b3b80d8
* Move ValueMapTest from ADT to VMCore so that ADT doesn't needDan Gohman2010-09-27
| | | | | | | to link in "core". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114831 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an all() method to BitVector, for testing whether all bits are set.Dan Gohman2010-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114830 91177308-0d34-0410-b5e6-96231b3b80d8
* Add better support for environment portion of triple. Original patch byDuncan Sands2010-09-16
| | | | | | | Cameron Esfahani, tweaked to use array_lengthof. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114073 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to unbreak the FreeBSD buildbot by XFAILing a unit test that seems to beJakob Stoklund Olesen2010-09-14
| | | | | | | | miscompiled by the system gcc-4.2.1 The test remains enabled for the second-stage test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113824 91177308-0d34-0410-b5e6-96231b3b80d8
* StringRef::compare_numeric also differed from StringRef::compare for ↵Benjamin Kramer2010-08-26
| | | | | | characters > 127. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112189 91177308-0d34-0410-b5e6-96231b3b80d8
* Do unsigned char comparisons in StringRef::compare_lower to be more ↵Benjamin Kramer2010-08-26
| | | | | | consistent with compare in corner cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence 'unused' warning.Bill Wendling2010-08-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111539 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a 'normalize' method to the Triple class, which takes a mucked upDuncan Sands2010-08-12
| | | | | | | | | | | | | | | | target triple and straightens it out. This does less than gcc's script config.sub, for example it turns i386-mingw32 into i386--mingw32 not i386-pc-mingw32, but it does a decent job of turning funky triples into something that the rest of the Triple class can understand. The plan is to use this to canonicalize triple's when they are first provided by users, and have the rest of LLVM only deal with canonical triples. Once this is done the special case workarounds in the Triple constructor can be removed, making the class more regular and easier to use. The comments and unittests for the Triple class are already adjusted in this patch appropriately for this brave new world of increased uniformity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110909 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the ValueMap copy constructor. It's not used anywhere,Duncan Sands2010-08-08
| | | | | | | | and removing it catches the mistake of passing a ValueMap by copy rather than by reference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110549 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the ValueMap copy constructor. The issue is that the map keys are valueDuncan Sands2010-07-30
| | | | | | | | | | | | | | | | | handles with a pointer to the containing map. When a map is copied, these pointers need to be corrected to point to the new map. If not, then consider the case of a map M1 which maps a value V to something. Create a copy M2 of M1. At this point there are two value handles on V, one representing V as a key in M1, the other representing V as a key in M2. But both value handles point to M1 as the containing map. Now delete V. The value handles remove themselves from their containing map (which destroys them), but only the first value handle is successful: the second one cannot remove itself from M1 as (once the first one has removed itself) there is nothing there to remove; it is therefore not destroyed. This causes an assertion failure "All references to V were not removed?". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109851 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch from EXPECT_EQ({true,false, ...) to the more canonicalChandler Carruth2010-07-13
| | | | | | | | EXPECT_{TRUE,FALSE}(...) macros. This also prevents suprious warnings about bool-to-pointer conversion that occurs withit EXPECT_EQ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108248 91177308-0d34-0410-b5e6-96231b3b80d8
* Use non-bool values for .count.Bill Wendling2010-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108048 91177308-0d34-0410-b5e6-96231b3b80d8
* ADT: Add DAGDeltaAlgorithm, which is a DAG minimization algorithm built on ↵Daniel Dunbar2010-06-08
| | | | | | | | top of the standard 'delta debugging' algorithm. - This can give substantial speedups in the delta process for inputs we can construct dependency information for. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105612 91177308-0d34-0410-b5e6-96231b3b80d8
* Add StringRef::compare_numeric and use it to sort TableGen register records.Jakob Stoklund Olesen2010-05-26
| | | | | | | This means that our Registers are now ordered R7, R8, R9, R10, R12, ... Not R1, R10, R11, R12, R2, R3, ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104745 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix const ilist_node::get{Prev,Next}Node() to actually compile. Picky, picky.Daniel Dunbar2010-05-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103723 91177308-0d34-0410-b5e6-96231b3b80d8
* ADT: Add ilist_node::get{Prev,Next}Node, which return the adjacent node or null.Daniel Dunbar2010-05-12
| | | | | | | | | | | | | | | | | | | | - This provides a convenient alternative to using something llvm::prior or manual iterator access, for example:: if (T *Prev = foo->getPrevNode()) ... instead of:: iterator it(foo); if (it != begin()) { --it; ... } - Chris, please review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103647 91177308-0d34-0410-b5e6-96231b3b80d8
* Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp,Dan Gohman2010-04-30
| | | | | | | and fix a bug in BitVector's reference proxy class which this exposed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102768 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallBitVector: Rework find_first/find_next and tweak test to test them (at ↵Benjamin Kramer2010-04-30
| | | | | | least on 64 bit platforms). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102712 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a read/write operator[] for SmallBitVector with a proxy class.Benjamin Kramer2010-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102709 91177308-0d34-0410-b5e6-96231b3b80d8
* silence some unused-value warnings.Chris Lattner2010-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101689 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SmallVector's insert to handle non-random-access iterators.Dan Gohman2010-03-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99633 91177308-0d34-0410-b5e6-96231b3b80d8
* Make this test more lenient; with SmallVector now using actuallyDan Gohman2010-03-18
| | | | | | | | aligned storage, the capacity may be more than what is explicitly requested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98846 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix death tests in -Asserts builds.Jeffrey Yasskin2010-03-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98701 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-widthJohn McCall2010-02-28
| | | | | | | | | | payloads. APFloat's internal folding routines always make QNaNs now, instead of sometimes making QNaNs and sometimes SNaNs depending on the type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97364 91177308-0d34-0410-b5e6-96231b3b80d8
* Make APFloat's string-parsing routines a bit safer against very large exponents.John McCall2010-02-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97278 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix (harmless) memory leak found by memcheck.Jeffrey Yasskin2010-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95862 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence GCC warnings.Benjamin Kramer2010-02-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95779 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement operators |=, &=, and ^= for SmallBitVector, and remove theDan Gohman2010-02-10
| | | | | | | | restriction in BitVector for |= and ^= that the operand must be the same length. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95768 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable unittests/ADT/BitVectorTest on PPC Darwin.Dale Johannesen2010-02-09
| | | | | | | | | | | It fails with a release build only, for reasons as yet unknown. (If there's a better way to Xfail things here let me know, doesn't seem to be any prior art in unittests.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95700 91177308-0d34-0410-b5e6-96231b3b80d8
* Make APInt::countLeadingZerosSlowCase() treat the contents of padding bitsJohn McCall2010-02-03
| | | | | | | | as undefined. Fixes an assertion in APFloat::toString noticed by Dale. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95196 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a SmallBitVector class, which mimics BitVector but uses onlyDan Gohman2010-01-05
| | | | | | | | | | | | | a single pointer (PointerIntPair) member. In "small" mode, the pointer field is reinterpreted as a set of bits. In "large" mode, the pointer points to a heap-allocated object. Also, give BitVector empty and swap functions. And, add some simple unittests for BitVector and SmallBitVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92730 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence compiler warning.Benjamin Kramer2009-12-31
| | | | | | | warning: comparison between signed and unsigned integer expressions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92359 91177308-0d34-0410-b5e6-96231b3b80d8
* Document the edit-distance algorithm used in StringRef, switch it overDouglas Gregor2009-12-31
| | | | | | | to SmallVector, and add a unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement support for converting to string at "natural precision", and fix someJohn McCall2009-12-24
| | | | | | | | major bugs in long-precision conversion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92150 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the two definitions of operator<< into namespace llvm, so theyDouglas Gregor2009-12-24
| | | | | | | | will be found by argument-dependent lookup. As with the previous commit, GCC is allowing ill-formed code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92146 91177308-0d34-0410-b5e6-96231b3b80d8
* Define the new operator<< for sets into namespace std, so thatDouglas Gregor2009-12-24
| | | | | | | | | argument-dependent lookup can find it. This is another case where an LLVM bug (not making operator<< visible) was masked by a GCC bug (looking in the global namespace when it shouldn't). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92144 91177308-0d34-0410-b5e6-96231b3b80d8
* Add accessors for the largest-magnitude, smallest-magnitude, andJohn McCall2009-12-24
| | | | | | | | | | smallest-normalized-magnitude values in a given FP semantics. Provide an APFloat-to-string conversion which I am quite ready to admit could be much more efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92126 91177308-0d34-0410-b5e6-96231b3b80d8
* Change StringRef::startswith and StringRef::endswith to versions which are aEli Friedman2009-12-21
| | | | | | | | bit more verbose, but optimize to much shorter code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91817 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an implementation of the delta debugging algorithm.Daniel Dunbar2009-12-03
| | | | | | | - This is a pretty slow / memory intensive implementation, and I will likely change it to an iterative model, but it works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90447 91177308-0d34-0410-b5e6-96231b3b80d8
* Only run this mutex test if threading is enabled. ThisDuncan Sands2009-11-19
| | | | | | | fixes PR5395. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89385 91177308-0d34-0410-b5e6-96231b3b80d8
* Reenable Split2 StringRef test with Apple gcc.Benjamin Kramer2009-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89357 91177308-0d34-0410-b5e6-96231b3b80d8
* "XFAIL" the Split2 StringReft test with Apple gcc, which miscompiles it.Daniel Dunbar2009-11-17
| | | | | | | - I plan on fixing/workarounding this, but until then I'd like the bots to stay green. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89077 91177308-0d34-0410-b5e6-96231b3b80d8
* Distinguish "a," from "a". The first one splits into "a" + "" and the second ↵Rafael Espindola2009-11-13
| | | | | | | | | one into "a" + 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87084 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to smallvector. Also fix issue with using unsigend for MaxSplit.Rafael Espindola2009-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87068 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new split method to StringRef that puts the substrings in a vector.Rafael Espindola2009-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87058 91177308-0d34-0410-b5e6-96231b3b80d8
* Add From arguments to StringRef search functions, and tweak doxyments.Daniel Dunbar2009-11-11
| | | | | | Also, add unittests for find_first_of and find_first_not_of. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86770 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix DenseMap iterator constness.Jeffrey Yasskin2009-11-10
| | | | | | | | | | | | | | | | | | | | This patch forbids implicit conversion of DenseMap::const_iterator to DenseMap::iterator which was possible because DenseMapIterator inherited (publicly) from DenseMapConstIterator. Conversion the other way around is now allowed as one may expect. The template DenseMapConstIterator is removed and the template parameter IsConst which specifies whether the iterator is constant is added to DenseMapIterator. Actually IsConst parameter is not necessary since the constness can be determined from KeyT but this is not relevant to the fix and can be addressed later. Patch by Victor Zverovich! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86636 91177308-0d34-0410-b5e6-96231b3b80d8
* Type.h doesn't need to #include LLVMContext.hChris Lattner2009-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85254 91177308-0d34-0410-b5e6-96231b3b80d8