summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* [SystemZ] Add support for IBM z14 processor (1/3)Ulrich Weigand2017-07-171-0/+2
| | | | | | | | | | | | | | This patch series adds support for the IBM z14 processor. This part includes: - Basic support for the new processor and its features. - Support for new instructions (except vector 32-bit float and 128-bit float). - CodeGen for new instructions, including new LLVM intrinsics. - Scheduler description for the new processor. - Detection of z14 as host processor. Support for the new 32-bit vector float and 128-bit vector float instructions is provided by separate patches. llvm-svn: 308194
* [YAMLTraits] Add filename support to yaml::InputAlex Bradbury2017-07-171-0/+8
| | | | | | | | | | | | | | | | | | | Summary: The current yaml::Input constructor takes a StringRef of data as its first parameter, discarding any filename information that may have been present when a YAML file was opened. Add an alterate yaml::Input constructor that takes a MemoryBufferRef, which can have a filename associated with it. This leads to clearer diagnostic messages. Sponsored By: DARPA, AFRL Reviewed By: arphaman Differential Revision: https://reviews.llvm.org/D35398 Patch by: Jonathan Anderson (trombonehero) llvm-svn: 308172
* [X86] Use MSVC's __cpuidex intrinsic instead of inline assembly in ↵Craig Topper2017-07-171-29/+10
| | | | | | | | | | getHostCPUName/getHostCPUFeatures for 32-bit builds too. We're already using it in 64-bit builds because 64-bit MSVC doesn't support inline assembly. As far as I know we were using inline assembly because at the time the code was added we had to support MSVC 2008 pre-SP1 while the intrinsic was added to MSVC in SP1. Now that we don't have to support that we should be able to just use the intrinsic. llvm-svn: 308163
* Support/Path.cpp: Prune unused "llvm/BinaryFormat".NAKAMURA Takumi2017-07-171-2/+0
| | | | llvm-svn: 308160
* Put std::mutex usage behind #ifdefs to pacify the sanitizer buildbotReid Kleckner2017-07-131-0/+22
| | | | llvm-svn: 307925
* Support: Add llvm::center_justify.Frederich Munch2017-07-131-6/+23
| | | | | | | | | | | | | | Summary: Completes the set. Reviewers: ruiu Reviewed By: ruiu Subscribers: ruiu, llvm-commits Differential Revision: https://reviews.llvm.org/D35278 llvm-svn: 307922
* [AArch64] Add an SVE target feature to the backend and TargetParser.Amara Emerson2017-07-131-0/+2
| | | | | | | The feature will be used properly once assembler/disassembler support begins to land. llvm-svn: 307917
* [X86] Simplify the getHostCPUName for AMD family 6 and 15.Craig Topper2017-07-131-38/+11
| | | | | | As far as I can tell we can simply distinguish based on features rather than model number. Many of the strings we were previously using are treated the same by the backend. llvm-svn: 307884
* Allow clients to specify search order of DynamicLibraries.Frederich Munch2017-07-123-11/+37
| | | | | | | | | | | | | | Summary: Different JITs and other clients of LLVM may have different needs in how symbol resolution should occur. Reviewers: v.g.vassilev, lhames, karies Reviewed By: v.g.vassilev Subscribers: pcanal, llvm-commits Differential Revision: https://reviews.llvm.org/D33529 llvm-svn: 307849
* Use std::mutex to avoid memory allocation after OOMReid Kleckner2017-07-121-13/+18
| | | | | | | | | | | | | | | ManagedStatic<sys::Mutex> would lazilly allocate a sys::Mutex to lock when reporting an OOM, which is a bad idea. The three STL implementations that I know of use pthread_mutex_lock and EnterCriticalSection to implement std::mutex. I'm pretty sure that neither of those allocate heap memory. It seems that we unconditionally use std::mutex without testing LLVM_ENABLE_THREADS elsewhere in the codebase, so this should be portable. llvm-svn: 307827
* [X86] Synchronize the ProcessorFeatures enum used by getHostCPUName with the ↵Craig Topper2017-07-121-41/+123
| | | | | | | | enum in libgcc and soon compiler-rt. This adds all the feature bits libgcc has. They will soon be added to compiler-rt as well. This adds a second 32 bit feature variable to hold the bits that are needed by getHostCPUName that are not in libgcc. libgcc had already used 31 of the 32 bits in the existing variable and we needed 3 bits so at minimum 2 bits would spill over. I chose to move all 3. llvm-svn: 307758
* [X86] Sync ProcessorTypes and ProcessorSubtypes enums used by getHostCPUName ↵Craig Topper2017-07-121-50/+35
| | | | | | | | with the version proposed to for compiler-rt's cpu_model.c This keeps the starting entries in the enums in sync with what's in gcc and in review D35214 for compiler-rt. llvm-svn: 307757
* [X86] Cleanup the switches in getHostCPUName to remove impossible combinations.Craig Topper2017-07-121-26/+9
| | | | llvm-svn: 307756
* [X86] Remove 'barcelona' string from getHostCPUName. Use 'amdfam10' instead. ↵Craig Topper2017-07-121-2/+0
| | | | | | The x86 backend doesn't distinguish. llvm-svn: 307755
* Fix minor typo introduced in r276404Don Hinton2017-07-121-1/+1
| | | | | | | | | | | | | | | | | Summary: A space was added between '-' and 'help' when emitting help output. See https://reviews.llvm.org/D22621 for details. Reviewers: MaggieYi, vsk Reviewed By: vsk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35283 llvm-svn: 307745
* [Support] - Add bad alloc error handler for handling allocation malfunctionsReid Kleckner2017-07-112-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Patch by Klaus Kretzschmar We would like to introduce a new type of llvm error handler for handling bad alloc fault situations. LLVM already provides a fatal error handler for serious non-recoverable error situations which by default writes some error information to stderr and calls exit(1) at the end (functions are marked as 'noreturn'). For long running processes (e.g. a server application), exiting the process is not an acceptable option, especially not when the system is in a temporary resource bottleneck with a good chance to recover from this fault situation. In such a situation you would rather throw an exception to stop the current compilation and try to overcome the resource bottleneck. The user should be aware of the problem of throwing an exception in bad alloc situations, e.g. you must not do any allocations in the unwind chain. This is especially true when adding exceptions in existing unfamiliar code (as already stated in the comment of the current fatal error handler) So the new handler can also be used to distinguish from general fatal error situations where recovering is no option. It should be used in cases where a clean unwind after the allocation is guaranteed. This patch contains: - A report_bad_alloc function which calls a user defined bad alloc error handler. If no user handler is registered the report_fatal_error function is called. This function is not marked as 'noreturn'. - A install/restore_bad_alloc_error_handler to install/restore the bad alloc handler. - An example (in Mutex.cpp) where the report_bad_alloc function is called in case of a malloc returns a nullptr. If this patch gets accepted we would create similar patches to fix corresponding malloc/calloc usages in the llvm code. Reviewers: chandlerc, greened, baldrick, rnk Reviewed By: rnk Subscribers: llvm-commits, MatzeB Differential Revision: https://reviews.llvm.org/D34753 llvm-svn: 307673
* [X86] Fix typo in comment. NFCCraig Topper2017-07-101-1/+1
| | | | llvm-svn: 307522
OpenPOWER on IntegriCloud