summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert D38481 due to missing cmake check for CPU_COUNTDaniel Neilson2017-10-043-19/+4
| | | | | | | | | | | | | Summary: This reverts D38481. The change breaks systems with older versions of glibc. It injects a use of CPU_COUNT() from sched.h without checking to ensure that the function exists first. Reviewers: Subscribers: llvm-svn: 314922
* Use sched_getaffinity instead of std::thread::hardware_concurrency.Rafael Espindola2017-10-033-4/+19
| | | | | | | | | | | | | | The issue with std::thread::hardware_concurrency is that it forwards to libc and some implementations (like glibc) don't take thread affinity into consideration. With this change a llvm program that can execute in only 2 cores will use 2 threads, even if the machine has 32 cores. This makes benchmarking a lot easier, but should also help if someone doesn't want to use all cores for compilation for example. llvm-svn: 314809
* [Triple] Add AMDPAL operating system typeTim Renouf2017-09-291-0/+2
| | | | | | | | | | | | | | | | | | Summary: This operating system type represents the AMDGPU PAL runtime, and will be required by the AMDGPU backend in order to generate correct code for this runtime. Currently it generates the same code as not specifying an OS at all. That will change in future commits. Patch from Tim Corringham. Subscribers: arsenm, nhaehnle Differential Revision: https://reviews.llvm.org/D37380 llvm-svn: 314500
* Fix a UBsan bot.Rui Ueyama2017-09-281-0/+1
| | | | | | | | | If we do not initialize Prefix here, Prefix.data() returns a nullptr. Later, it is passed to memcpy. memcpy's behavior is undefined if src (or dst) is a nullptr even if a given size is 0. That's why this code triggered UBsan. llvm-svn: 314368
* Fix off-by-one error in TarWriter.Rui Ueyama2017-09-271-26/+31
| | | | | | | | | | | | | | | | | | | | | | | | The tar format originally supported up to 99 byte filename. The two extensions are proposed later: Ustar or PAX. In the UStar extension, a pathanme is split at a '/' and its "prefix" and "suffix" are stored in different locations in the tar header. Since "prefix" can be up to 155 byte, it can represent up to 254 byte filename (but exact limit depends on the location of '/' character in a pathname.) Our TarWriter first attempt to use UStar extension and then fallback to PAX extension. But there's a bug in UStar header creation. "Suffix" part must be a NUL- terminated string, but we didn't handle it correctly. As a result, if your filename just 100 characters long, the last character was droppped. This patch fixes the issue. Differential Revision: https://reviews.llvm.org/D38149 llvm-svn: 314349
* Do not remove a target file in FileOutputBuffer::create().Rui Ueyama2017-09-271-8/+1
| | | | | | | | | | | | | | | | | | FileOutputBuffer::create() attempts to remove a target file if the file is a regular one, which results in an unexpected result in a failure scenario. If something goes wrong and the user of FileOutputBuffer decides to not call commit(), it leaves nothing. An existing file is removed, and no new file is created. What we should do is to atomically replace an existing file with a new file using rename(), so that it wouldn't remove an existing file without creating a new one. Differential Revision: https://reviews.llvm.org/D38283 llvm-svn: 314345
* [support] mapped_file_region: and fix the windows code tooRoman Lebedev2017-09-271-2/+2
| | | | | | | Followup for r314312 / r314313 Sorry, i really failed to fully grep all the codebase :/ llvm-svn: 314321
* [Support] mapped_file_region::size() returns size_tRoman Lebedev2017-09-271-1/+1
| | | | | | Fixup last commit, found by clang-stage1-cmake-RA-incremental bot. llvm-svn: 314313
* [Support] mapped_file_region: store size as size_tRoman Lebedev2017-09-271-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Found when testing stage-2 build with D38101. ``` In file included from /build/llvm/lib/Support/Path.cpp:1045: /build/llvm/lib/Support/Unix/Path.inc:648:14: error: comparison 'uint64_t' (aka 'unsigned long') > 18446744073709551615 is always false [-Werror,-Wtautological-constant-compare] if (length > std::numeric_limits<size_t>::max()) { ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` `size_t` is `uint64_t` here, apparently, thus any `uint64_t` value always fits into `size_t`. Initial patch was to use some preprocessor logic to not check if the size is known to fit at compile time. But Zachary Turner suggested using this approach. Reviewers: Bigcheese, rafael, zturner, mehdi_amini Reviewed by (via email): zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38132 llvm-svn: 314312
* Add section headers to SpecialCaseListsVlad Tsyrklevich2017-09-251-75/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Sanitizer blacklist entries currently apply to all sanitizers--there is no way to specify that an entry should only apply to a specific sanitizer. This is important for Control Flow Integrity since there are several different CFI modes that can be enabled at once. For maximum security, CFI blacklist entries should be scoped to only the specific CFI mode(s) that entry applies to. Adding section headers to SpecialCaseLists allows users to specify more information about list entries, like sanitizer names or other metadata, like so: [section1] fun:*fun1* [section2|section3] fun:*fun23* The section headers are regular expressions. For backwards compatbility, blacklist entries entered before a section header are put into the '[*]' section so that blacklists without sections retain the same behavior. SpecialCaseList has been modified to also accept a section name when matching against the blacklist. It has also been modified so the follow-up change to clang can define a derived class that allows matching sections by SectionMask instead of by string. Reviewers: pcc, kcc, eugenis, vsk Reviewed By: eugenis, vsk Subscribers: vitalybuka, llvm-commits Differential Revision: https://reviews.llvm.org/D37924 llvm-svn: 314170
* [AArch64] Add basic support for Qualcomm's Saphira CPU.Chad Rosier2017-09-251-0/+1
| | | | llvm-svn: 314105
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-7/+7
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* [Falkor] Add falkor CPU to host detectionBalaram Makam2017-09-221-0/+1
| | | | | | This returns "falkor" for Falkor CPU. llvm-svn: 313998
* [yaml2obj] - Don't crash on one more invalid document.George Rimar2017-09-211-5/+9
| | | | | | | | | This fixes one more crash I faced. Testcase contains minimal reduced case. Differential revision: https://reviews.llvm.org/D38082 llvm-svn: 313868
* [mips] Recognise the triple used by Debian for MIPS n32 ABISimon Atanasyan2017-09-141-0/+2
| | | | | | | Triples like mips64-linux-gnuabin32 are documented in this article: https://wiki.debian.org/Multiarch/Tuples llvm-svn: 313231
* [ARM] Add more CPUs to host detectionEli Friedman2017-09-131-0/+3
| | | | | | | | | This returns "cortex-a73" for second-generation Kryo; not precisely correct, but close enough. Differential Revision: https://reviews.llvm.org/D37724 llvm-svn: 313200
* llvm-dwarfdump: support dumping UUIDs of Mach-O binaries.Adrian Prantl2017-09-131-0/+10
| | | | | | | This is a feature supported by Darwin dwarfdump. UUIDs are used to associate executables with their .dSYM bundles. llvm-svn: 313165
* Convenience/safety fix for llvm::sys::Execute(And|No)WaitAlexander Kornienko2017-09-135-22/+22
| | | | | | | | | | | | | | | | | | | | Summary: Change the type of the Redirects parameter of llvm::sys::ExecuteAndWait, ExecuteNoWait and other APIs that wrap them from `const StringRef **` to `ArrayRef<Optional<StringRef>>`, which is safer and simplifies the use of these APIs (no more local StringRef variables just to get a pointer to). Corresponding clang changes will be posted as a separate patch. Reviewers: bkramer Reviewed By: bkramer Subscribers: vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D37563 llvm-svn: 313155
* Don't call exit from cl::PrintHelpMessage.Rafael Espindola2017-09-071-14/+10
| | | | | | | | | Most callers were not expecting the exit(0) and trying to exit with a different value. This also adds back the call to cl::PrintHelpMessage in llvm-ar. llvm-svn: 312761
* Minor style fixes in lib/Support/**/Program.(inc|cpp).Alexander Kornienko2017-09-063-72/+70
| | | | | | No functional changes intended. llvm-svn: 312646
* Untabify.NAKAMURA Takumi2017-08-282-5/+5
| | | | llvm-svn: 311875
* [ADT] Enable reverse iteration for DenseMapMandeep Singh Grang2017-08-241-11/+0
| | | | | | | | | | | | Reviewers: mehdi_amini, dexonsmith, dblaikie, davide, chandlerc, davidxl, echristo, efriedma Reviewed By: dblaikie Subscribers: rsmith, mgorny, emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D35043 llvm-svn: 311730
* [ARC] Add ARC backend.Pete Couperus2017-08-241-0/+9
| | | | | | | Add the ARC backend as an experimental target to lib/Target. Reviewed at: https://reviews.llvm.org/D36331 llvm-svn: 311667
* [TargetParser][AArch64] Add support for RDM feature in the target parser.Chad Rosier2017-08-241-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D37081 llvm-svn: 311659
* bpf: close the file descriptor after probe inside getHostCPUNameForBPFYonghong Song2017-08-231-1/+5
| | | | | Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 311567
* bpf: add variants of -mcpu=# and support for additional jmp insnsYonghong Song2017-08-231-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -mcpu=# will support: . generic: the default insn set . v1: insn set version 1, the same as generic . v2: insn set version 2, version 1 + additional jmp insns . probe: the compiler will probe the underlying kernel to decide proper version of insn set. We did not not use -mcpu=native since llc/llvm will interpret -mcpu=native as the underlying hardware architecture regardless of -march value. Currently, only x86_64 supports -mcpu=probe. Other architecture will silently revert to "generic". Also added -mcpu=help to print available cpu parameters. llvm will print out the information only if there are at least one cpu and at least one feature. Add an unused dummy feature to enable the printout. Examples for usage: $ llc -march=bpf -mcpu=v1 -filetype=asm t.ll $ llc -march=bpf -mcpu=v2 -filetype=asm t.ll $ llc -march=bpf -mcpu=generic -filetype=asm t.ll $ llc -march=bpf -mcpu=probe -filetype=asm t.ll $ llc -march=bpf -mcpu=v3 -filetype=asm t.ll 'v3' is not a recognized processor for this target (ignoring processor) ... $ llc -march=bpf -mcpu=help -filetype=asm t.ll Available CPUs for this target: generic - Select the generic processor. probe - Select the probe processor. v1 - Select the v1 processor. v2 - Select the v2 processor. Available features for this target: dummy - unused feature. Use +feature to enable a feature, or -feature to disable it. For example, llc -mcpu=mycpu -mattr=+feature1,-feature2 ... Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Yonghong Song <yhs@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 311522
* [Support, Windows] Handle long paths with unix separatorsPirama Arumuga Nainar2017-08-211-4/+7
| | | | | | | | | | | | | | | | | | Summary: The function widenPath() for Windows also normalizes long path names by iterating over the path's components and calling append(). The assumption during the iteration that separators are not returned by the iterator doesn't hold because the iterators do return a separator when the path has a drive name. Handle this case by ignoring separators during iteration. Reviewers: rnk Subscribers: danalbert, srhines Differential Revision: https://reviews.llvm.org/D36752 llvm-svn: 311382
* [BinaryStream] Defaultify copy and move constructors.Zachary Turner2017-08-211-6/+0
| | | | | | | | | | | | | The various BinaryStream classes had explicit copy constructors which resulted in deleted move constructors. This was causing the internal std::shared_ptr to get copied rather than moved very frequently, since these classes are often used as return values. Patch by Alex Telishev Differential Revision: https://reviews.llvm.org/D36942 llvm-svn: 311368
* [APFloat] Fix IsInteger() for DoubleAPFloat.Davide Italiano2017-08-211-4/+1
| | | | | | | | Previously, we would just assert instead. Differential Revision: https://reviews.llvm.org/D36961 llvm-svn: 311351
* [ARM][AArch64] Cortex-A75 and Cortex-A55 supportSam Parker2017-08-211-0/+14
| | | | | | | | | | | | | | | | | | This patch introduces support for Cortex-A75 and Cortex-A55, Arm's latest big.LITTLE A-class cores. They implement the ARMv8.2-A architecture, including the cryptography and RAS extensions, plus the optional dot product extension. They also implement the RCpc AArch64 extension from ARMv8.3-A. Cortex-A75: https://developer.arm.com/products/processors/cortex-a/cortex-a75 Cortex-A55: https://developer.arm.com/products/processors/cortex-a/cortex-a55 Differential Revision: https://reviews.llvm.org/D36667 llvm-svn: 311316
* [Support] env vars with empty values on windowsBen Dunbobbin2017-08-181-2/+3
| | | | | | | | | | | | | | | | An environment variable can be in one of three states: 1. undefined. 2. defined with a non-empty value. 3. defined but with an empty value. The windows implementation did not support case 3 (it was not handling errors). The Linux implementation is already correct. Differential Revision: https://reviews.llvm.org/D36394 llvm-svn: 311174
* [ARM][AArch64] ARMv8.3-A enablementSam Parker2017-08-102-0/+7
| | | | | | | | | | | | | | | | | The beta ARMv8.3 ISA specifications have been released for AArch64 and AArch32, these can be found at: https://developer.arm.com/products/architecture/a-profile/exploration-tools An introduction to this architecture update can be found at: https://community.arm.com/processors/b/blog/posts/armv8-a-architecture-2016-additions This patch is the first in a series which will add ARM v8.3-A support in LLVM and Clang. It adds the necessary changes that create targets for both the ARM and AArch64 backends. Differential Revision: https://reviews.llvm.org/D36514 llvm-svn: 310561
* [Path] Sink predicate computations to their uses. NFCI.Benjamin Kramer2017-08-091-5/+4
| | | | llvm-svn: 310531
* [KnownBits][ValueTracking] Move the math for calculating known bits for ↵Craig Topper2017-08-082-0/+66
| | | | | | | | | | | | add/sub into a static method in KnownBits object I want to reuse this code in SimplifyDemandedBits handling of Add/Sub. This will make that easier. Wonder if we should use it in SelectionDAG's computeKnownBits too. Differential Revision: https://reviews.llvm.org/D36433 llvm-svn: 310378
* [Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on WindowsReid Kleckner2017-08-041-3/+4
| | | | | | | | | | | | | | | | | Summary: Tools like clang that use RemoveFileOnSignal on their output files weren't actually able to clean up their outputs before this change. Now the call to llvm::sys::fs::remove succeeds and the temporary file is deleted. This is a stop-gap to fix clang before implementing the solution outlined in PR34070. Reviewers: davide Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D36337 llvm-svn: 310137
* [Support] Remove getPathFromOpenFD, it was unusedReid Kleckner2017-08-042-83/+0
| | | | | | | | | | | | | | Summary: It was added to support clang warnings about includes with case mismatches, but it ended up not being necessary. Reviewers: twoh, rafael Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D36328 llvm-svn: 310078
* [Support] Update comments about stdout, raw_fd_ostream, and outs()Reid Kleckner2017-08-041-9/+8
| | | | | | | | | | | | | | | The full story is in the comments: // Do not attempt to close stdout or stderr. We used to try to maintain the // property that tools that support writing file to stdout should not also // write informational output to stdout, but in practice we were never able to // maintain this invariant. Many features have been added to LLVM and clang // (-fdump-record-layouts, optimization remarks, etc) that print to stdout, so // users must simply be aware that mixed output and remarks is a possibility. NFC, I am just updating comments to reflect reality. llvm-svn: 310016
* Support: WOA64 and WOA SignalsMartell Malone2017-08-031-6/+23
| | | | | | | | Reviewers: rnk Differential Revision: https://reviews.llvm.org/D21813 llvm-svn: 310001
* Fix llvm-for-windows-on-linux build after LLVM r272701.Nico Weber2017-08-031-2/+2
| | | | | | | | | | | | The file is called "intrin.h". When building targeting Windows on a Linux system, with the SDK mounted in a case-insensitive file system, "Intrin.h" will miss clang's intrin.h header (because that's not in a case-insensitive file system) but then find intrin.h in the Microsoft SDK. clang can't handle the SDK's intrin.h. https://reviews.llvm.org/D36281 llvm-svn: 309980
* [Support/GlobPattern] - Do not crash when pattern has characters with int ↵George Rimar2017-07-311-7/+10
| | | | | | | | | | | | | | | value < 0. Found it during work on LLD, it would crash on following linker script: SECTIONS { .foo : { *("*®") } } That happens because ® has int value -82. And chars are used as array index in code, and are signed by default. Differential revision: https://reviews.llvm.org/D35891 llvm-svn: 309549
* [TargetParser] Use enum classes for various ARM kind enums.Florian Hahn2017-07-272-197/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Using c++11 enum classes ensures that only valid enum values are used for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the need for checks that the provided values map to a proper enum value, allows us to get rid of AK_LAST and prevents comparing values from different enums. It also removes a bunch of static_cast from unsigned to enum values and vice versa, at the cost of introducing static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind. FPUKind and ArchExtKind are the only remaining old-style enum in TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style enum, but FPUKind can be converted too, but this patch is quite big, so could do this in a follow-up patch. I could also split this patch up a bit, if people would prefer that. Reviewers: rengolin, javed.absar, chandlerc, rovka Reviewed By: rovka Subscribers: aemerson, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D35882 llvm-svn: 309287
* [X86] Improve the unknown stepping support for Intel CPUs in getHostCPUNameCraig Topper2017-07-271-2/+22
| | | | | | | | This patch improves our guessing of unknown Intel CPUs to support Goldmont and skylake-avx512. Differential Revision: https://reviews.llvm.org/D35161 llvm-svn: 309246
* Move manifest utils into separate lib, to reduce libxml2 deps.Eric Beckmann2017-07-262-216/+0
| | | | | | | | | | | | | | | | Summary: Previously were in support. Since many many things depend on support, were all forced to also depend on libxml2, which we only want in a few cases. This puts all the libxml2 deps in a separate lib to be used only in a few places. Reviewers: ruiu, thakis, rnk Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D35819 llvm-svn: 309070
* Reapply "llvm-mt: implement simple merging of manifests, not factoring ↵Eric Beckmann2017-07-261-6/+148
| | | | | | | | | | namespaces. This time with correct #if. This reverts commit 9cf4eca0e0383040c1ff1416815c7f649650c2a0. llvm-svn: 309064
* Revert "llvm-mt: implement simple merging of manifests, not factoring ↵Eric Beckmann2017-07-251-144/+6
| | | | | | | | namespaces." This reverts commit 813308e240792ca70ed2f998f21df24a5061ada0. llvm-svn: 309050
* llvm-mt: implement simple merging of manifests, not factoring namespaces.Eric Beckmann2017-07-251-6/+144
| | | | | | | | | | | | Summary: Does a simple merge, where mergeable elements are combined, all others are appended. Does not apply trickly namespace rules. Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35753 llvm-svn: 309047
* Remove Bitrig: LLVM ChangesErich Keane2017-07-213-11/+8
| | | | | | | | Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned. Differential Revision: https://reviews.llvm.org/D35707 llvm-svn: 308799
* Implement parsing and writing of a single xml manifest file.Eric Beckmann2017-07-202-0/+74
| | | | | | | | | | Summary: Implement parsing and writing of a single xml manifest file. Subscribers: mgorny, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35425 llvm-svn: 308679
* Support, IR, ADT: Check nullptr after allocation with malloc/realloc or callocMatthias Braun2017-07-204-10/+38
| | | | | | | | | | | | As a follow up of the bad alloc handler patch, this patch introduces nullptr checks on pointers returned from the malloc/realloc/calloc functions. In addition some memory size assignments are moved behind the allocation of the corresponding memory to fulfill exception safe memory management (RAII). patch by Klaus Kretzschmar Differential Revision: https://reviews.llvm.org/D35414 llvm-svn: 308576
* Defeat a GCC -Wunused-result warningHans Wennborg2017-07-191-1/+2
| | | | | | | | | | | | | | | It was warning like: ../llvm-project/llvm/lib/Support/ErrorHandling.cpp:172:51: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] (void)::write(2, OOMMessage, strlen(OOMMessage)); Work around the warning by storing the return value in a variable and casting that to void instead. We already did this for the other write() call in this file. llvm-svn: 308483
OpenPOWER on IntegriCloud