summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Make elfiamcu an OS, not an environment.Michael Kuperstein2015-10-271-3/+3
| | | | | | | | | | GNU tools require elfiamcu to take up the entire OS field, so, e.g. i?86-*-linux-elfiamcu is not considered a legal triple. Make us compatible. Differential Revision: http://reviews.llvm.org/D14081 llvm-svn: 251390
* [X86] Add support for elfiamcu tripleMichael Kuperstein2015-10-251-0/+6
| | | | | | | | This adds support for the i?86-*-elfiamcu triple, which indicates the IAMCU psABI is used. Differential Revision: http://reviews.llvm.org/D13977 llvm-svn: 251222
* unittests: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-10-201-1/+1
| | | | llvm-svn: 250843
* Initial migration of AVR backendDylan McKay2015-10-161-0/+17
| | | | | | | | This patch adds the underlying infrastructure for an AVR backend to be included into LLVM. It is the first of a series of patches aimed at moving the out-of-tree AVR backend into the tree. It consists of adding a new`Triple` target 'avr'. llvm-svn: 250492
* Simplify SmallBitVector::applyMask by consolidating common code for 32- and ↵Yaron Keren2015-09-181-2/+2
| | | | | | | | | | | | | 64-bit builds and assert when mask is too large to apply in the small case, previously the extra words were silently ignored. clang-format the entire function to match current code standards. This is a rewrite of r247972 which was reverted in r247983 due to warning and possible UB on 32-bits hosts. llvm-svn: 247993
* Reverting r247972 (and subordinate commit r247972) as the 32-bit left-shift ↵Aaron Ballman2015-09-181-2/+2
| | | | | | is undefined behavior on implementations where uinptr_t is 32-bits. One such platform is Windows, MSVC, x86. llvm-svn: 247983
* Fix BitVectorTest on 32-bit hosts after r247972.Yaron Keren2015-09-181-2/+2
| | | | | | | We can't apply two words of 32-bit mask in the small case where the internal storage is just one 32-bit word. llvm-svn: 247974
* Simplify SmallBitVector::applyMask by consolidating common code for 32-bit ↵Yaron Keren2015-09-181-2/+2
| | | | | | | | | | | | | and 64-bit builds. Extend mask value to 64 bits before taking its complement and assert when mask is too large to apply in the small case (previously the extra words were silently ignored). http://reviews.llvm.org/D11890 Patch by James Touton! llvm-svn: 247972
* [ADT] Fix a confusing interface spec and some annoying peculiaritiesChandler Carruth2015-09-101-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | with the StringRef::split method when used with a MaxSplit argument other than '-1' (which nobody really does today, but which should actually work). The spec claimed both to split up to MaxSplit times, but also to append <= MaxSplit strings to the vector. One of these doesn't make sense. Given the name "MaxSplit", let's go with it being a max over how many *splits* occur, which means the max on how many strings get appended is MaxSplit+1. I'm not actually sure the implementation correctly provided this logic either, as it used a really opaque loop structure. The implementation was also playing weird games with nullptr in the data field to try to rely on a totally opaque hidden property of the split method that returns a pair. Nasty IMO. Replace all of this with what is (IMO) simpler code that doesn't use the pair returning split method, and instead just finds each separator and appends directly. I think this is a lot easier to read, and it most definitely matches the spec. Added some tests that exercise the corner cases around StringRef() and StringRef("") that all now pass. I'll start using this in code in the next commit. llvm-svn: 247249
* [ADT] Add a single-character version of the small vector split routineChandler Carruth2015-09-101-0/+5
| | | | | | | | | | | on StringRef. Finding and splitting on a single character is substantially faster than doing it on even a single character StringRef -- we immediately get to a *very* tuned memchr call this way. Even nicer, we get to this even in a debug build, shaving 18% off the runtime of TripleTest.Normalization, helping PR23676 some more. llvm-svn: 247244
* Add makeArrayRef() overload for ArrayRef input (no-op/identity) NFCMehdi Amini2015-09-101-0/+16
| | | | | | | | | | | | | | | The purpose is to allow templated wrapper to work with either ArrayRef or any convertible operation: template<typename Container> void wrapper(const Container &Arr) { impl(makeArrayRef(Arr)); } with Container being a std::vector, a SmallVector, or an ArrayRef. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 247214
* Adding full stops to commentsBen Craig2015-09-041-2/+2
| | | | | | Also, test commit llvm-svn: 246855
* Fix APInt value initialization to give a zero value as any sane integer typeRichard Smith2015-09-041-0/+7
| | | | | | | should, rather than giving a broken value that doesn't even zero/sign-extend properly. llvm-svn: 246836
* Teach the target parsing framework to directly compute the length of allChandler Carruth2015-08-301-43/+43
| | | | | | | | | | of its strings when expanding the string literals from the macros, and push all of the APIs to be StringRef instead of C-string APIs. This (remarkably) removes a very non-trivial number of strlen calls. It even deletes code and complexity from one of the primary users -- Clang. llvm-svn: 246374
* Allow Optionals to be compared to NoneDavid Blaikie2015-08-191-0/+13
| | | | | | | | | | | This is something like nullopt in std::experimental::optional. Optional could already be constructed from None, so this seems like an obvious extension from there. I have a use in a future patch for Clang, though it may not go that way/end up used - so this seemed worth committing now regardless. llvm-svn: 245518
* Simplify PackedVector by removing user-defined special members that aren't ↵David Blaikie2015-08-121-12/+0
| | | | | | | | | | | | any different than the defaults This causes the other special members (like move and copy construction, and move assignment) to come through for free. Some code in clang was depending on the (deprecated, in the original code) copy ctor. Now that there's no user-defined special members, they're all available without any deprecation concerns. llvm-svn: 244835
* Add SmallString test trying to exercise the realloc() code pathYaron Keren2015-08-111-0/+11
| | | | | | by allocating a small size (will go through malloc) and then large size. llvm-svn: 244637
* [ArrayRefTest] Work around a GCC 4.8 internal compiler error.Benjamin Kramer2015-08-051-5/+2
| | | | llvm-svn: 244023
* unittests/ADT/ArrayRefTest.cpp: Suppress r243995 on g++-4.8 for now to ↵NAKAMURA Takumi2015-08-051-0/+4
| | | | | | | | | | | | | | | unbreak bots. For example of mingw-w64-g++-4.8.1, llvm/unittests/ADT/ArrayRefTest.cpp: In member function 'virtual void {anonymous}::ArrayRefTest_AllocatorCopy_Test::TestBody()': llvm/unittests/ADT/ArrayRefTest.cpp:56:40: internal compiler error: in count_type_elements, at expr.c:5523 } Array3Src[] = {{"hello"}, {"world"}}; ^ Please submit a full bug report, with preprocessed source if appropriate. llvm-svn: 244017
* [ArrayRef] Make copy use std::uninitialized_copy.Benjamin Kramer2015-08-041-1/+13
| | | | | | | std::copy does not work for non-trivially copyable classes when we're copying into uninitialized memory. llvm-svn: 243995
* Add amdopencl environment to tripleMatt Arsenault2015-07-301-0/+2
| | | | | | | This is used by the AMD x86 OpenCL implementation to change some ABI details on Windows and Linux. llvm-svn: 243627
* Reapply "Add reverse(ContainerTy) range adapter."Pete Cooper2015-07-292-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r243567, which ultimately reapplies r243563. The fix here was to use std::enable_if for overload resolution. Thanks to David Blaikie for lots of help on this, and for the extra tests! Original commit message follows: For cases where we needed a foreach loop in reverse over a container, we had to do something like for (const GlobalValue *GV : make_range(TypeInfos.rbegin(), TypeInfos.rend())) { This provides a convenience method which shortens this to for (const GlobalValue *GV : reverse(TypeInfos)) { There are 2 versions of this, with a preference to the rbegin() version. The first uses rbegin() and rend() to construct an iterator_range. The second constructs an iterator_range from the begin() and end() methods wrapped in std::reverse_iterator's. Reviewed by David Blaikie. llvm-svn: 243581
* Revert "Add reverse(ContainerTy) range adapter."Pete Cooper2015-07-292-78/+0
| | | | | | | | | This reverts commit r243563. The GCC buildbots were extremely unhappy about this. Reverting while we discuss a better way of doing overload resolution. llvm-svn: 243567
* Add reverse(ContainerTy) range adapter.Pete Cooper2015-07-292-0/+78
| | | | | | | | | | | | | | | | | | | | | | | For cases where we needed a foreach loop in reverse over a container, we had to do something like for (const GlobalValue *GV : make_range(TypeInfos.rbegin(), TypeInfos.rend())) { This provides a convenience method which shortens this to for (const GlobalValue *GV : reverse(TypeInfos)) { There are 2 versions of this, with a preference to the rbegin() version. The first uses rbegin() and rend() to construct an iterator_range. The second constructs an iterator_range from the begin() and end() methods wrapped in std::reverse_iterator's. Reviewed by David Blaikie. llvm-svn: 243563
* Miscellaneous Fixes for SparseBitVectorDaniel Berlin2015-07-201-0/+94
| | | | | | | | | | | | | | | | | Summary: 1. Fix return value in `SparseBitVector::operator&=`. 2. Add checks if SBV is being assigned is invoking SBV. Reviewers: dberlin Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11342 Committed on behalf of sl@ llvm-svn: 242693
* [Triple] Add a helper to switch between big/little endian variantsBenjamin Kramer2015-07-061-0/+78
| | | | | | This will be used from clang's driver. llvm-svn: 241527
* Change APInt comparison with uint64_t.Pawel Bylica2015-07-011-0/+127
| | | | | | | | | | | | | | | | | Summary: This patch changes the way APInt is compared with a value of type uint64_t. Before the uint64_t value was truncated to the size of APInt before comparison. Now the comparison takes into account full 64-bit precision. Test Plan: Unit tests added. No regressions. Self-hosted check-all done as well. Reviewers: chandlerc, dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10655 llvm-svn: 241204
* Drop the OS from the WebAssembly target triple for now.Dan Gohman2015-06-301-4/+4
| | | | | | | This unbreaks TripleTest.Normalization. We'll have to come up with a new plan for the OS component of the target triple for WebAssembly. llvm-svn: 241041
* [WebAssembly] Initial WebAssembly backendDan Gohman2015-06-291-0/+30
| | | | | | | This WebAssembly backend is just a skeleton at this time and is not yet functional. llvm-svn: 241022
* Add missing <array> include.Pawel Bylica2015-06-251-0/+1
| | | | llvm-svn: 240629
* Express APInt::{s,u}{l,g}e(uint64_t) in terms of ↵Pawel Bylica2015-06-251-0/+38
| | | | | | | | | APInt::{s,u}{l,g}t(uint64_t). NFC. This is preparation for http://reviews.llvm.org/D10655: Change APInt comparison with uint64_t. Some unit tests added also. llvm-svn: 240626
* ADTTests: merge #ifdef checks from r240436.Alex Lorenz2015-06-241-3/+1
| | | | | | | This commit merges the #ifdef and #ifndef checks into one #if, as suggested by Duncan P. N. Exon Smith. llvm-svn: 240553
* [ADT] Teach DenseMap to support StringRef keys.Chandler Carruth2015-06-241-0/+25
| | | | | | | | | | | | While often you want to use something specialized like StringMap, when the strings already have persistent storage a normal densemap over them can be more efficient. This can't go into StringRef.h because of really obnoxious header chains from the hashing code to the endian detection code to CPU feature detection code to StringMap. llvm-svn: 240528
* ADT: Add a string APSInt constructor.Alex Lorenz2015-06-231-0/+19
| | | | | | | | | | | | This commit moves the APSInt initialization code that's used by the LLLexer class into a new APSInt constructor that constructs APSInts from strings. This change is useful for MIR Serialization, as it would allow the MILexer class to use the same APSInt initialization as LLexer when parsing immediate machine operands. llvm-svn: 240436
* modules: Add explicit dependency on intrinsics_genDuncan P. N. Exon Smith2015-06-161-0/+2
| | | | | | | | | `LLVM_ENABLE_MODULES` builds sometimes fail because `Intrinsics.td` needs to regenerate `Instrinsics.h` before anyone can include anything from the LLVM_IR module. Represent the dependency explicitly to prevent that. llvm-svn: 239796
* Removing spurious semi colons; NFC.Aaron Ballman2015-06-091-1/+1
| | | | llvm-svn: 239399
* [APInt] Remove special case for i1.Benjamin Kramer2015-06-041-0/+6
| | | | | | Add a unit test. llvm-svn: 239062
* ARMTargetParser: Make BSD Thumb/BE armv6 workRenato Golin2015-05-271-0/+8
| | | | | | | Simple change to make arch like "thumbv6" and "armbev6" to return the correct CPU for FreeBSD and NetBSD. llvm-svn: 238353
* Adding profile and version parsers to ARMTargetParserRenato Golin2015-05-221-0/+20
| | | | | | | This allows us to match armv6m to default to thumb, but will also be used by Clang's driver and remove the current incomplete copy in it. llvm-svn: 238036
* Make Triple::parseARMArch use ARMTargetParserRenato Golin2015-05-211-0/+65
| | | | | | | | | | | Simplifying Triple::parseARMArch, leaving all the parsing to ARMTargetParser. This commit also adds AArch64 detection to ARMTargetParser canonicalization, and a two RedHat arch names (v{6,7}hl, meaning hard-float / little-endian). Adding enough unit tests to cover the basics. Clang checks fine. llvm-svn: 237902
* Get Triple::getARMCPUForArch() to use TargetParserRenato Golin2015-05-201-13/+136
| | | | | | | | | | | | | | | | | | | | First ARMTargetParser FIXME, conservatively changing the way we parse CPUs in the back-end. Still not perfect, with a lot of special cases, but moving towards a more generic solution. Moving all logic to the target parser made some unwritten assumptions about architectures in Clang to break. I've added a lot of architectures required by Clang, and default to CPUs that Clang believes it should (and I agree). I've also added a lot of unit tests, with the correct CPU for each architecture, and Clang seems to be working correctly, too. It also became clear that using "unsigned ID" as the argument for the get methods makes it hard to know what ID, so I also changed the argument names to match the enum type names. llvm-svn: 237797
* [ARM] Reject invalid -march valuesJohn Brawn2015-05-081-0/+31
| | | | | | | | | | | | | | | Restructure Triple::getARMCPUForArch so that invalid values will return nullptr, while retaining the behaviour that an argument specifying no particular architecture version will give a default CPU. This will be used by clang to give an error on invalid -march values. Also restructure the extraction of the architecture version from the MArch string a little to hopefully make what it's doing clearer. Differential Revision: http://reviews.llvm.org/D9599 llvm-svn: 236845
* Fix regression in parsing armv{6,7}hl- triples. These are used by SUSEIsmail Donmez2015-05-051-0/+12
| | | | | | | | and Redhat currently. Reviewed by Jonathan Roelofs. llvm-svn: 236492
* Move unit test into anonymous namespace as per convention.Douglas Katzman2015-05-011-1/+2
| | | | llvm-svn: 236332
* Exhaustively test all triples in TripleTest.Douglas Katzman2015-04-301-4/+4
| | | | | | | | | Iteration over all permutations didn't really work, due to evolution of the underlying enums. Differential Revision: http://reviews.llvm.org/D9057 llvm-svn: 236251
* New architecture name - 'sparcel' for Sparc little-endian.Douglas Katzman2015-04-291-0/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D9263 llvm-svn: 236139
* Fix APInt long division algorithmPawel Bylica2015-04-241-182/+66
| | | | | | | | | | | | | | | | Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" handling. Test Plan: Unit test that reveals the bug included. Reviewers: chandlerc, yaron.keren Reviewed By: yaron.keren Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9196 llvm-svn: 235699
* Another test to exercise APInt divide step D6.Yaron Keren2015-04-221-0/+13
| | | | | | This is divrem_big7 since divrem_big6 is used in Pawel upcoming patch. llvm-svn: 235536
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-113-6/+3
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* Default to armv7 cpu for NaCl when march=armDerek Schuff2015-03-261-0/+4
| | | | | | | | | | | | | | Summary: When the arch is given as "arm" clang uses the default target CPU from LLVM to determine what the real arch should be (i.e. "arm" becomes "armv4t" because LLVM's getARMCPUForArch falls back to "arm7tdmi"). Default to "cortex-a8" so that we end up with "armv7" in clang. the nacl-direct.c test in clang also covers this case. Differential Revision: http://reviews.llvm.org/D8589 llvm-svn: 233321
OpenPOWER on IntegriCloud