summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
* [Support] Add newline when dumping an APInt.Davide Italiano2017-01-311-1/+1
| | | | | | | This annoyed me a few times but was lazy so I haven't fixed it until today, when the output of my debugger was too confusing. llvm-svn: 293691
* Cleanup dump() functions.Matthias Braun2017-01-284-3/+10
| | | | | | | | | | | | | | | | | | We had various variants of defining dump() functions in LLVM. Normalize them (this should just consistently implement the things discussed in http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html For reference: - Public headers should just declare the dump() method but not use LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - The definition of a dump method should look like this: #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MyClass::dump() { // print stuff to dbgs()... } #endif llvm-svn: 293359
* [APFloat] Reduce some dispatch boilerplates. NFC.Tim Shen2017-01-271-5/+12
| | | | | | | | | | | | Summary: This is an attempt to reduce the verbose manual dispatching code in APFloat. This doesn't handle multiple dispatch on single discriminator (e.g. APFloat::add(const APFloat&)), nor handles multiple dispatch on multiple discriminators (e.g. APFloat::convert()). Reviewers: hfinkel, echristo, jlebar Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D29161 llvm-svn: 293255
* [APFloat] Fix comments. NFC.Tim Shen2017-01-261-28/+30
| | | | | | | | | | | | Summary: Fix comments in response to jlebar's comments in D27872. Reviewers: jlebar Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29109 llvm-svn: 293116
* [Support] Use O_CLOEXEC only when declaredPavel Labath2017-01-241-2/+20
| | | | | | | | | | | | | | | | | | | Summary: Use the O_CLOEXEC flag only when it is available. Some old systems (e.g. SLES10) do not support this flag. POSIX explicitly guarantees that this flag can be checked for using #if, so there is no need for a CMake check. In case O_CLOEXEC is not supported, fall back to fcntl(FD_CLOEXEC) instead. Reviewers: rnk, rafael, mgorny Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28894 llvm-svn: 292912
* [Support] Add sys::fs::set_current_path() (aka chdir)Pavel Labath2017-01-242-0/+22
| | | | | | | | | | | | | | | Summary: This adds a cross-platform way of setting the current working directory analogous to the existing current_path() function used for retrieving it. The function will be used in lldb. Reviewers: rafael, silvas, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29035 llvm-svn: 292907
* [APInt] Remove calls to clearUnusedBits from XorSlowCase and operator^=Craig Topper2017-01-241-6/+2
| | | | | | | | | | | | | | | | | Summary: There's a comment in XorSlowCase that says "0^0==1" which isn't true. 0 xored with 0 is still 0. So I don't think we need to clear any unused bits here. Now there is no difference between XorSlowCase and AndSlowCase/OrSlowCase other than the operation being performed Reviewers: majnemer, MatzeB, chandlerc, bkramer Reviewed By: MatzeB Subscribers: chfast, llvm-commits Differential Revision: https://reviews.llvm.org/D28986 llvm-svn: 292873
* [APFloat] Add PPCDoubleDouble multiplicationTim Shen2017-01-241-6/+83
| | | | | | | | | | Reviewers: echristo, hfinkel, kbarton, iteratee Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D28382 llvm-svn: 292860
* [APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to ↵Tim Shen2017-01-231-79/+320
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (IEEEdouble, IEEEdouble) Summary: This patch changes the layout of DoubleAPFloat, and adjust all operations to do either: 1) (IEEEdouble, IEEEdouble) -> (uint64_t, uint64_t) -> PPCDoubleDoubleImpl, then run the old algorithm. 2) Do the right thing directly. 1) includes multiply, divide, remainder, mod, fusedMultiplyAdd, roundToIntegral, convertFromString, next, convertToInteger, convertFromAPInt, convertFromSignExtendedInteger, convertFromZeroExtendedInteger, convertToHexString, toString, getExactInverse. 2) includes makeZero, makeLargest, makeSmallest, makeSmallestNormalized, compare, bitwiseIsEqual, bitcastToAPInt, isDenormal, isSmallest, isLargest, isInteger, ilogb, scalbn, frexp, hash_value, Profile. I could split this into two patches, e.g. use 1) for all operatoins first, then incrementally change some of them to 2). I didn't do that, because 1) involves code that converts data between PPCDoubleDoubleImpl and (IEEEdouble, IEEEdouble) back and forth, and may pessimize the compiler. Instead, I find easy functions and use approach 2) for them directly. Next step is to implement move multiply and divide from 1) to 2). I don't have plans for other functions in 1). Differential Revision: https://reviews.llvm.org/D27872 llvm-svn: 292839
* raw_fd_ostream: Make file handles non-inheritable by defaultPavel Labath2017-01-181-2/+2
| | | | | | | | | | | | | | | | Summary: This makes the file descriptors on unix platform non-inheritable (O_CLOEXEC). There is no change in behavior on windows, as the handles were already non-inheritable there. Reviewers: rnk, rafael Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28854 llvm-svn: 292401
* [ARM] Create objdump subtarget from build attrsSam Parker2017-01-181-50/+76
| | | | | | | | | | | Enable an ELFObjectFile to read the its arm build attributes to produce a target triple with a specific ARM architecture. llvm-objdump now uses this functionality to automatically produce a more accurate target. Differential Revision: https://reviews.llvm.org/D28769 llvm-svn: 292366
* [WebAssembly] Add triple support for the new wasm object formatDan Gohman2017-01-171-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D26701 llvm-svn: 292252
* Recommit r292214 "[Support/Compression] - Change zlib API to return Error ↵George Rimar2017-01-171-36/+47
| | | | | | | | | | | | | | | | | | instead of custom status" No any changes, will follow up with D28807 commit containing APLi change for clang to fix build issues happened. Original commit message: [Support/Compression] - Change zlib API to return Error instead of custom status. Previously API returned custom enum values. Patch changes it to return Error with string description. That should help users to report errors in universal way. Differential revision: https://reviews.llvm.org/D28684 llvm-svn: 292226
* Revert r292214 "[Support/Compression] - Change zlib API to return Error ↵George Rimar2017-01-171-47/+36
| | | | | | | | | instead of custom status." It broked clang: http://lab.llvm.org:8080/green//job/clang-stage1-cmake-RA-incremental_build/34218/consoleFull#46141505449ba4694-19c4-4d7e-bec5-911270d8a58c llvm-svn: 292217
* [Support/Compression] - Change zlib API to return Error instead of custom ↵George Rimar2017-01-171-36/+47
| | | | | | | | | | | | status. Previously API returned custom enum values. Patch changes it to return Error with string description. That should help users to report errors in universal way. Differential revision: https://reviews.llvm.org/D28684 llvm-svn: 292214
* Revert r291903 and r291898. Reason: they break check-lld on the bots.Ivan Krasin2017-01-131-72/+47
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Revert [ARM] Fix ubig32_t read in ARMAttributeParser Now using support functions to read data instead of trying to perform casts. =========================================================== Revert [ARM] Enable objdump to construct triple for ARM Now that The ARMAttributeParser has been moved into the library, it has been modified so that it can parse the attributes without printing them and stores them in a map. ELFObjectFile now queries the attributes to fill out the architecture details of a provided triple for 'arm' and 'thumb' targets. llvm-objdump uses this new functionality. Subscribers: llvm-commits, samparker, aemerson, mgorny Differential Revision: https://reviews.llvm.org/D28683 llvm-svn: 291911
* [ARM] Fix ubig32_t read in ARMAttributeParserSam Parker2017-01-131-3/+3
| | | | | | | | | Now using support functions to read data instead of trying to perform casts. Differential Revision: https://reviews.llvm.org/D28669 llvm-svn: 291903
* [ARM] Enable objdump to construct triple for ARMSam Parker2017-01-131-48/+73
| | | | | | | | | | | | | Now that The ARMAttributeParser has been moved into the library, it has been modified so that it can parse the attributes without printing them and stores them in a map. ELFObjectFile now queries the attributes to fill out the architecture details of a provided triple for 'arm' and 'thumb' targets. llvm-objdump uses this new functionality. Differential Revision: https://reviews.llvm.org/D28281 llvm-svn: 291898
* [ARM] Moved ARMAttributeParser to SupportSam Parker2017-01-132-0/+683
| | | | | | | | | Moved ARMAttributeParser out of llvm-readobj and into the support library. Differential Revision: https://reviews.llvm.org/D28227 llvm-svn: 291896
* AMD family 17h (znver1) enablementCraig Topper2017-01-101-0/+19
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch enables the following 1. AMD family 17h architecture using "znver1" tune flag (-march, -mcpu). 2. ISAs that are enabled for "znver1" architecture. 3. Checks ADX isa from cpuid to identify "znver1" flag when -march=native is used. 4. ISAs FMA4, XOP are disabled as they are dropped from amdfam17. 5. For the time being, it uses the btver2 scheduler model. 6. Test file is updated to check this flag. This item is linked to clang review item https://reviews.llvm.org/D28018 Patch by Ganesh Gopalasubramanian Reviewers: RKSimon, craig.topper Subscribers: vprasad, RKSimon, ashutosh.nema, llvm-commits Differential Revision: https://reviews.llvm.org/D28017 llvm-svn: 291543
* TarWriter: Fix a bug in Ustar header.Rui Ueyama2017-01-091-1/+1
| | | | | | | | | | If we split a filename into `Name` and `Prefix`, `Prefix` is at most 145 bytes. We had a bug that didn't split a path correctly. This bug was pointed out by Rafael in the post commit review. This patch adds a unit test for TarWriter to verify the fix. llvm-svn: 291494
* Support outputting to /dev/null.Rafael Espindola2017-01-091-22/+44
| | | | | | | | When writing to a non regular file we cannot rename to it. Since we have to write, we may as well create a temporary file to avoid trying to create an unique file in /dev when trying to write to /dev/null. llvm-svn: 291485
* TarWriter: Set "00" to Ustar version field.Rui Ueyama2017-01-091-5/+10
| | | | | | | | Most (maybe all?) tar commands can handle tar archives with blank version fields, but POSIX requires "00" to be set to the field, so doing it is good for compliance. llvm-svn: 291479
* Define sys::path::convert_to_slashRui Ueyama2017-01-092-10/+12
| | | | | | | | This patch moves convertToUnixPathSeparator from LLD to LLVM. Differential Revision: https://reviews.llvm.org/D28444 llvm-svn: 291414
* CommandLine option: Relax the assertion introduced in r290467 to allows for ↵Mehdi Amini2017-01-081-1/+1
| | | | | | | | | empty string This is used in LDC for custom boolean commandline options, setArgStr is called with an empty string before using AddLiteralOption. llvm-svn: 291406
* TarWriter: Use fitsInUstar function.Rui Ueyama2017-01-071-2/+2
| | | | | | This change should have been commit as part of r291340. llvm-svn: 291341
* TarWriter: Use Ustar header's "prefix" field to store long filenames.Rui Ueyama2017-01-071-1/+27
| | | | | | | | | | | | Tar's Ustar header has the "prefix" field to store a directory part of a filename. It is not as flexible as the PAX-extended filename because there's still a limitation on the maximum filename size, but it mitigates the situation. This patch should unbreak some Windows buildbots that uses very old tar command. llvm-svn: 291340
* Use %z for size_t and avoid deprecated string functionsReid Kleckner2017-01-061-4/+4
| | | | | | | | This usage of strcpy and snprintf was certainly safe, but using them sets off various deprecation and lint warnings. Easier to just write the belt and suspenders version. llvm-svn: 291256
* TarWriter: Emit PAX headers only when needed.Rui Ueyama2017-01-061-23/+20
| | | | | | | | We use PAX headers to store long filenames (>= 100 bytes). It is not needed to emit PAX headers if filenames fit in the Ustar header. This patch implements that optimization. llvm-svn: 291215
* Add a class to create a tar archive file.Rui Ueyama2017-01-062-0/+170
| | | | | | | | | | | | | | In LLD, we create cpio archive files for --reproduce command. cpio was not a bad choice because it is very easy to create, but it was sometimes hard to use because people are not familiar with cpio command. I noticed that creating a tar archive isn't as hard as I thought. So I implemented it in this patch. Differential Revision: https://reviews.llvm.org/D28091 llvm-svn: 291209
* Revert "Use _Unwind_Backtrace on Apple platforms."Bob Wilson2017-01-061-1/+1
| | | | | | | | | | | This reverts commit 63165f6ae3bac1623be36d4b3ce63afa1d51a30a. After making this change, I discovered that _Unwind_Backtrace is unable to unwind past a signal handler after an assertion failure. I filed a bug report about that issue in rdar://29866587 but even if we get a fix soon, it will be awhile before it get released. llvm-svn: 291207
* TypoJoerg Sonnenberger2017-01-051-1/+1
| | | | llvm-svn: 291147
* [X86] Add Intel Kaby Lake model numbers to getHostCPUName aliased to ↵Craig Topper2017-01-051-2/+4
| | | | | | | | "skylake" since there are no feature differences. Model numbers found here http://www.sandpile.org/x86/cpuid.htm llvm-svn: 291086
* [X86] Change getHostCPUName to report Intel model 0x4e as "skylake" instead ↵Craig Topper2017-01-051-3/+11
| | | | | | | | | | | | | | | | | | | of "skylake-avx512". Add the proper 0x55 model for "skylake-avx512". Summary: Intel's i5-6300U CPU is reporting to have a model id of 78 (4e). The Host detection assumes that to be Skylake Xeon (with AVX512 support), instead of a normal Skylake machine. Patch by: Valentin Churavy Reviewers: nalimilan, craig.topper Subscribers: hfinkel, tkelman, craig.topper, nalimilan, llvm-commits Differential Revision: https://reviews.llvm.org/D28221 llvm-svn: 291084
* YAML: Remove Input::MapHNode::isValidKey(), use llvm::is_contained() ↵Peter Collingbourne2017-01-041-9/+1
| | | | | | instead. NFC. llvm-svn: 290999
* Remove dead variable Len.Eric Christopher2017-01-041-4/+1
| | | | | | Fixes PR31528 llvm-svn: 290995
* [PowerPC] Add identification for POWER8NVLNemanja Ivanovic2017-01-041-0/+1
| | | | | | | This CPU type was not previously recognized by LLVM which led to emitting poor (and sometimes incorrect) code in some JIT workloads on such a machine. llvm-svn: 290961
* Support: Add YAML I/O support for custom mappings.Peter Collingbourne2017-01-041-2/+18
| | | | | | | | This will be used to YAMLify parts of the module summary. Differential Revision: https://reviews.llvm.org/D28014 llvm-svn: 290935
* [ADT] APFloatBase: Prevent collapsing semPPCDoubleDouble and semBogusMichal Gorny2017-01-031-2/+6
| | | | | | | | | | | | | | | | | | | Provide a distinct contents for semBogus and semPPCDoubleDouble in order to prevent compilers from collapsing them to a single memory address, while we heavily rely on every semantic having distinct address. This happens if insecure optimization collapsing identical values is enabled. As a result, APFloats of semBogus are indistinguishable from semPPCDoubleDouble -- and whenever the move constructor is used, the old value beings being incorrectly recognized as a semPPCDoubleDouble. Since the values in semPPCDoubleDouble are not used anywhere, we can easily solve this issue via altering the value of one of the fields and therefore ensuring that the collapse can not occur. Differential Revision: https://reviews.llvm.org/D28112 llvm-svn: 290896
* [SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of itPhilip Reames2016-12-311-25/+0
| | | | | | | | This was originally motivated by a compile time problem I've since figured out how to solve differently, but the cleanup seemed useful. We had the same logic - which essentially implemented find - in several places. By commoning them out, I can implement find and allow erase to be inlined at the call sites if profitable. Differential Revision: https://reviews.llvm.org/D28183 llvm-svn: 290779
* [ADT] Delete RefCountedBaseVPTR.Justin Lebar2016-12-292-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is unnecessary. Its comment indicated that it was a compile error to allocate an instance of a class that inherits from RefCountedBaseVPTR on the stack. This may have been true at one point, but it's not today. Moreover you really do not want to allocate *any* refcounted object on the stack, vptrs or not, so if we did have a way to prevent these objects from being stack-allocated, we'd want to apply it to regular RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR class. It seems that the main way RefCountedBaseVPTR provides safety is by making its subclass's destructor virtual. This may have been helpful at one point, but these days clang will emit an error if you define a class with virtual functions that inherits from RefCountedBase but doesn't have a virtual destructor. Reviewers: compnerd, dblaikie Subscribers: cfe-commits, klimek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28162 llvm-svn: 290717
* Attempt to fix build bot after r290597Eugene Leviant2016-12-271-0/+3
| | | | llvm-svn: 290602
* Allow setting multiple debug typesEugene Leviant2016-12-271-2/+6
| | | | | | Differential revision: https://reviews.llvm.org/D28109 llvm-svn: 290597
* Add an assertion for cl::opt names: they can't start with '-'Mehdi Amini2016-12-231-0/+1
| | | | llvm-svn: 290467
* Add missing includes on Windows.Zachary Turner2016-12-211-0/+1
| | | | | | | Patch by Andrey Khalyavin Differential Revision: https://reviews.llvm.org/D27915 llvm-svn: 290263
* [APFloat] Remove 'else' after return. NFCTim Shen2016-12-211-13/+15
| | | | | | | | | | Reviewers: kbarton, iteratee, hfinkel, echristo Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D27934 llvm-svn: 290232
* Move GlobPattern class from LLD to llvm/Support.Rui Ueyama2016-12-202-0/+168
| | | | | | | | | | GlobPattern is a class to handle glob pattern matching. Currently only LLD is using that, but technically that feature is not specific to linkers, so in this patch I move that file to LLVM. Differential Revision: https://reviews.llvm.org/D27969 llvm-svn: 290212
* Add support for formatv to llvm::Twine.Zachary Turner2016-12-171-0/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D27835 llvm-svn: 290020
* Include <cstdarg> in PrettyStackTrace.cpp, fixing the bots.Sean Callanan2016-12-141-0/+1
| | | | llvm-svn: 289691
* Prepare PrettyStackTrace for LLDB adoptionSean Callanan2016-12-141-5/+21
| | | | | | | | | | | | This patch fixes the linkage for __crashtracer_info__, making it have the proper mangling (extern "C") and linkage (private extern). It also adds a new PrettyStackTrace type, allowing LLDB to adopt this instead of Host::SetCrashDescriptionWithFormat(). Without this patch, CrashTracer on macOS won't pick up pretty stack traces from any LLVM client. An LLDB commit adopting this API will follow shortly. Differential Revision: https://reviews.llvm.org/D27683 llvm-svn: 289689
OpenPOWER on IntegriCloud