summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [Support] Move DJB hash to support. NFCJonas Devlieghere2018-01-282-0/+21
| | | | | | | | | | | This patch moves the DJB hash to support. This is consistent with other hashing algorithms living there. The hash is used by the DWARF accelerator tables. We're doing this now because the hashing function is needed by dsymutil and we don't want to link against libBinaryFormat. Differential revision: https://reviews.llvm.org/D42594 llvm-svn: 323616
* [Support] Move PrintEscapedString into the library its declaration is inBenjamin Kramer2018-01-261-0/+10
| | | | llvm-svn: 323558
* [WebAssembly] Switch to *-wasm as the default target triple.Dan Gohman2018-01-231-2/+4
| | | | | | | | This makes wasm32-unknown-unknown-wasm the default, which supports the .o file writer and the new linking ABI. To enable s2wasm-compatible output, use the wasm32-unknown-unknown-elf triple. llvm-svn: 323220
* Revert r322595: Specify inline for isWhitespace in CommandLine.cppRui Ueyama2018-01-221-1/+1
| | | | | | | | | The original change was made based on a misunderstanding that -DCMAKE_BUILD_TYPE=RelWithDebugInfo would produce the same executable as -DCMAKE_BUILD_TYPE=Release modulo debug info. Turned out that's not true -- it at least disables some optimizations such as function inlining. llvm-svn: 323161
* Fallback option for colorized output when terminfo isn't availablePetr Hosek2018-01-191-0/+15
| | | | | | | | | | | Try to detect the terminal color support by checking the value of the TERM environment variable. This is not great, but it's better than nothing when terminfo library isn't available, which may still be the case on some Linux distributions. Differential Revision: https://reviews.llvm.org/D42055 llvm-svn: 322962
* [X86] Add intrinsic support for the RDPID instructionCraig Topper2018-01-181-1/+3
| | | | | | | | This adds a new instrinsic to support the rdpid instruction. The implementation is a bit weird because the intrinsic is defined as always returning 32-bits, but the assembler support thinks the instruction produces a 64-bit register in 64-bit mode. But really it zeros the upper 32 bits. So I had to add separate patterns where 64-bit mode uses an extract_subreg. Differential Revision: https://reviews.llvm.org/D42205 llvm-svn: 322910
* Typo fix SIBABRT -> SIGABRT.Eric Christopher2018-01-181-1/+1
| | | | | | Based on a patch by Henry Wong! llvm-svn: 322902
* Support: Add missing #include.Peter Collingbourne2018-01-181-0/+2
| | | | | | | This #include is necessary to provide the definitions of _fpclass and _FPCLASS_NZ when building with libc++. llvm-svn: 322885
* [Support] Return an enum instead of an unsigned; NFC.George Burgess IV2018-01-171-2/+2
| | | | | | | | | | | | | | We seem to be (logically) returning ArchExtKinds here in all cases, so the return type should reflect that. The static_cast is necessary because `A.ID` is actually an `unsigned`, presumably since we use `decltype(A)` to represent extended attributes for both ARM and AArch64, which use distinct `ArchExtKinds`. We can't trivially make the same change for ARM, because one of the values it returns is the bitwise-or of two `ARM::ArchExtKind`s. llvm-svn: 322613
* Specify inline for isWhitespace in CommandLine.cppRui Ueyama2018-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Takuto Ikuta. In chromium's component build, there are many directive sections and commandline parsing takes much time. This patch is for speed up of lld in RelWithDebInfo build by forcing inline heavily called isWhitespace function. 10 times link perf stats of blink_core.dll changed like below. master: TotalSeconds: 9.8764878 TotalSeconds: 10.1455242 TotalSeconds: 10.075279 TotalSeconds: 10.3397347 TotalSeconds: 9.8361665 TotalSeconds: 9.9544441 TotalSeconds: 9.8960686 TotalSeconds: 9.8877865 TotalSeconds: 10.0551879 TotalSeconds: 10.0492254 Avg: 10.01159047 with this patch: TotalSeconds: 8.8696762 TotalSeconds: 9.1021585 TotalSeconds: 9.0233893 TotalSeconds: 9.1886175 TotalSeconds: 9.156954 TotalSeconds: 9.0978564 TotalSeconds: 9.1316824 TotalSeconds: 8.8354606 TotalSeconds: 9.2549431 TotalSeconds: 9.4473085 Avg: 9.11080465 llvm-svn: 322595
* [Support] Remove MemoryBuffer::getNewMemBufferPavel Labath2018-01-151-5/+0
| | | | | | | all callers have been switched the the Writable version (which does not require const_casting to be useful). llvm-svn: 322475
* [TargetParser] Add missing armv8l ARMv8 variant.Florian Hahn2018-01-091-1/+1
| | | | | | | | | | | | | | | | | | This change adds the missing armv8l variant as an alias of armv8 architecture. The issue was observed with several regressions in validation on armv8l hardware (for instance ExecutionEngine/frem.ll failed due to lack of neon fpu). Tested with regression testsuite passed without regression on ARM and x86_64. Patch by Yvan Roux. Reviewers: rengolin, rogfer01, olista01, fhahn Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D41859 llvm-svn: 322098
* [Support] Use realpath(3) instead of trying to open a file.Davide Italiano2018-01-091-6/+6
| | | | | | | | | If we don't have read permissions on the directory the call would fail. <rdar://problem/35871293> llvm-svn: 322095
* [Support] Add WritableMemoryBuffer::getNewMemBufferPavel Labath2018-01-091-5/+10
| | | | | | | | | | | | | | | | | | Summary: The idea is that it would replace (non-Writable)MemoryBuffer::getNewMemBuffer, which is quite useless unless you const_cast its contents to write to it (which all (both) callers of this function were doing). This patch also fixes one of the usages in COFFWriter. After fixing the other usage in clang, I plan to delete the old function. Reviewers: dblaikie, Bigcheese Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41540 llvm-svn: 322094
* Added support for reading configuration filesSerge Pavlov2017-12-301-0/+48
| | | | | | | | | | | | | Configuration file is read as a response file in which file names in the nested constructs `@file` are resolved relative to the directory where the including file resides. Lines in which the first non-whitespace character is '#' are considered as comments and are skipped. Trailing backslashes are used to concatenate lines in the same way as they are used in shell scripts. Differential Revision: https://reviews.llvm.org/D24926 llvm-svn: 321586
* Reverted 321580: Added support for reading configuration filesSerge Pavlov2017-12-301-47/+0
| | | | | | It caused buildbot fails. llvm-svn: 321582
* Added support for reading configuration filesSerge Pavlov2017-12-301-0/+47
| | | | | | | | | | | | | Configuration file is read as a response file in which file names in the nested constructs `@file` are resolved relative to the directory where the including file resides. Lines in which the first non-whitespace character is '#' are considered as comments and are skipped. Trailing backslashes are used to concatenate lines in the same way as they are used in shell scripts. Differential Revision: https://reviews.llvm.org/D24926 llvm-svn: 321580
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-1/+1
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* Improve performance TokenizeWindowsCommandLineRui Ueyama2017-12-271-20/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patcy by Takuto Ikuta. This patch reduces lld link time of chromium's blink_core.dll in component build. Total size of input argument in .directives become nearly 300MB in the build and calling many strchr and assert becomes bottleneck. On my desktop machine, 4 times stats of the link time are like below. Improved around 10%. This patch TotalSeconds : 13.4918885 TotalSeconds : 13.9474257 TotalSeconds : 13.4941082 TotalSeconds : 13.6077962 Avg : 13.63530465 master TotalSeconds : 15.6938531 TotalSeconds : 15.7022508 TotalSeconds : 15.9567202 TotalSeconds : 14.5851505 Avg : 15.48449365 Differential Revision: https://reviews.llvm.org/D41590 llvm-svn: 321479
* [ThinLTO][CachePruning] explicitly disable pruningBen Dunbobbin2017-12-221-5/+5
| | | | | | | | | | | In https://reviews.llvm.org/rL321077 and https://reviews.llvm.org/D41231 I fixed a regression in the c-api which prevented the pruning from being *effectively* disabled. However this approach, helpfully recommended by @labath, is cleaner. It is also nice to remove the weasel words about effectively disabling from the api comments. Differential Revision: https://reviews.llvm.org/D41497 llvm-svn: 321376
* [YAML] Fix UTF-8 handlingFrancis Visoiu Mistrih2017-12-211-1/+6
| | | | | | | | Previous YAML quoting patches broke UTF-8 printing in YAML: see https://reviews.llvm.org/D41290#961801. Differential Revision: https://reviews.llvm.org/D41490 llvm-svn: 321283
* [Support] Remove MemoryBuffer::getNewUninitMemBufferPavel Labath2017-12-211-8/+3
| | | | | | | | | | | There is nothing useful that can be done with a read-only uninitialized buffer without const_casting its contents to initialize it. A better solution is to obtain a writable buffer (WritableMemoryBuffer::getNewUninitMemBuffer), and then convert it to a read-only buffer after initialization. All callers of this function have already been updated to do this, so this function is now unused. llvm-svn: 321257
* [TargetParser] Check size before accessing architecture version.Florian Hahn2017-12-201-2/+2
| | | | | | | | | | | | | | | | | | Summary: This fixes a crash when invalid -march options like `armv` are provided. Based on a patch by Will Lovett. Reviewers: rengolin, samparker, mcrosier Reviewed By: samparker Subscribers: aemerson, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D41429 llvm-svn: 321166
* Silence a bunch of implicit fallthrough warningsAdrian Prantl2017-12-191-1/+0
| | | | llvm-svn: 321114
* [Support][CachePruning] Disable cache pruning regression fixBen Dunbobbin2017-12-191-2/+4
| | | | | | | | | | borked by: rL284966 (see: https://reviews.llvm.org/D25730). Previously, Interval was unsigned (see: CachePruning.h), replacing the type with std::chrono::seconds (which is signed) causes a regression in behaviour because the c-api intends negative values to translate to large positive intervals to *effectively* disable the pruning (see comments on: setCachePruningInterval()). Differential Revision: https://reviews.llvm.org/D41231 llvm-svn: 321077
* [Support] Add WritableMemoryBuffer classPavel Labath2017-12-191-61/+96
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The motivation here is LLDB, where we need to fixup relocations in mmapped files before their contents can be read correctly. The MemoryBuffer class does exactly what we need, *except* that it maps the file in read-only mode. WritableMemoryBuffer reuses the existing machinery for opening and mmapping a file. The only difference is in the argument to the mapped_file_region constructor -- we create a private copy-on-write mapping, so that we can make changes to the mapped data, but the changes aren't carried over to the underlying file. This patch is based on an initial version by Zachary Turner. Reviewers: mehdi_amini, rnk, rafael, dblaikie, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40291 llvm-svn: 321071
* Fix APFloat from string conversion for InfSerguei Katkov2017-12-192-3/+3
| | | | | | | | | | | | | | | | | | The method IEEEFloat::convertFromStringSpecials() does not recognize the "+Inf" and "-Inf" strings but these strings are printed for the double Infinities by the IEEEFloat::toString(). This patch adds the "+Inf" and "-Inf" strings to the list of recognized patterns in IEEEFloat::convertFromStringSpecials(). Re-landing after fix. Reviewers: sberg, bogner, majnemer, timshen, rnk, skatkov, gottesmm, bkramer, scanon, anna Reviewed By: anna Subscribers: mkazantsev, FlameTop, llvm-commits, reames, apilipenko Differential Revision: https://reviews.llvm.org/D38030 llvm-svn: 321054
* [X86] Minor formatting fix to getHostCPUFeatures. NFCCraig Topper2017-12-181-2/+1
| | | | llvm-svn: 321015
* [YAML] Add support for non-printable charactersFrancis Visoiu Mistrih2017-12-183-14/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | LLVM IR function names which disable mangling start with '\01' (https://www.llvm.org/docs/LangRef.html#identifiers). When an identifier like "\01@abc@" gets dumped to MIR, it is quoted, but only with single quotes. http://www.yaml.org/spec/1.2/spec.html#id2770814: "The allowed character range explicitly excludes the C0 control block allowed), the surrogate block #xD800-#xDFFF, #xFFFE, and #xFFFF." http://www.yaml.org/spec/1.2/spec.html#id2776092: "All non-printable characters must be escaped. [...] Note that escape sequences are only interpreted in double-quoted scalars." This patch adds support for printing escaped non-printable characters between double quotes if needed. Should also fix PR31743. Differential Revision: https://reviews.llvm.org/D41290 llvm-svn: 320996
* Fix many -Wsign-compare and -Wtautological-constant-compare warnings.Zachary Turner2017-12-141-1/+1
| | | | | | | | | | | | Most of the -Wsign-compare warnings are due to the fact that enums are signed by default in the MS ABI, while the tautological comparison warnings trigger on x86 builds where sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max() is always false. Differential Revision: https://reviews.llvm.org/D41256 llvm-svn: 320750
* Recover some overzealously removed includes.Michael Zolotukhin2017-12-131-0/+1
| | | | llvm-svn: 320648
* Speculative build fix for lld on Linux after Michael's #include removalsHans Wennborg2017-12-131-0/+1
| | | | llvm-svn: 320645
* Remove redundant includes from lib/Support.Michael Zolotukhin2017-12-136-6/+0
| | | | llvm-svn: 320627
* [AArch64] Add Exynos to host detectionEvandro Menezes2017-12-081-0/+31
| | | | | | Differential revision: https://reviews.llvm.org/D40985 llvm-svn: 320195
* Delete temp file if rename fails.Rafael Espindola2017-12-052-5/+23
| | | | | | | | | | | | | | | | | | | Without this when lld failed to replace the output file it would leave the temporary behind. The problem is that the existing logic is - cancel the delete flag - rename We have to cancel first to avoid renaming and then crashing and deleting the old version. What is missing then is deleting the temporary file if the rename fails. This can be an issue on both unix and windows, but I am not sure how to cause the rename to fail reliably on unix. I think it can be done on ZFS since it has an ACL system similar to what windows uses, but adding support for checking that in llvm-lit is probably not worth it. llvm-svn: 319786
* Re-commit "[cmake] Enable zlib support on windows"Pavel Labath2017-12-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This recommits r319533 which was broken llvm-config --system-libs output. The reason was that I used find_libraries for searching for the z library. This returns absolute paths, and when these paths made it into llvm-config, it made it produce nonsensical flags. To fix this, I hand-roll a search for the library in the same way that we search for the terminfo library a couple of lines below. This is a bit less flexible than the find_library option, as it does not allow the user to specify the path to the library at configure time (which is important on windows, as zlib is unlikely to be found in any of the standard places cmake searches), but I was able to guide the build to find it with appropriate values of LIB and INCLUDE environment variables. Reviewers: compnerd, rnk, beanz, rafael Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40779 llvm-svn: 319751
* [Support/TarWriter] - Don't allow TarWriter to add the same file more than once.George Rimar2017-12-051-0/+4
| | | | | | | | | | | | | | This is for PR35460. Currently when LLD adds files to TarWriter it may pass the same file multiple times. For example it happens for clang reproduce file which specifies archive (.a) files more than once in command line. Patch makes TarWriter to ignore files with the same path, so it will add only the first one to archive. Differential revision: https://reviews.llvm.org/D40606 llvm-svn: 319750
* Revert "[cmake] Enable zlib support on windows"Pavel Labath2017-12-041-3/+3
| | | | | | | | | | | | This reverts commit r319533 as it broke llvm-config --system-libs output and everything that depends on it (which is mostly out of tree or downstream folks, but includes a couple of llvm buildbots as well). I think I have a fix for this in D40779, but I want someone to look review it first. In the mean time, I am reverting this change, as it seems to break a lot of people. llvm-svn: 319663
* [cmake] Enable zlib support on windowsPavel Labath2017-12-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: zlib support was hard-wired to off for (non-cygwin) windows targets. This disables some features, such as reading debug info from compressed dwarf sections. This has been this way since zlib support was added in 2013 (r180083), but there is no obvious reason for that. Zlib is perfectly capable of being compiled for windows (it even has a cmake file that works out of the box). This enables one to turn on zlib support on windows, if one has zlib avaliable. Reviewers: rnk, beanz Subscribers: mgorny, aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D40655 llvm-svn: 319533
* Mark all library options as hidden.Zachary Turner2017-12-012-6/+8
| | | | | | | | | | | | | | | | | These command line options are not intended for public use, and often don't even make sense in the context of a particular tool anyway. About 90% of them are already hidden, but when people add new options they forget to hide them, so if you were to make a brand new tool today, link against one of LLVM's libraries, and run tool -help you would get a bunch of junk that doesn't make sense for the tool you're writing. This patch hides these options. The real solution is to not have libraries defining command line options, but that's a much larger effort and not something I'm prepared to take on. Differential Revision: https://reviews.llvm.org/D40674 llvm-svn: 319505
* AMDGPU: Add num spilled s/vgprs to metadataKonstantin Zhuravlyov2017-11-281-0/+4
| | | | | | | | This was requested by tools. Differential Revision: https://reviews.llvm.org/D40321 llvm-svn: 319192
* [Support] Merge toLower / toUpper implementationsFrancis Visoiu Mistrih2017-11-282-27/+18
| | | | | | Merge the ones from StringRef and StringExtras. llvm-svn: 319171
* [ARM][AArch64] Workaround ARM/AArch64 peculiarity in clearing icache.Peter Smith2017-11-281-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | Certain ARM implementations treat icache clear instruction as a memory read, and CPU segfaults on trying to clear cache on !PROT_READ page. We workaround this in Memory::protectMappedMemory by adding PROT_READ to affected pages, clearing the cache, and then setting desired protection. This fixes "AllocationTests/MappedMemoryTest.***/3" unit-tests on affected hardware. Reviewers: psmith, zatrazz, kristof.beyls, lhames Reviewed By: lhames Subscribers: llvm-commits, krytarowski, peter.smith, jgreenhalgh, aemerson, rengolin Patch by maxim-kuvrykov! Differential Revision: https://reviews.llvm.org/D40423 llvm-svn: 319166
* Use FILE_FLAG_DELETE_ON_CLOSE for TempFile on windows.Rafael Espindola2017-11-282-6/+80
| | | | | | We won't see the temp file no more. llvm-svn: 319137
* Move code. NFC.Rafael Espindola2017-11-281-83/+85
| | | | | | | This moves the TempFile implementation so that it can use system specific code. llvm-svn: 319134
* Add an F_Delete flag.Rafael Espindola2017-11-281-0/+2
| | | | | | For now this only changes the handle Access. llvm-svn: 319121
* Add OpenFlags to the create(Unique|Temporary)File interfaces.Rafael Espindola2017-11-271-14/+20
| | | | | | | This will allow a future F_Delete flag to be specified when we want the file to be automatically deleted on close. llvm-svn: 319117
* [BinaryStream] Support growable streams.Zachary Turner2017-11-272-9/+10
| | | | | | | | | The existing library assumed that a stream's length would never change. This makes some things simpler, but it's not flexible enough for what we need, especially for writable streams where what you really want is for each call to write to actually append. llvm-svn: 319070
* [Support] Fix locking of shared variable in threadpoolJan Korous2017-11-271-1/+1
| | | | llvm-svn: 319027
* Control-Flow Enforcement Technology - Shadow Stack support (LLVM side)Oren Ben Simhon2017-11-261-0/+3
| | | | | | | | | | | | | | | | | | Shadow stack solution introduces a new stack for return addresses only. The HW has a Shadow Stack Pointer (SSP) that points to the next return address. If we return to a different address, an exception is triggered. The shadow stack is managed using a series of intrinsics that are introduced in this patch as well as the new register (SSP). The intrinsics are mapped to new instruction set that implements CET mechanism. The patch also includes initial infrastructure support for IBT. For more information, please see the following: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf Differential Revision: https://reviews.llvm.org/D40223 Change-Id: I4daa1f27e88176be79a4ac3b4cd26a459e88fed4 llvm-svn: 318996
OpenPOWER on IntegriCloud