summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [APInt] Use getRawData to slightly simplify some code.Craig Topper2017-05-101-2/+2
| | | | llvm-svn: 302702
* [APInt] Remove check for single word since single word was handled earlier ↵Craig Topper2017-05-101-2/+2
| | | | | | in the function. NFC llvm-svn: 302701
* [APInt] Fix indentation of tcDivide. Combine variable declaration and ↵Craig Topper2017-05-101-15/+13
| | | | | | initialization. llvm-svn: 302626
* [APInt] Use getNumWords function in udiv/urem/udivrem instead of ↵Craig Topper2017-05-101-12/+6
| | | | | | reimplementinging it. llvm-svn: 302625
* [APInt] Remove return value from tcFullMultiply.Craig Topper2017-05-091-11/+5
| | | | | | | | The description says it returns the number of words needed to represent the results. But the way it was coded it always returns (lhsWords + rhsWords) or (lhsWords + rhsWords - 1). But the result could be even smaller than that and it wouldn't tell you. No one uses the result today so rather than try to fix it, just remove it. llvm-svn: 302551
* [APInt] Use default constructor instead of explicitly creating a 1-bit APInt ↵Craig Topper2017-05-081-2/+2
| | | | | | | | in udiv and urem. NFC The default constructor does the same thing. llvm-svn: 302487
* [APInt] Remove 'else' after 'return' in udiv and urem. NFCCraig Topper2017-05-081-9/+7
| | | | llvm-svn: 302486
* [APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from ↵Craig Topper2017-05-081-6/+5
| | | | | | | | the earlier loop. NFC The value of 'i' is always the smaller of DstParts and SrcParts so we can just use that fact to write all the code in terms of SrcParts and DstParts. llvm-svn: 302408
* [APInt] Use std::min instead of writing the same thing with the ternary ↵Craig Topper2017-05-081-1/+1
| | | | | | operator. NFC llvm-svn: 302407
* [APInt] Remove 'else' after 'return' in tcMultiply methods. NFCCraig Topper2017-05-081-24/+23
| | | | llvm-svn: 302406
* [APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.Craig Topper2017-05-081-5/+1
| | | | llvm-svn: 302403
* [APInt] Add support for multiplying by a uint64_t.Craig Topper2017-05-081-0/+10
| | | | | | This makes multiply similar to add, sub, xor, and, and or. llvm-svn: 302402
* If posix_fallocate returns EOPNOTSUPP, fallback to ftruncate.Joerg Sonnenberger2017-05-051-4/+5
| | | | | | This can happen at least on NetBSD. llvm-svn: 302263
* fix build on CygwinNuno Lopes2017-05-051-1/+1
| | | | llvm-svn: 302246
* [APInt] Reduce number of allocations involved in multiplying. Reduce worst ↵Craig Topper2017-05-041-110/+10
| | | | | | | | | | | | | | | | | | | | | | case multiply size Currently multiply is implemented in operator*=. Operator* makes a copy and uses operator*= to modify the copy. Operator*= itself allocates a temporary buffer to hold the multiply result as it computes it. Then copies it to the buffer in *this. Operator*= attempts to bound the size of the result based on the number of active bits in its inputs. It also has a couple special cases to handle 0 inputs without any memory allocations or multiply operations. The best case is that it calculates a single word regardless of input bit width. The worst case is that it calculates the a 2x input width result and drop the upper bits. Since operator* uses operator*= it incurs two allocations, one for a copy of *this and one for the temporary allocation. Neither of these allocations are kept after the method operation is done. The main usage in the backend appears to be ConstantRange::multiply which uses operator* rather than operator*=. This patch moves the multiply operation to operator* and implements operator*= using it. This avoids the copy in operator*. operator* now allocates a result buffer sized the same width as its inputs no matter what. This buffer will be used as the buffer for the returned APInt. Finally, we reuse tcMultiply to implement the multiply operation. This function is capable of not calculating additional upper words that will be discarded. This change does lose the special optimizations for the inputs using less words than their size implies. But it also removed the getActiveBits calls from all multiplies. If we think those optimizations are important we could look at providing additional bounds to tcMultiply to limit the computations. Differential Revision: https://reviews.llvm.org/D32830 llvm-svn: 302171
* [AArch64] Fix variable name ambiguity in r302078.Ahmed Bougacha2017-05-031-2/+4
| | | | | | ArchKind is passed to the function, but it's also a type. llvm-svn: 302081
* [AArch64] Make the TargetParser add CPU exts provided by the arch.Ahmed Bougacha2017-05-031-1/+1
| | | | | | | | | | | | | | | | Otherwise, each CPU has to manually specify the extensions it supports, even though they have to be a superset of the base arch extensions. And when there's redundant data there's stale data, so most of the CPUs lie about the features they support (almost none lists AEK_FP). Instead, do the saner thing: add the optional extensions on top of the base extensions provided by the architecture. The ARM TargetParser has the same behavior. Differential Revision: https://reviews.llvm.org/D32780 llvm-svn: 302078
* Resubmit r301986 and r301987 "Add codeview::StringTable"Zachary Turner2017-05-032-0/+26
| | | | | | | | | | | | | | | | | | | | | | This was reverted due to a "missing" file, but in reality what happened was that I renamed a file, and then due to a merge conflict both the old file and the new file got added to the repository. This led to an unused cpp file being in the repo and not referenced by any CMakeLists.txt but #including a .h file that wasn't in the repo. In an even more unfortunate coincidence, CMake didn't report the unused cpp file because it was in a subdirectory of the folder with the CMakeLists.txt, and not in the same directory as any CMakeLists.txt. The presence of the unused file was then breaking certain tools that determine file lists by globbing rather than by what's specified in CMakeLists.txt In any case, the fix is to just remove the unused file from the patch set. llvm-svn: 302042
* [X86][LWP] Add llvm support for LWP instructions (reapplied).Simon Pilgrim2017-05-031-0/+1
| | | | | | | | | | This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4). Reapplied - this time without changing line endings of existing files. Differential Revision: https://reviews.llvm.org/D32769 llvm-svn: 302041
* [APInt] Give the value union a name so we can remove assumptions on VAL ↵Craig Topper2017-05-031-145/+144
| | | | | | | | | | | | | | being the larger member Currently several places assume the VAL member is always at least the same size as pVal. In particular for a memcpy in the move assignment operator. While this is a true assumption, it isn't good practice to assume this. This patch gives the union a name so we can write the memcpy in terms of the union itself. This also adds a similar memcpy to the move constructor where we previously just copied using VAL directly. This patch is mostly just a mechanical addition of the U in front of VAL and pVAL everywhere. But several constructors had to be modified since we can't directly initializer a field of named union from the initializer list. Differential Revision: https://reviews.llvm.org/D30629 llvm-svn: 302040
* Revert rL302028 due to accidental line ending changes.Simon Pilgrim2017-05-031-1496/+1495
| | | | llvm-svn: 302038
* [X86][LWP] Add llvm support for LWP instructions.Simon Pilgrim2017-05-031-1495/+1496
| | | | | | | | This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4). Differential Revision: https://reviews.llvm.org/D32769 llvm-svn: 302028
* [Triple] Add a "macos" OS type that acts as a synonym for "macosx"Alex Lorenz2017-05-031-1/+3
| | | | | | | | | | | The "macosx" OS type is still the canonical type. In the future "macos" will become the canonical OS type (but we will still support "macosx"). rdar://27043820 Differential Revision: https://reviews.llvm.org/D32748 llvm-svn: 302011
* Revert r301986 (and subsequent r301987).Daniel Jasper2017-05-032-26/+0
| | | | | | | | | The patch is failing to add StringTableStreamBuilder.h, but that isn't even discovered because the corresponding StringTableStreamBuilder.cpp isn't added to any CMakeLists.txt file and thus never built. I think this patch is just incomplete. llvm-svn: 302002
* Make codeview::StringTable.Zachary Turner2017-05-022-0/+26
| | | | | | | | | | | | | | | | | | | | Previously we had knowledge of how to serialize and deserialize a string table inside of DebugInfo/PDB, but the string table that it serializes contains a piece that is actually considered CodeView and can appear outside of a PDB. We already have logic in llvm-readobj and MCCodeView to read and write this format, so it doesn't make sense to duplicate the logic in DebugInfoPDB as well. This patch makes codeview::StringTable (for writing) and codeview::StringTableRef (for reading), updates DebugInfoPDB to use these classes for its own writing, and updates llvm-readobj to additionally use StringTableRef for reading. It's a bit more difficult to get MCCodeView to use this for writing, but it's a logical next step. llvm-svn: 301986
* Make DWARFDebugLine use StringRef for directory/file tables. NFCPaul Robinson2017-05-021-0/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D32728 llvm-svn: 301940
* [APInt] Move APInt::getSplat out of line.Craig Topper2017-05-021-0/+11
| | | | | | I think this method is probably too complex to be inlined. llvm-svn: 301901
* [APInt] Move the setBit and clearBit methods inline.Craig Topper2017-05-021-16/+0
| | | | | | This makes setBit/clearBit more consistent with setBits which is already inlined. llvm-svn: 301900
* Remove unnecessary conditions as suggested by clang-tidy. NFCGabor Horvath2017-05-011-3/+1
| | | | | | | | Patch by: Gergely Angeli! Differential Revision: https://reviews.llvm.org/D31936 llvm-svn: 301807
* Include <cstdio> in PrettyStackTrace.cpp, since it uses vsnprintf(3).Dimitry Andric2017-04-291-0/+1
| | | | llvm-svn: 301760
* [APInt] Use inplace shift methods where possible. NFCICraig Topper2017-04-281-3/+4
| | | | llvm-svn: 301612
* [llvm-pdbdump] Allow printing only a portion of a stream.Zachary Turner2017-04-281-2/+4
| | | | | | | | | | | | When dumping raw data from a stream, you might know the offset of a certain record you're interested in, as well as how long that record is. Previously, you had to dump the entire stream and wade through the bytes to find the interesting record. This patch allows you to specify an offset and length on the command line, and it will only dump the requested range. llvm-svn: 301607
* Refactor DynamicLibrary so searching for a symbol will have a defined order andFrederich Munch2017-04-275-283/+362
| | | | | | | | | | | | | | | | | | | | | | | | | | | libraries are properly unloaded when llvm_shutdown is called. Summary: This was mostly affecting usage of the JIT, where storing the library handles in a set made iteration unordered/undefined. This lead to disagreement between the JIT and native code as to what the address and implementation of particularly on Windows with stdlib functions: JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv Native: getenv("TEST") -> NULL // called ucrt.dll, getenv Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows not giving priority to the process' symbols as it did on Unix. Reviewers: chapuni, v.g.vassilev, lhames Reviewed By: lhames Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D30107 llvm-svn: 301562
* Revert r301487: Replace HashString algorithm with xxHash64Rui Ueyama2017-04-261-1/+2
| | | | | | This reverts commit r301487 to make buildbots green. llvm-svn: 301491
* Replace HashString algorithm with xxHash64Rui Ueyama2017-04-261-2/+1
| | | | | | | | | | | | The previous algorithm processed one character at a time, which is very painful on a modern CPU. Replace it with xxHash64, which both already exists in the codebase and is fairly fast. Patch from Scott Smith! Differential Revision: https://reviews.llvm.org/D32509 llvm-svn: 301487
* Revert "Refactor DynamicLibrary so searching for a symbol will have a ↵Frederich Munch2017-04-245-362/+283
| | | | | | | | | | defined order" The i686-mingw32-RA-on-linux bot is still having errors. This reverts commit r301236. llvm-svn: 301240
* Refactor DynamicLibrary so searching for a symbol will have a defined order andFrederich Munch2017-04-245-283/+362
| | | | | | | | | | | | | | | | | | | | | | | | | | | libraries are properly unloaded when llvm_shutdown is called. Summary: This was mostly affecting usage of the JIT, where storing the library handles in a set made iteration unordered/undefined. This lead to disagreement between the JIT and native code as to what the address and implementation of particularly on Windows with stdlib functions: JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv Native: getenv("TEST") -> NULL // called ucrt.dll, getenv Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows not giving priority to the process' symbols as it did on Unix. Reviewers: chapuni, v.g.vassilev, lhames Reviewed By: lhames Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D30107 llvm-svn: 301236
* [APInt] Simplify the zext and sext methodsCraig Topper2017-04-241-33/+18
| | | | | | | | | | This replaces a hand written copy loop with a call to memcpy for both zext and sext. For sext, it replaces multiple if/else blocks propagating sign information forward. Now we just do a copy, a sign extension on the last copied word, a memset, and clearUnusedBits. Differential Revision: https://reviews.llvm.org/D32417 llvm-svn: 301201
* [APInt] Add ashrInPlace method and rewrite ashr to make a copy and then call ↵Craig Topper2017-04-241-76/+36
| | | | | | | | | | | | ashrInPlace. This patch adds an in place version of ashr to match lshr and shl which were recently added. I've tried to make this similar to the lshr code with additions to handle the sign extension. I've also tried to do this with less if checks than the current ashr code by sign extending the original result to a word boundary before doing any of the shifting. This removes a lot of the complexity of determining where to fill in sign bits after the shifting. Differential Revision: https://reviews.llvm.org/D32415 llvm-svn: 301198
* [APInt] Fix repeated word in comments. NFCCraig Topper2017-04-241-2/+2
| | | | llvm-svn: 301192
* Add SUSE vendorIsmail Donmez2017-04-241-0/+2
| | | | | | | | | | | | | | Summary: SUSE's ARM triples end with -gnueabi even though they are hard-float. This requires special handling of SUSE ARM triples. Hence we need a way to differentiate the SUSE as vendor. This CL adds that. Reviewers: chandlerc, compnerd, echristo, rengolin Reviewed By: rengolin Subscribers: aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D32426 llvm-svn: 301174
* [APInt] Make behavior of ashr by BitWidth consistent between single and ↵Craig Topper2017-04-241-1/+3
| | | | | | | | multi word. Previously single word would always return 0 regardless of the original sign. Multi word would return all 0s or all 1s based on the original sign. Now single word takes into account the sign as well. llvm-svn: 301159
* Revert "Refactor DynamicLibrary so searching for a symbol will have a ↵Frederich Munch2017-04-245-359/+275
| | | | | | | | | | defined order.” The changes are causing the i686-mingw32 build to fail. This reverts commit r301153, and the changes for a separate warning on i686-mingw32 in r301155 and r301156. llvm-svn: 301157
* Fix warning converting from boolean to pointer introduced in r301153.Frederich Munch2017-04-242-2/+2
| | | | | | This reverts commit r301155, which was incorrect. llvm-svn: 301156
* Fix warning converting from void* to boolean introduced in r301153.Frederich Munch2017-04-241-1/+1
| | | | llvm-svn: 301155
* Refactor DynamicLibrary so searching for a symbol will have a defined order andFrederich Munch2017-04-245-275/+359
| | | | | | | | | | | | | | | | | | | | | | | | | | | libraries are properly unloaded when llvm_shutdown is called. Summary: This was mostly affecting usage of the JIT, where storing the library handles in a set made iteration unordered/undefined. This lead to disagreement between the JIT and native code as to what the address and implementation of particularly on Windows with stdlib functions: JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv Native: getenv("TEST") -> NULL // called ucrt.dll, getenv Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows not giving priority to the process' symbols as it did on Unix. Reviewers: chapuni, v.g.vassilev, lhames Reviewed By: lhames Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D30107 llvm-svn: 301153
* [APInt] In sext single word case, use SignExtend64 and let the APInt ↵Craig Topper2017-04-231-5/+2
| | | | | | | | constructor mask off any excess bits. The current code is trying to be clever with shifts to avoid needing to clear unused bits. But it looks like the compiler is unable to optimize out the unused bit handling in the APInt constructor. Given this its better to just use SignExtend64 and have more readable code. llvm-svn: 301133
* Revert "[APInt] Fix a few places that use APInt::getRawData to operate ↵Renato Golin2017-04-231-4/+3
| | | | | | | | | | | | | | | | within the normal API." This reverts commit r301105, 4, 3 and 1, as a follow up of the previous revert, which broke even more bots. For reference: Revert "[APInt] Use operator<<= where possible. NFC" Revert "[APInt] Use operator<<= instead of shl where possible. NFC" Revert "[APInt] Use ashInPlace where possible." PR32754. llvm-svn: 301111
* Revert "[APInt] Add ashrInPlace method and implement ashr using it. Also fix ↵Renato Golin2017-04-231-26/+73
| | | | | | | | | | a bug in the shift by BitWidth handling." This reverts commit r301094, as it broke all ARM self-hosting bots. PR32754. llvm-svn: 301110
* [APInt] Use operator<<= instead of shl where possible. NFCCraig Topper2017-04-231-3/+4
| | | | llvm-svn: 301103
OpenPOWER on IntegriCloud