summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [Support] Add the option to not follow symlinks on stat.Zachary Turner2017-03-073-21/+12
| | | | llvm-svn: 297154
* [APInt] Add rvalue reference support to and, or, xor operations to allow ↵Craig Topper2017-03-071-25/+0
| | | | | | | | | | | | | | | | their memory allocation to be reused when possible This extends an earlier change that did similar for add and sub operations. With this first patch we lose the fastpath for the single word case as operator&= and friends don't support it. This can be added there if we think that's important. I had to change some functions in the APInt class since the operator overloads were moved out of the class and can't be used inside the class now. The getBitsSet change collides with another outstanding patch to implement it with setBits. But I didn't want to make this patch dependent on that series. I've also removed the Or, And, Xor functions which were rarely or never used. I already commited two changes to remove the only uses of Or that existed. Differential Revision: https://reviews.llvm.org/D30612 llvm-svn: 297121
* Use LLVM for all stat-related functionality.Zachary Turner2017-03-071-0/+7
| | | | | | | | | | This deletes LLDB's FileType enumeration and replaces all users, and all calls to functions that check whether a file exists etc with corresponding calls to LLVM. Differential Revision: https://reviews.llvm.org/D30624 llvm-svn: 297116
* [APInt] Add setLowBits/setHighBits methods to APInt.Craig Topper2017-03-071-29/+23
| | | | | | | | | | | | | | | | | | | | | Summary: There are quite a few places in the code base that do something like the following to set the high or low bits in an APInt. KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1); For BitWidths larger than 64 this creates a short lived APInt with malloced storage. I think it might even call malloc twice. Its better to just provide methods that can set the necessary bits without the temporary APInt. I'll update usages that benefit in a separate patch. Reviewers: majnemer, MatzeB, davide, RKSimon, hans Reviewed By: hans Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30525 llvm-svn: 297111
* Try to fix thread name truncation on non-Windows.Zachary Turner2017-03-043-7/+16
| | | | llvm-svn: 296976
* Improve the Threading code on NetBSDKamil Rytarowski2017-03-041-5/+2
| | | | | | | | Do not include <sys/user.h> on NetBSD. It's dead file and will be removed. No need to include <sys/sysctl.h> in this code context on NetBSD. llvm-svn: 296973
* Truncate thread names if they're too long.Zachary Turner2017-03-042-3/+29
| | | | llvm-svn: 296972
* DebugCounter: Initialize skip to 0, not -1Daniel Berlin2017-03-041-2/+2
| | | | llvm-svn: 296971
* Silence a warning, NFCKrzysztof Parzyszek2017-03-031-0/+1
| | | | llvm-svn: 296917
* Detect the existence of pthread_{s,g}etname_np in libpthread on LinuxKrzysztof Parzyszek2017-03-031-0/+4
| | | | | | Older Linux distributions may not have those functions. llvm-svn: 296915
* Fix Threading path when LLVM_ENABLE_THREADS=0.Zachary Turner2017-03-031-1/+1
| | | | llvm-svn: 296914
* Add missing #includes for FreeBSD.Zachary Turner2017-03-031-4/+9
| | | | llvm-svn: 296902
* Try again to appease the FreeBSD bot.Zachary Turner2017-03-031-7/+2
| | | | | | | The actual logic was wrong, not just the type conversion. This should get it correct. llvm-svn: 296899
* Try to appease the FreeBSD bots.Zachary Turner2017-03-031-2/+2
| | | | | | | | pthread_self() returns a pthread_t, but we were setting it to an int. It seems the cast to int when calling sysctl is still the correct thing to do, though. llvm-svn: 296892
* Don't bring in llvm/Support/thread.h in Threading.cppZachary Turner2017-03-031-2/+8
| | | | | | | | | | | | Doing so defines the type llvm::thread. On FreeBSD, we need to call a macro which references its own ::thread type, which causes an ambiguity due to ADL when inside of the llvm namespace. Since we don't even need this unless LLVM_ENABLE_THREADS == 1, we don't even need this type anyway, as it is always equal to std::thread, so we can just use that directly. llvm-svn: 296891
* Add #include for unistd.h on Linux.Zachary Turner2017-03-031-0/+1
| | | | llvm-svn: 296890
* [Support] Provide access to current thread name/thread id.Zachary Turner2017-03-033-84/+311
| | | | | | | | | | | | | | | | Applications often need the current thread id when making system calls, and some operating systems provide the notion of a thread name, which can be useful in enabling better diagnostics when debugging or logging. This patch adds an accessor for the thread id, and "best effort" getters and setters for the thread name. Since this is non critical functionality, no error is returned to indicate that a platform doesn't support thread names. Differential Revision: https://reviews.llvm.org/D30526 llvm-svn: 296887
* [Support] Move Stream library from MSF -> Support.Zachary Turner2017-03-024-0/+213
| | | | | | | | | | After several smaller patches to get most of the core improvements finished up, this patch is a straight move and header fixup of the source. Differential Revision: https://reviews.llvm.org/D30266 llvm-svn: 296810
* Cast to the right type on Windows.Vassil Vassilev2017-03-021-1/+1
| | | | llvm-svn: 296778
* Reland r296442 with modifications reverted in r296463.Vassil Vassilev2017-03-022-0/+24
| | | | | | | | | | | | | | Original commit message: "Allow externally dlopen-ed libraries to be registered as permanent libraries. This is also useful in cases when llvm is in a shared library. First we dlopen the llvm shared library and then we register it as a permanent library in order to keep the JIT and other services working. Patch reviewed by Vedant Kumar (D29955)!" llvm-svn: 296774
* Do not leak OpenedHandles.Vassil Vassilev2017-03-021-10/+2
| | | | llvm-svn: 296748
* [APInt] Optimize APInt creation from uint64_tCraig Topper2017-03-011-0/+1
| | | | | | | | | | | | | | | | | Summary: This patch moves the clearUnusedBits calls into the two different initialization paths for APInt from a uint64_t. This allows the compiler to better optimize the clearing of the unused bits for the single word case. And it puts the clearing for the multi word case into the initSlowCase function to save code. In the common case of initializing with 0 this allows the clearing to be completely optimized out for the single word case. On my local x86 build this is showing a ~45kb reduction in the size of the opt binary. Reviewers: RKSimon, hans, majnemer, davide, MatzeB Reviewed By: hans Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30486 llvm-svn: 296677
* Process tilde in llvm::sys::path::nativeSerge Pavlov2017-03-011-0/+8
| | | | | | | | | | | | | Windows does not treat `~` as a reference to home directory, so the call to `llvm::sys::path::native` on, say, `~/somedir` produces `~\somedir`, which has different meaning than the original path. With this change tilde is expanded on Windows to user profile directory. Such behavior keeps original meaning of the path and is consistent with the algorithm of `llvm::sys::path::home_directory`. Differential Revision: https://reviews.llvm.org/D27527 llvm-svn: 296590
* [DWARFv5] Emit new unit header format.Paul Robinson2017-02-281-0/+11
| | | | | | | | | Requesting DWARF v5 will now get you the new compile-unit and type-unit headers. llvm-dwarfdump will also recognize them. Differential Revision: http://reviews.llvm.org/D30206 llvm-svn: 296514
* Set default CPU for OpenBSD/arm to Cortex-A8Brad Smith2017-02-281-0/+1
| | | | llvm-svn: 296493
* Revert r296474 - [globalisel] Change LLT constructor string into an LLT ↵Daniel Sanders2017-02-282-48/+0
| | | | | | | | subclass that knows how to generate it. There's a circular dependency that's only revealed when LLVM_ENABLE_MODULES=1. llvm-svn: 296478
* [globalisel] Change LLT constructor string into an LLT subclass that knows ↵Daniel Sanders2017-02-282-0/+48
| | | | | | | | | | | | | | | | | | how to generate it. Summary: This will allow future patches to inspect the details of the LLT. The implementation is now split between the Support and CodeGen libraries to allow TableGen to use this class without introducing layering concerns. Thanks to Ahmed Bougacha for finding a reasonable way to avoid the layering issue and providing the version of this patch without that problem. Reviewers: t.p.northover, qcolombet, rovka, aditya_nandakumar, ab, javed.absar Subscribers: arsenm, nhaehnle, mgorny, dberris, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D30046 llvm-svn: 296474
* Reformat a blank line.NAKAMURA Takumi2017-02-281-1/+1
| | | | llvm-svn: 296464
* Revert r296442 (and r296443), "Allow externally dlopen-ed libraries to be ↵NAKAMURA Takumi2017-02-282-51/+14
| | | | | | | | registered as permanent libraries." It broke clang/test/Analysis/checker-plugins.c llvm-svn: 296463
* Fix Win bots.Vassil Vassilev2017-02-281-2/+2
| | | | llvm-svn: 296443
* Allow externally dlopen-ed libraries to be registered as permanent libraries.Vassil Vassilev2017-02-282-13/+50
| | | | | | | | | | This is also useful in cases when llvm is in a shared library. First we dlopen the llvm shared library and then we register it as a permanent library in order to keep the JIT and other services working. Patch reviewed by Vedant Kumar (D29955)! llvm-svn: 296442
* [APInt] Add APInt::extractBits() method to extract APInt subrange (reapplied)Simon Pilgrim2017-02-251-0/+36
| | | | | | | | | | | | | | | | The current pattern for extract bits in range is typically: Mask.lshr(BitOffset).trunc(SubSizeInBits); Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation of memory for the temporary variable. This is another of the compile time issues identified in PR32037 (see also D30265). This patch adds the APInt::extractBits() helper method which avoids the temporary memory allocation. Differential Revision: https://reviews.llvm.org/D30336 llvm-svn: 296272
* Revert: r296141 [APInt] Add APInt::extractBits() method to extract APInt ↵Simon Pilgrim2017-02-241-32/+0
| | | | | | | | | | | | | | | | | | subrange The current pattern for extract bits in range is typically: Mask.lshr(BitOffset).trunc(SubSizeInBits); Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation of memory for the temporary variable. This is another of the compile time issues identified in PR32037 (see also D30265). This patch adds the APInt::extractBits() helper method which avoids the temporary memory allocation. Differential Revision: https://reviews.llvm.org/D30336 llvm-svn: 296147
* [APInt] Add APInt::extractBits() method to extract APInt subrangeSimon Pilgrim2017-02-241-0/+32
| | | | | | | | | | | | | | | | The current pattern for extract bits in range is typically: Mask.lshr(BitOffset).trunc(SubSizeInBits); Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation of memory for the temporary variable. This is another of the compile time issues identified in PR32037 (see also D30265). This patch adds the APInt::extractBits() helper method which avoids the temporary memory allocation. Differential Revision: https://reviews.llvm.org/D30336 llvm-svn: 296141
* [APInt] Add APInt::setBits() method to set all bits in rangeSimon Pilgrim2017-02-241-0/+33
| | | | | | | | | | | | | | | | | | The current pattern for setting bits in range is typically: Mask |= APInt::getBitsSet(MaskSizeInBits, LoPos, HiPos); Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation memory for the temporary variable. This is one of the key compile time issues identified in PR32037. This patch adds the APInt::setBits() helper method which avoids the temporary memory allocation completely, this first implementation uses setBit() internally instead but already significantly reduces the regression in PR32037 (~10% drop). Additional optimization may be possible. I investigated whether there is need for APInt::clearBits() and APInt::flipBits() equivalents but haven't seen these patterns to be particularly common, but reusing the code would be trivial. Differential Revision: https://reviews.llvm.org/D30265 llvm-svn: 296102
* Strip trailing whitespace.Simon Pilgrim2017-02-231-8/+8
| | | | llvm-svn: 295989
* [Support] Re-add the special OSX flags on mmap.Zachary Turner2017-02-221-0/+19
| | | | | | | | The problem appears to be that these flags can only be used when mapping a file for read-only, not for readwrite. So we do that here. llvm-svn: 295880
* [Support] Provide linux/magic.h fallback for older kernelsMichal Gorny2017-02-221-0/+15
| | | | | | | | | | | | | | | | | | | | | The function for distinguishing local and remote files added in r295768 unconditionally uses linux/magic.h header to provide necessary filesystem magic numbers. However, in kernel headers predating 2.6.18 the magic numbers are spread throughout multiple include files. Furthermore, LLVM did not require kernel headers being installed so far. To increase the portability across different versions of Linux kernel and different Linux systems, add CMake header checks for linux/magic.h and -- if it is missing -- the linux/nfs_fs.h and linux/smb.h headers which contained the numbers previously. Furthermore, since the numbers are static and the feature does not seem critical enough to make LLVM require kernel headers at all, add fallback constants for the case when none of the necessary headers is available. Differential Revision: https://reviews.llvm.org/D30261 llvm-svn: 295854
* Try to fix the buildbot on OSX.Zachary Turner2017-02-211-16/+0
| | | | | | | | | Since I'm only seeing failures on OSX, and it's saying permission denied, I'm suspecting this is due to the addition of the MAP_RESILIENT_CODESIGN and/or MAP_RESILIENT_MEDIA flags. Speculatively trying to remove those to get the bots working. llvm-svn: 295770
* Try to fix Android build.Zachary Turner2017-02-211-1/+3
| | | | llvm-svn: 295769
* [Support] Add a function to check if a file resides locally.Zachary Turner2017-02-213-21/+153
| | | | | | Differential Revision: https://reviews.llvm.org/D30010 llvm-svn: 295768
* Try to fix line endings.Zachary Turner2017-02-211-457/+457
| | | | llvm-svn: 295759
* Remove svn:eol-style property from 2 files.Zachary Turner2017-02-211-457/+457
| | | | | | There are still over 3400 files remaining with this property set, but there are tens of thousands more with the property not set. Until we decide what to do on a global scale, this at least unblocks me temporarily. llvm-svn: 295756
* Do not leak OpenedHandles.Vassil Vassilev2017-02-212-7/+4
| | | | | | Reviewed by Vedant Kumar (D30178) llvm-svn: 295737
* Add two files lost in rebase, causing build breakDaniel Berlin2017-02-191-0/+108
| | | | llvm-svn: 295595
* Add initial support for debug countingDaniel Berlin2017-02-192-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We have support for bisection, and bugpoint can reduce testcases often to a single pass. But that doesn't help reduce it to a single transform by a single pass. Which debug counting lets us do. Debug counting lets you instrument a pass so that it only executes a certain thing (rwhatever you want) after skipping it a certain time of times, and then only does a certain number of executions before saying "skip" again. To make it concrete, for predicateinfo, if i instrument use renaming, i can make it so it skips renaming the first N uses, renames the next N, and then skips the rest. This lets you narrow down a miscompilation to, often, a single transformation, and then also debug it (by using the same command line parameters). Reviewers: chandlerc, davide, mehdi_amini Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29998 llvm-svn: 295593
* [AArch64] Add Cavium ThunderX supportJoel Jones2017-02-171-0/+2
| | | | | | | | | | | | | | This set of patches adds support for Cavium ThunderX ARM64 processors: * ThunderX * ThunderX T81 * ThunderX T83 * ThunderX T88 Patch by Stefan Teleman Differential Revision: https://reviews.llvm.org/D28891 llvm-svn: 295475
* Change default TimerGroup singleton to use magic staticsErich Keane2017-02-161-16/+3
| | | | | | | | | | | TimerGroup was showing up on a leak in valigrind, and used some pretty complex code to implement a singleton. This patch replaces the implementation with a vastly simpler one. Differential Revision: https://reviews.llvm.org/D28367 llvm-svn: 295370
* [Support] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2017-02-153-23/+34
| | | | | | other minor fixes (NFC). llvm-svn: 295243
* [Support] Add StringRef::getAsDouble.Zachary Turner2017-02-141-0/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D29918 llvm-svn: 295089
OpenPOWER on IntegriCloud