summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
* As Doug pointed out (and I really should know), it is perfectly easy toChandler Carruth2011-12-171-4/+4
| | | | | | | | | make VariadicFunction actually be trivial. Do so, and also make it look more like your standard trivial functor by making it a struct with no access specifiers. The unit test is updated to initialize its functors properly. llvm-svn: 146827
* APInt: update asserts for base-36Dylan Noblesmith2011-12-161-3/+3
| | | | | | | | Hexatridecimal was added in r139695. And fix the unittest that now triggers the assert. llvm-svn: 146754
* Put the '*' in the right place in the unit test. Forgot to fix up thisChandler Carruth2011-12-161-7/+7
| | | | | | bit of style, sorry. llvm-svn: 146733
* Add a generic collection of class templates to ADT for buildingChandler Carruth2011-12-161-0/+110
| | | | | | | | | | | | variadic-like functions in C++98. See the comments in the header file for a more detailed description of how these work. We plan to use these extensively in the AST matching library. This code and idea were originally authored by Zhanyong Wan. I've condensed it using macros to reduce repeatition and adjusted it to fit better with LLVM's ADT. Thanks to both David Blaikie and Doug Gregor for the review! llvm-svn: 146729
* Fix APFloat::convert so that it handles narrowing conversions correctly; itEli Friedman2011-11-261-0/+24
| | | | | | | | was returning incorrect values in rare cases, and incorrectly marking exact conversions as inexact in some more common cases. Fixes PR11406, and a missed optimization in test/CodeGen/X86/fp-stack-O0.ll. llvm-svn: 145141
* Add a bad char heuristic to StringRef::find.Benjamin Kramer2011-10-151-0/+6
| | | | | | | | | Based on Horspool's simplified version of Boyer-Moore. We use a constant-sized table of uint8_ts to keep cache thrashing low, needles bigger than 255 bytes are uncommon anyways. The worst case is still O(n*m) but we do a lot better on the average case now. llvm-svn: 142061
* Attempt to fix MSVC build.Eli Friedman2011-10-121-2/+2
| | | | llvm-svn: 141831
* Fix APFloat::getLargest so that it actually returns the correct value. ↵Eli Friedman2011-10-121-0/+5
| | | | | | Found by accident while reviewing a patch to nearby code. llvm-svn: 141816
* Fix APInt::operator*= so that it computes the correct result for large ↵Eli Friedman2011-10-071-0/+9
| | | | | | integers where there is unsigned overflow. Fix APFloat::toString so that it doesn't depend on the incorrect behavior in common cases (and computes the correct result in some rare cases). Fixes PR11086. llvm-svn: 141441
* Fix a bug in compare_numeric().Jakob Stoklund Olesen2011-09-301-0/+6
| | | | | | Thanks to Alexandru Dura and Jonas Paulsson for finding it. llvm-svn: 140859
* Add APInt support for converting to/from hexatridecimal stringsDouglas Gregor2011-09-141-1/+24
| | | | llvm-svn: 139695
* Fix a test that wasn't testing the right thing.Matt Beaumont-Gay2011-08-291-4/+6
| | | | | | | | The APFloat "Zero" test was actually calling the APFloat(const fltSemantics &, integerPart) constructor, and EXPECT_EQ was treating 0 and -0 as equal. llvm-svn: 138745
* Avoid undefined behaviour if somehow NUM_GRAPHS equals 2^32 (orDuncan Sands2011-07-291-10/+6
| | | | | | | whatever the size of unsigned is), though this can't actually occur for any integer value of NUM_NODES. llvm-svn: 136460
* Remove extra semicolon.Jakub Staszak2011-07-291-1/+1
| | | | llvm-svn: 136432
* Use unsigned rather than uint16_t in case anyone feels like testingDuncan Sands2011-07-281-4/+4
| | | | | | | | | more graphs, like all graphs with 5 nodes or less. With a 32 bit unsigned type, the maximum is graphs with 6 nodes or less, but that would take a while to test - 5 nodes or less already requires a few seconds. llvm-svn: 136354
* Check an additional property specific to the way LLVMDuncan Sands2011-07-281-0/+15
| | | | | | iterates over SCC's. llvm-svn: 136353
* Add a unittest for the simply connected components (SCC) iterator class.Duncan Sands2011-07-281-0/+335
| | | | | | | | This computes every graph with 4 or fewer nodes, and checks that the SCC class indeed returns exactly the simply connected components reachable from the initial node. llvm-svn: 136351
* Remove some code that is no longer needed now that googletest knows howJay Foad2011-07-271-17/+0
| | | | | | to print STL containers. llvm-svn: 136213
* Add Twine support for characters, and switch twine to use a union internallyChris Lattner2011-07-241-2/+6
| | | | | | to eliminate some casting. llvm-svn: 135888
* Add APInt(numBits, ArrayRef<uint64_t> bigVal) constructor to prevent future ↵Jeffrey Yasskin2011-07-181-0/+4
| | | | | | | | | ambiguity errors like the one corrected by r135261. Migrate all LLVM callers of the old constructor to the new one. llvm-svn: 135431
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-1/+1
| | | | llvm-svn: 135375
* Add an APFloat::convertToInt(APSInt) function that automatically manages theJeffrey Yasskin2011-07-151-0/+49
| | | | | | memory for the result. llvm-svn: 135259
* The key of a StringMap can contain nul's in it, so having first() returnChris Lattner2011-07-141-3/+3
| | | | | | const char* doesn't make sense. Have it return StringRef instead. llvm-svn: 135167
* Fix a subtle issue in SmallVector. The following code did not work as expected:Owen Anderson2011-07-061-21/+27
| | | | | | | | | vec.insert(vec.begin(), vec[3]); The issue was that vec[3] returns a reference into the vector, which is invalidated when insert() memmove's the elements down to make space. The method needs to specifically detect and handle this case to correctly match std::vector's semantics. Thanks to Howard Hinnant for clarifying the correct behavior, and explaining how std::vector solves this problem. llvm-svn: 134554
* unittests: add test for APInt::toString()Dylan Noblesmith2011-06-151-0/+46
| | | | | | Follow up to r133032. llvm-svn: 133107
* Try fixing ↵Argyrios Kyrtzidis2011-06-151-0/+4
| | | | | | http://google1.osuosl.org:8011/builders/clang-i686-freebsd/builds/3548 llvm-svn: 133081
* Add unit tests for ADT/PackedVectorArgyrios Kyrtzidis2011-06-151-0/+111
| | | | llvm-svn: 133075
* Remove bounded StringRef::compare() since nothing but Clang SA was using it ↵Lenny Maiorani2011-04-281-13/+0
| | | | | | and it is just as easy to use StringRef::substr() preceding StringRef::compare() to achieve the same thing. llvm-svn: 130430
* Implements StringRef::compare with bounds. It is behaves similarly to ↵Lenny Maiorani2011-04-151-0/+13
| | | | | | strncmp(). Unit tests also included. llvm-svn: 129582
* Avoid turning a floating point division with a constant power of two into a ↵Benjamin Kramer2011-03-301-4/+2
| | | | | | | | | denormal multiplication. Some platforms may treat denormals as zero, on other platforms multiplication with a subnormal is slower than dividing by a normal. llvm-svn: 128555
* Add APFloat::getExactInverse.Benjamin Kramer2011-03-301-0/+23
| | | | | | | | | | | | | | The idea is, that if an ieee 754 float is divided by a power of two, we can turn the division into a cheaper multiplication. This function sees if we can get an exact multiplicative inverse for a divisor and returns it if possible. This is the hard part of PR9587. I tested many inputs against llvm-gcc's frotend implementation of this optimization and didn't find any difference. However, floating point is the land of weird edge cases, so any review would be appreciated. llvm-svn: 128545
* Add an argument to APInt's magic udiv calculation to specify the number of ↵Benjamin Kramer2011-03-171-0/+2
| | | | | | | | bits that are known zero in the divided number. This will come in handy soon. llvm-svn: 127828
* The signed version of our "magic number" computation for the integer ↵Cameron Zwarich2011-02-211-0/+18
| | | | | | | | | | | | | approximation of a constant had a minor typo introduced when copying it from the book, which caused it to favor negative approximations over positive approximations in many cases. Positive approximations require fewer operations beyond the multiplication. In the case of division by 3, we still generate code that is a single instruction larger than GCC's code. llvm-svn: 126097
* Part of this test is invariant inside the inner loop - move it outsideDuncan Sands2011-02-031-14/+16
| | | | | | the loop. llvm-svn: 124784
* Remove NoVendor and NoOS, added in commit 123990, from Triple. While itDuncan Sands2011-02-021-45/+49
| | | | | | | | | may be useful to understand "none", this is not the place for it. Tweak the fix to Normalize while there: the fix added in 123990 works correctly, but I like this way better. Finally, now that Triple understands some non-trivial environment values, teach the unittests about them. llvm-svn: 124720
* Don't infinitely recurse! Patch by Marius Wachtler!Chris Lattner2011-01-271-1/+1
| | | | llvm-svn: 124366
* Clang was not parsing target triples involving EABI and was generating wrong ↵Renato Golin2011-01-211-3/+11
| | | | | | IR (wrong PCS) and passing the wrong information down llc via the target-triple printed in IR. I've fixed this by adding the parsing of EABI into LLVM's Triple class and using it to choose the correct PCS in Clang's Tools. A Clang patch is on its way to use this infrastructure. llvm-svn: 123990
* Add ADT/IntEqClasses.h as a light-weight implementation of EquivalenceClasses.h.Jakob Stoklund Olesen2010-12-211-0/+107
| | | | | | | | | | This implementation already exists as ConnectedVNInfoEqClasses in LiveInterval.cpp, and it seems to be generally useful to have a light-weight way of forming equivalence classes of small integers. IntEqClasses doesn't allow enumeration of the elements in a class. llvm-svn: 122293
* Add more checks to IntervalMapOverlaps::advance() to ensure that advanceTo seesJakob Stoklund Olesen2010-12-171-0/+25
| | | | | | monotonic keys. llvm-svn: 122093
* It is allowed to call IntervalMap::const_iterator::advanceTo() with a key thatJakob Stoklund Olesen2010-12-171-0/+14
| | | | | | | | moves the iterator to end(), and it is valid to call it on end(). That means it is valid to call advanceTo() with any monotonic key sequence. llvm-svn: 122092
* Fix crash when IntervalMapOverlaps::advanceTo moves past the last overlap.Jakob Stoklund Olesen2010-12-171-1/+5
| | | | llvm-svn: 122081
* Complete tests for IntervalMapOverlaps.Jakob Stoklund Olesen2010-12-171-1/+106
| | | | llvm-svn: 122019
* Add basic test exposing many bugs.Jakob Stoklund Olesen2010-12-161-0/+15
| | | | llvm-svn: 121995
* Add IntervalMap::iterator::set{Start,Stop,Value} methods that allow limitedJakob Stoklund Olesen2010-12-031-7/+119
| | | | | | | | | | | editing of the current interval. These methods may cause coalescing, there are corresponding set*Unchecked methods for editing without coalescing. The non-coalescing methods are useful for applying monotonic transforms to all keys or values in a map without accidentally coalescing transformed and untransformed intervals. llvm-svn: 120829
* Support/ADT/Twine: Add toNullTerminatedStringRef.Michael J. Spencer2010-12-011-0/+8
| | | | llvm-svn: 120600
* PR5207: Rename overloaded APInt methods set(), clear(), flip() toJay Foad2010-12-011-1/+1
| | | | | | setAllBits(), setBit(unsigned), etc. llvm-svn: 120564
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120298
* Disallow overlapping inserts, even when inserting the same value.Jakob Stoklund Olesen2010-11-281-97/+9
| | | | | | | | | | | We always disallowed overlapping inserts with different values, and this makes the insertion code smaller and faster. If an overwriting insert is needed, it can be added as a separate method that trims any existing intervals before inserting. The immediate use cases for IntervalMap don't need this - they only use disjoint insertions. llvm-svn: 120264
* Add default constructors for iterators.Jakob Stoklund Olesen2010-11-281-0/+8
| | | | | | | These iterators don't point anywhere, and they can't be compared to anything. They are only good for assigning to. llvm-svn: 120239
* Implement const_iterator::advanceTo().Jakob Stoklund Olesen2010-11-281-0/+42
| | | | | | | This is a version of find() that always searches forwards and is faster for local searches. llvm-svn: 120237
OpenPOWER on IntegriCloud