summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [mips] Fix MIPS N32 ABI triples supportSimon Atanasyan2018-09-171-2/+10
| | | | | | | | | | | | Add support mips64(el)-linux-gnuabin32 triples, and set them to N32. Debian architecture name mipsn32/mipsn32el are also added. Set UseIntegratedAssembler for N32 if we can detect it. Patch by YunQiang Su. Differential revision: https://reviews.llvm.org/D51408 llvm-svn: 342416
* fix typosAdrian Prantl2018-09-141-1/+1
| | | | llvm-svn: 342241
* [Support] Treat null bytes as separator in windows command line stringsMartin Storsjo2018-09-141-2/+6
| | | | | | | | | | | | | When reading directives from a .drectve section, the directives are tokenized as a normal windows command line. However in these cases, link.exe allows the directives to be separated by null bytes, not only by spaces. A test case for this change will be added in the lld repo. Differential Revision: https://reviews.llvm.org/D52014 llvm-svn: 342204
* Common infrastructure for reading a profile remapping file and buildingRichard Smith2018-09-132-0/+82
| | | | | | | | a mangling remapper from it. Differential Revision: https://reviews.llvm.org/D51246 llvm-svn: 342161
* [Support] sys::fs::directory_entry includes the file_type.Kristina Brooks2018-09-123-77/+95
| | | | | | | | | | | | | | | | This is available on most platforms (Linux/Mac/Win/BSD) with no extra syscalls. On other platforms (e.g. Solaris) we stat() if this information is requested. This will allow switching clang's VFS to efficiently expose (path, type) when traversing a directory. Currently it exposes an entire Status, but does so by calling fs::status() on all platforms. Almost all callers only need the path, and all callers only need (path, type). Patch by sammccall (Sam McCall) Differential Revision: https://reviews.llvm.org/D51918 llvm-svn: 342089
* AMDGPU: Re-apply r341982 after fixing the layering issueKonstantin Zhuravlyov2018-09-121-10/+40
| | | | | | | | | | | | Move isa version determination into TargetParser. Also switch away from target features to CPU string when determining isa version. This fixes an issue when we output wrong isa version in the object code when features of a particular CPU are altered (i.e. gfx902 w/o xnack used to result in gfx900). llvm-svn: 342069
* Revert "AMDGPU: Move isa version and EF_AMDGPU_MACH_* determination into ↵Ilya Biryukov2018-09-121-128/+10
| | | | | | | | | | | TargetParser." This reverts commit r341982. The change introduced a layering violation. Reverting to unbreak our integrate. llvm-svn: 342023
* [cmake] Speed up check-llvm 5x by delay loading shell32 and ole32Reid Kleckner2018-09-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, check-llvm on my Windows 10 workstation took about 300s to run, and it would lock up my mouse. Now, it takes just under 60s. Previously running the tests only used about 15% of the available CPU time, now it uses up to 60%. Shell32.dll and ole32.dll have direct dependencies on user32.dll and gdi32.dll. These DLLs are mostly used to for Windows GUI functionality, which most LLVM tools don't need. It seems that these DLLs acquire and release some system resources on startup and exit, and that requires acquiring the same highly contended lock discussed in this post: https://randomascii.wordpress.com/2017/07/09/24-core-cpu-and-i-cant-move-my-mouse/ Most LLVM tools still have a transitive dependency on SHGetKnownFolderPathW, which is used to look up the user home directory and local AppData directory. We also use SHFileOperationW to recursively delete a directory, but only LLDB and clang-doc use this today. At some point, we might consider removing these last shell32.dll deps, but for now, I would like to take this free performance. Many thanks to Bruce Dawson for suggesting this fix. He looked at an ETW trace of an LLVM test run, noticed these DLLs, and suggested avoiding them. Reviewers: zturner, pcc, thakis Subscribers: mgorny, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D51952 llvm-svn: 342002
* [Support] Quote arguments containing \n on WindowsReid Kleckner2018-09-111-1/+1
| | | | | | | | | Fixes at_file.c test failure caused by r341988. We may want to change how we treat \n in our tokenizer, but this is probably a good fix regardless, since we can invoke all kinds of programs with different interpretations of the command line quoting rules. llvm-svn: 341992
* [Support] Avoid calling CommandLineToArgvW from shell32.dllReid Kleckner2018-09-111-55/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Shell32.dll depends on gdi32.dll and user32.dll, which are mostly DLLs for Windows GUI functionality. LLVM's utilities don't typically need GUI functionality, and loading these DLLs seems to be slowing down startup. Also, we already have an implementation of Windows command line tokenization in cl::TokenizeWindowsCommandLine, so we can just use it. The goal is to get the original argv in UTF-8, so that it can pass through most LLVM string APIs. A Windows process starts life with a UTF-16 string for its command line, and it can be retreived with GetCommandLineW from kernel32.dll. Previously, we would: 1. Get the wide command line 2. Call CommandLineToArgvW to handle quoting rules and separate it into arguments. 3. For each wide argument, expand wildcards (* and ?) using FindFirstFileW. 4. Convert each argument to UTF-8 Now we: 1. Get the wide command line, convert the whole thing to UTF-8 2. Tokenize the UTF-8 command line with cl::TokenizeWindowsCommandLine 3. For each argument, expand wildcards if present - This requires converting back to UTF-16 to call FindFirstFileW - Results of FindFirstFileW must be converted back to UTF-8 Reviewers: zturner Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D51941 llvm-svn: 341988
* AMDGPU: Move isa version and EF_AMDGPU_MACH_* determinationKonstantin Zhuravlyov2018-09-111-10/+128
| | | | | | | | | | | | | | into TargetParser. Also switch away from target features to CPU string when determining isa version. This fixes an issue when we output wrong isa version in the object code when features of a particular CPU are altered (i.e. gfx902 w/o xnack used to result in gfx900). Differential Revision: https://reviews.llvm.org/D51890 llvm-svn: 341982
* ADT: add <bit> header, implement C++20 bit_cast, useJF Bastien2018-09-081-14/+7
| | | | | | | | | | | | | | Summary: I saw a few places that were punning through a union of FP and integer, and that made me sad. Luckily, C++20 adds bit_cast for exactly that purpose. Implement our own version in ADT (without constexpr, leaving us a bit sad), and use it in the few places my grep-fu found silly union punning. This was originally committed as r341728 and reverted in r341730. Reviewers: javed.absar, steven_wu, srhines Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51693 llvm-svn: 341741
* Revert "ADT: add <bit> header, implement C++20 bit_cast, use"JF Bastien2018-09-071-7/+14
| | | | | | Bots sad. Looks like missing std::is_trivially_copyable. llvm-svn: 341730
* ADT: add <bit> header, implement C++20 bit_cast, useJF Bastien2018-09-071-14/+7
| | | | | | | | | | | | Summary: I saw a few places that were punning through a union of FP and integer, and that made me sad. Luckily, C++20 adds bit_cast for exactly that purpose. Implement our own version in ADT (without constexpr, leaving us a bit sad), and use it in the few places my grep-fu found silly union punning. Reviewers: javed.absar Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51693 llvm-svn: 341728
* [Windows] Convert from UTF-8 to UTF-16 when writing to a Windows consoleReid Kleckner2018-09-053-25/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Calling WriteConsoleW is the most reliable way to print Unicode characters to a Windows console. If binary data gets printed to the console, attempting to re-encode it shouldn't be a problem, since garbage in can produce garbage out. This breaks printing strings in the local codepage, which WriteConsoleA knows how to handle. For example, this can happen when user source code is encoded with the local codepage, and an LLVM tool quotes it while emitting a caret diagnostic. This is unfortunate, but well-behaved tools should validate that their input is UTF-8 and escape non-UTF-8 characters before sending them to raw_fd_ostream. Clang already does this, but not all LLVM tools do this. One drawback to the current implementation is printing a string a byte at a time doesn't work. Consider this LLVM code: for (char C : MyStr) outs() << C; Because outs() is now unbuffered, we wil try to convert each byte to UTF-16, which will fail. However, this already didn't work, so I think we may as well update callers that do that as we find them to print complete portions of strings. You can see a real example of this in my patch to SourceMgr.cpp Fixes PR38669 and PR36267. Reviewers: zturner, efriedma Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D51558 llvm-svn: 341433
* Set console mode when -fansi-escape-codes is enabled David Bolvansky2018-09-041-0/+9
| | | | | | | | | | | | | | | | | | | | | Summary: Windows console now supports supports ANSI escape codes, but we need to enable it using SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING flag. Fixes https://bugs.llvm.org/show_bug.cgi?id=38817 Tested on Windows 10, screenshot: https://i.imgur.com/bqYq0Uy.png Reviewers: zturner, chandlerc Reviewed By: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51611 llvm-svn: 341396
* Do not leak the Mach host port in sys::getHostCPUName()Kristina Brooks2018-09-041-1/+3
| | | | | | Patch by rsesek (Robert Sesek) llvm-svn: 341357
* [DebugInfo] Common behavior for error typesAlexandre Ganea2018-08-311-1/+1
| | | | | | | | | | | | | | | Following D50807, and heading towards D50664, this intermediary change does the following: 1. Upgrade all custom Error types in llvm/trunk/lib/DebugInfo/ to use the new StringError behavior (D50807). 2. Implement std::is_error_code_enum and make_error_code() for DebugInfo error enumerations. 3. Rename GenericError -> PDBError (the file will be renamed in a subsequent commit) 4. Update custom error messages to follow the same formatting: (\w\s*)+\. 5. Keep generic "file not found" (ENOENT) errors as they are in PDB code. Previously, there used to be a custom enumeration for that purpose. 6. Remove a few extraneous LF in log() implementations. Printing LF is a responsability at a higher level, not at the error level. Differential Revision: https://reviews.llvm.org/D51499 llvm-svn: 341228
* Hashing: use 64-bit seed for hashing on all platforms.Tim Northover2018-08-301-2/+2
| | | | | | | | | | | get_execution_seed returns a size_t which varies across platforms, but its users actually always feed it into a uint64_t role so it makes sense to be consistent. Mostly this is just a tidy-up, but it also apparently allows PCH files to be shared between Clang compilers built for 32-bit and 64-bit hosts. llvm-svn: 341113
* [Error] Add FileError helper; upgrade StringError behaviorAlexandre Ganea2018-08-301-2/+22
| | | | | | | | | | | | | | | | FileError is meant to encapsulate both an Error and a file name/path. It should be used in cases where an Error occurs deep down the call chain, and we want to return it to the caller along with the file name. StringError was updated to display the error messages in different ways. These can be: 1. display the error_code message, and convert to the same error_code (ECError behavior) 2. display an arbitrary string, and convert to a provided error_code (current StringError behavior) 3. display both an error_code message and a string, in this order; and convert to the same error_code These behaviors can be triggered depending on the constructor. The goal is to use StringError as a base class, when a library needs to provide a explicit Error type. Differential Revision: https://reviews.llvm.org/D50807 llvm-svn: 341064
* Start reserving x18 by default on Android targets.Peter Collingbourne2018-08-291-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D45588 llvm-svn: 340889
* Use a lambda for calls to ::open in RetryAfterSignalHans Wennborg2018-08-272-3/+8
| | | | | | | | | | In Bionic, open can be overloaded for _FORTIFY_SOURCE support, causing compile errors of RetryAfterSignal due to overload resolution. Wrapping the call in a lambda avoids this. Based on a patch by Chih-Wei Huang <cwhuang@linux.org.tw>! llvm-svn: 340751
* Avoid specializing a variadic member template in a way that seems to notChandler Carruth2018-08-261-15/+13
| | | | | | | | | agree with MSVC. There isn't actually a need for specialization here as we can write the code generically and just have a test that will fold away as a constant. llvm-svn: 340700
* Remove superfluous semicolon. NFCI.Simon Pilgrim2018-08-251-1/+1
| | | | llvm-svn: 340686
* This patch adds support to LLVM for writing HermitCore ↵Eric Christopher2018-08-251-0/+2
| | | | | | | | | | | (https://hermitcore.org) ELF binaries. HermitCore is a POSIX-compatible kernel for running a single application in an isolated environment to get maximum performance and predictable runtime behavior. It can either be used bare-metal on hardware or a VM (Unikernel) or side by side to an existing Linux system (Multikernel). Due to the latter feature, HermitCore binaries are marked with ELFOSABI_STANDALONE to let the Linux ELF loader distinguish them from regular Unix/Linux binaries and load them using the HermitCore "proxy" tool. Patch by Colin Finck! llvm-svn: 340675
* Allow demangler's node allocator to fail, and bail out of the entireRichard Smith2018-08-241-5/+21
| | | | | | | | | | | | | | | | demangling process when it does. Use this to support a "lookup" query for the mangling canonicalizer that does not create new nodes. This could also be used to implement demangling with a fixed-size temporary storage buffer. Reviewers: erik.pilkington Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51003 llvm-svn: 340670
* Add data structure to form equivalence classes of mangled names.Richard Smith2018-08-242-0/+308
| | | | | | | | | | | | | | | Summary: Given a set of equivalent name fragments, this mechanism determines whether two mangled names are equivalent. The intent is to use this for fuzzy matching of profile data against the program after certain refactorings are performed. Reviewers: erik.pilkington, dlj Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D50935 llvm-svn: 340663
* [Support] Allow discarding a FileOutputBuffer without removing the memory ↵Martin Storsjo2018-08-241-0/+6
| | | | | | | | mapping Differential Revision: https://reviews.llvm.org/D51095 llvm-svn: 340634
* Make LLVM_ENABLE_CRASH_DUMPS set a variable defaultReid Kleckner2018-08-231-5/+4
| | | | | | | That way users can set the default to true, but then disable core dumps from certain apps that link support. llvm-svn: 340588
* Fixup AreCoreFilesPrevented() to consider first LLVM_ENABLE_CRASH_DUMPS and ↵Douglas Yung2018-08-231-1/+1
| | | | | | | | | secondly coreFilesPrevented. The previous change ignored the latter resulting in crash dumps being generated when LLVM_ENABLE_CRASH_DUMPS was set, but coreFilesPrevented was true. llvm-svn: 340561
* [Support] Fix some Wundef warningsSven van Haastregt2018-08-234-10/+10
| | | | | | | | | | For the _WIN32 macro, it is the definedness that matters rather than the value. Most uses of the macro already rely on the definedness. This commit fixes the few remaining uses that relied on the value. Differential Revision: https://reviews.llvm.org/D51105 llvm-svn: 340520
* Improve incompatible triple errorJF Bastien2018-08-231-1/+1
| | | | | | When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching. llvm-svn: 340509
* [Support][CachePruning] prune least recently accessed files firstBob Haarman2018-08-221-12/+35
| | | | | | | | | | | | | | | | | Summary: Before this change, pruning order was based on size. This changes it to be based on time of last use instead, preferring to keep recently used files and prune older ones. Reviewers: pcc, rnk, espindola Reviewed By: rnk Subscribers: emaste, arichardson, hiraditya, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51062 llvm-svn: 340374
* Try to fix bot build failureMatt Arsenault2018-08-211-1/+1
| | | | llvm-svn: 340296
* AMDGPU: Partially move target handling code from clang to TargetParserMatt Arsenault2018-08-211-0/+147
| | | | | | | | | | | | | | | | | | | | A future change in clang necessitates access of this information from the driver, so move this into a common place. Try to mimic something resembling the API the other targets are using here. One thing I'm uncertain about is how to split amdgcn and r600 handling. Here I've mostly duplicated the functions for each, while keeping the same enums. I think this is a bit awkward for the features which don't matter for amdgcn. It's also a bit messy that this isn't a complete set of subtarget features. This is just the minimum set needed for the driver code. For example building the list of subtarget feature names is still in clang. llvm-svn: 340291
* Add cmake option to disable minidumps, default it to offReid Kleckner2018-08-201-1/+2
| | | | | | | | | | | | | Since crash dumping landed in r268519, May 2016, I have not once seen anyone use an uploaded minidump to debug a compiler crash. Therefore, I'm turning this off by default. The dumps clutter up user and buildbot temp directories. Each file is only about 56KB, but it adds up. In the context of clang, the extra line about the minidump confuses users, when what we really want from them is the pre-processed source code. llvm-svn: 340185
* Fix an undefined behavior when storing an empty StringRef.Haojian Wu2018-08-201-1/+2
| | | | | | | | | | | | Summary: Passing a nullptr to memcpy is UB. Reviewers: ioeric Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D50966 llvm-svn: 340170
* [DebugCounters] don't do redundant map lookups; NFCGeorge Burgess IV2018-08-171-4/+8
| | | | llvm-svn: 340104
* [ARM/AArch64] Support FP16 +fp16fml instructionsBernard Ogden2018-08-171-0/+7
| | | | | | | | | | | | | | | | | | Add +fp16fml feature for new FP16 instructions, which are a mandatory part of FP16 from v8.4-A and an optional part of FP16 from v8.2-A. It doesn't seem to be possible to model this in LLVM, but the relationship between the options is handled by the related clang patch. In keeping with what I think is the usual practice, the fp16fml extension is accepted regardless of base architecture version. Builds on/replaces Sjoerd Meijer's patch to add these instructions at https://reviews.llvm.org/D49839. Differential Revision: https://reviews.llvm.org/D50228 llvm-svn: 340013
* [Support] Add a public API to allow clearing all (static) timer groups.Graydon Hoare2018-08-171-2/+13
| | | | | | | | | | | | | | | | | | | | | | Summary: Formerly, all timer groups were automatically cleared when printed out. In https://reviews.llvm.org/rL324788 this behaviour was changed to not-clearing timers on printout, to allow printing timers more than once, but as a result clients (specifically Swift) that relied on the clear-on-print behaviour to inhibit duplicate timer printing on shutdown were broken. Rather than revert that change, this change adds a new API that enables clients that _want_ to clear all timers to do so explicitly. Reviewers: george.karpenkov, thegameg Reviewed By: george.karpenkov Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50874 llvm-svn: 339980
* [ADT] Replace APInt::WORD_MAX with APInt::WORDTYPE_MAXSimon Pilgrim2018-08-161-9/+9
| | | | | | | | | | | | The windows SDK defines WORD_MAX, so any poor soul that wants to use LLVM in a project that depends on the windows SDK gets a build error. Given that it actually describes the maximal value of WordType, it actually fits even better than WORD_MAX Patch by: @miscco Differential Revision: https://reviews.llvm.org/D50777 llvm-svn: 339863
* [Support] Add a basic C API for llvm::Error.Lang Hames2018-08-151-0/+20
| | | | | | | | | | | | | | | | Summary: The C-API supports consuming errors, converting an error to a string error message, and querying an error's type. Other LLVM C APIs that wish to use llvm::Error can supply error-type-id checkers and custom error-to-structured-type converters for any custom errors they provide. Reviewers: bogner, zturner, labath, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50716 llvm-svn: 339802
* [Support] NFC: Allow modifying access/modification times independently in ↵Jordan Rupprecht2018-08-132-7/+14
| | | | | | | | | | | | | | | | | sys::fs::setLastModificationAndAccessTime. Summary: Add an overload to sys::fs::setLastModificationAndAccessTime that allows setting last access and modification times separately. This will allow tools to use this API when they want to preserve both the access and modification times from an input file, which may be different. Also note that both the POSIX (futimens/futimes) and Windows (SetFileTime) APIs take the two timestamps in the order of (1) access (2) modification time, so this renames the method to "setLastAccessAndModificationTime" to make it clear which timestamp is which. For existing callers, the 1-arg overload just sets both timestamps to the same thing. Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50521 llvm-svn: 339628
* [ADT] Normalize empty triple componentsPetr Hosek2018-08-081-0/+6
| | | | | | | | | | | | | | | | | LLVM triple normalization is handling "unknown" and empty components differently; for example given "x86_64-unknown-linux-gnu" and "x86_64-linux-gnu" which should be equivalent, triple normalization returns "x86_64-unknown-linux-gnu" and "x86_64--linux-gnu". autoconf's config.sub returns "x86_64-unknown-linux-gnu" for both "x86_64-linux-gnu" and "x86_64-unknown-linux-gnu". This changes the triple normalization to behave the same way, replacing empty triple components with "unknown". This addresses PR37129. Differential Revision: https://reviews.llvm.org/D50219 llvm-svn: 339294
* Refactor FileCheck to make it usable as an APIAditya Nandakumar2018-08-072-0/+1341
| | | | | | | | | | https://reviews.llvm.org/D50283 reviewed by bogner This patch refactors FileCheck's implementation into support so it can be used from C++ in other places (Unit tests). llvm-svn: 339192
* Fix raw_fd_ostream::write_impl hang due to an infinite loop with large outputOwen Reynolds2018-08-061-4/+4
| | | | | | | | | | On windows when raw_fd_ostream::write_impl calls write, a 32 bit input is required for character count. As a variable with size_t is used for this argument, on x64 integral demotion occurs. In the case of large files an infinite loop follows. See: https://bugs.llvm.org/show_bug.cgi?id=37926 This fix allows the output of files larger than the previous int32 limit. Differential Revision: https://reviews.llvm.org/D48948 llvm-svn: 339027
* Fix modules build with different technique to suppress Knuth debuggingTim Northover2018-08-061-37/+33
| | | | | | | | | | Currently we use #pragma push_macro(LLVM_DEBUG) to fiddle with the LLVM_DEBUG macro so that we can silence debugging the Knuth division algorithm unless it's actually desired. Unfortunately this is incompatible with enabling modules while building LLVM (via LLVM_ENABLE_MODULES=ON), probably due to a bug being fixed by D33004. llvm-svn: 339009
* Fix buildbot breakage.Rui Ueyama2018-08-041-2/+1
| | | | llvm-svn: 338940
* Use the same constants as zlib to represent compression level.Rui Ueyama2018-08-041-17/+4
| | | | | | | | | | This change allows users pass compression level that was not listed in the enum. Also, I think using different values than zlib's compression levels was just confusing. Differential Revision: https://reviews.llvm.org/D50196 llvm-svn: 338939
* [Support] Don't initialize compressed buffer allocated by zlib::compressFangrui Song2018-08-031-2/+2
| | | | | | | | | | | resize() (zeroing) makes every allocated page resident. The actual size of the compressed buffer is usually much smaller. Making every page resident is wasteful. When linking a test binary with ~1.9GiB uncompressed debug info with LLD, this optimization decreases max RSS by ~1.5GiB. Differential Revision: https://reviews.llvm.org/50223 llvm-svn: 338913
OpenPOWER on IntegriCloud