summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
* Get Triple::getARMCPUForArch() to use TargetParserRenato Golin2015-05-202-94/+211
| | | | | | | | | | | | | | | | | | | | First ARMTargetParser FIXME, conservatively changing the way we parse CPUs in the back-end. Still not perfect, with a lot of special cases, but moving towards a more generic solution. Moving all logic to the target parser made some unwritten assumptions about architectures in Clang to break. I've added a lot of architectures required by Clang, and default to CPUs that Clang believes it should (and I agree). I've also added a lot of unit tests, with the correct CPU for each architecture, and Clang seems to be working correctly, too. It also became clear that using "unsigned ID" as the argument for the get methods makes it hard to know what ID, so I also changed the argument names to match the enum type names. llvm-svn: 237797
* Revert r237708 (MIR serialization) - incremental buildbots became unstable.Alex Lorenz2015-05-191-4/+0
| | | | | | | | The incremental buildbots entered a pass-fail cycle where during the fail cycle one of the tests from this commit fails for an unknown reason. I have reverted this commit and will investigate the cause of this problem. llvm-svn: 237730
* [DWARF parser] Add basic support for DWZ DWARF multifile extensions.Alexey Samsonov2015-05-191-0/+4
| | | | | | | | | | | | | | | | | | | | | This change implements basic support for DWARF alternate sections proposal: http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open LLVM tools now understand new forms: DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt, which are used as references to .debug_info and .debug_str sections respectively, stored in a separate file, and possibly shared between different executables / shared objects. llvm-dwarfdump and llvm-symbolizer don't yet know how to access this alternate debug file (usually pointed by .gnu_debugaltlink section), but they can at lease properly parse and dump regular files, which refer to it. This change should fix crashes of llvm-dwarfdump and llvm-symbolizer on files produced by running "dwz" tool. Such files are already installed on some modern Linux distributions. llvm-svn: 237721
* MIR Serialization: print and parse LLVM IR using MIR format.Alex Lorenz2015-05-191-0/+4
| | | | | | | | | | | | | | | | This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 237708
* Rangify for loop in Cleanup(), NFC.Yaron Keren2015-05-191-2/+2
| | | | llvm-svn: 237695
* Prevent Cleanup() from running more than once.Yaron Keren2015-05-191-0/+3
| | | | llvm-svn: 237694
* [YAML] Plug a memory leakBenjamin Kramer2015-05-181-2/+4
| | | | | | | The destructor of BlockScalarNode is never called. Store the contained string in BumpPtrAllocated memory instead. llvm-svn: 237614
* YAML: Add support for literal block scalar I/O.Alex Lorenz2015-05-141-0/+26
| | | | | | | | | | | | | This commit gives the users of the YAML Traits I/O library the ability to serialize scalars using the YAML literal block scalar notation by allowing them to implement a specialization of the `BlockScalarTraits` struct for their custom types. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D9613 llvm-svn: 237404
* Fix memory leak introduced in r237314.Alex Lorenz2015-05-141-1/+1
| | | | | | | | | | | | | | The commit r237314 that implements YAML block parsing introduced a leak that was caught by the ASAN linux buildbot. YAML Parser stores its tokens in an ilist, and allocates tokens using a BumpPtrAllocator, but doesn't call the destructor for the allocated tokens. R237314 added an std::string field to a Token which leaked as the Token's destructor wasn't called. This commit fixes this leak by calling the Token's destructor when a Token is being removed from an ilist of tokens. llvm-svn: 237389
* YAML: Implement block scalar parsing.Alex Lorenz2015-05-131-21/+265
| | | | | | | | | | | | | | | | | | | | | This commit implements the parsing of YAML block scalars. Some code existed for it before, but it couldn't parse block scalars. This commit adds a new yaml node type to represent the block scalar values. This commit also deletes the 'spec-09-27' and 'spec-09-28' tests as they are identical to the test file 'spec-09-26'. This commit introduces 3 new utility functions to the YAML scanner class: `skip_s_space`, `advanceWhile` and `consumeLineBreakIfPresent`. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D9503 llvm-svn: 237314
* Revert r237157, "YAML: Fix typos. NFC".Alex Lorenz2015-05-121-2/+2
| | | | | | 'Iff' isn't a typo, it's a shorthand for 'if and only if'. llvm-svn: 237160
* YAML: Fix typos. NFC.Alex Lorenz2015-05-121-2/+2
| | | | llvm-svn: 237157
* Change TargetParser enum names to avoid macro conflicts (llvm)Renato Golin2015-05-121-55/+55
| | | | | | | | | sys/time.h on Solaris (and possibly other systems) defines "SEC" as "1" using a cpp macro. The result is that this fails to compile. Fixes https://llvm.org/PR23482 llvm-svn: 237112
* Readdress r236990, use of static members on a non-static variable.David Blaikie2015-05-111-29/+23
| | | | | | | | | | | | The TargetRegistry is just a namespace-like class, instantiated in one place to use a range-based for loop. Instead, expose access to the registry via a range-based 'targets()' function instead. This makes most uses a bit awkward/more verbose - but eventually we should just add a range-based find_if function which will streamline these functions. I'm happy to mkae them a bit awkward in the interim as encouragement to improve the algorithms in time. llvm-svn: 237059
* TargetParser: FPU/ARCH/EXT parsing refactory - NFCRenato Golin2015-05-083-1/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new class in a global context contain arch-specific knowledge in order to provide LLVM libraries, tools and projects with the ability to understand the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are supported. Current behaviour it to parse from free-text to enum values and back, so that all users can share the same parser and codes. This simplifies a lot both the ASM/Obj streamers in the back-end (where this came from), and the front-end parsers for command line arguments (where this is going to be used next). The previous implementation, using .def/.h includes is deprecated due to its inflexibility to be built without the backend support and for being too cumbersome. As more architectures join this scheme, and as more features of such architectures are added (such as hardware features, type sizes, etc) into a full blown TargetDescription class, having a set of classes is the most sane implementation. The ultimate goal of this refactor both LLVM's and Clang's target description classes into one unique interface, so that we can de-duplicate and standardise the descriptions, as well as make it available for other front-ends, tools, etc. The FPU parsing for command line options in Clang has been converted to use this new library and a number of aliases were added for compatibility: * A bogus neon-vfpv3 alias (neon defaults to vfp3) * armv5/v6 * {fp4/fp5}-{sp/dp}-d16 Next steps: * Port Clang's ARCH/EXT parsing to use this library. * Create a TableGen back-end to generate this information. * Run this TableGen process regardless of which back-ends are built. * Expose more information and rename it to TargetDescription. * Continue re-factoring Clang to use as much of it as possible. llvm-svn: 236900
* [ARM] Reject invalid -march valuesJohn Brawn2015-05-081-35/+40
| | | | | | | | | | | | | | | Restructure Triple::getARMCPUForArch so that invalid values will return nullptr, while retaining the behaviour that an argument specifying no particular architecture version will give a default CPU. This will be used by clang to give an error on invalid -march values. Also restructure the extraction of the architecture version from the MArch string a little to hopefully make what it's doing clearer. Differential Revision: http://reviews.llvm.org/D9599 llvm-svn: 236845
* Use auto instead of the long type name. NFC.Steven Wu2015-05-071-2/+1
| | | | llvm-svn: 236768
* YAML: Enable the YAMLParser tests. Alex Lorenz2015-05-071-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | This commit enables the tests located in test/YAMLParser directory. Those tests were never actually enabled, as llvm-lit didn't pick up the files with the 'data' extension. The commit renames those test files to files with the 'test' extension so that llvm-lit would find them. This commit also modifies yaml-bench so that it returns an error status if an error occurred during parsing. It also adds the '-use-color' command line option to yaml-bench (to make sure that file check matches the error messages in the output stream). This commit modifies some of the renamed tests so that they wouldn't fail. It gets rid of XFAILs and uses the 'not' command instead for some of the tests that have to fail during parsing. This commit also adds some 'FIXME' comments to a couple of tests that are supposed to fail but currently pass because of various bugs in the implementation of the yaml parser. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9448 llvm-svn: 236754
* Fix another hang caused by ManagedStatic in SignalHandlerSteven Wu2015-05-071-4/+11
| | | | | | | | | Fix two other variables that might cause the same hang fixed in r235914. The hang is caused by constructing ManagedStatic in signalhandler. In this case, if FileToRemove or CallBacksToRun is not contructed, it means there is no work to do. llvm-svn: 236741
* YAML: Extract the code that skips a comment into a separate method, NFC. Alex Lorenz2015-05-061-12/+19
| | | | | | | | | | | This commit extracts the code that skips over a YAML comment from the 'scanToNextToken' method into a separate 'skipComment' method. This refactoring is motivated by a patch that implements parsing of YAML block scalars (http://reviews.llvm.org/D9503), as the method that parses a block scalar reuses the 'skipComment' method. llvm-svn: 236663
* Fix link failure on MinGW due to use of CoInitialize.Zachary Turner2015-05-061-1/+1
| | | | | | | | ole32 is considered a default library with MSVC, but apparently not with MinGW. Since we use CoInitialize, we need to explicitly link against it in LLVMSupport for a MinGW build. llvm-svn: 236654
* [SystemZ] Add z13 vector facility and MC supportUlrich Weigand2015-05-051-0/+24
| | | | | | | | | | | | | | | | | | | | | This patch adds support for the z13 processor type and its vector facility, and adds MC support for all new instructions provided by that facilily. Apart from defining the new instructions, the main changes are: - Adding VR128, VR64 and VR32 register classes. - Making FP64 a subclass of VR64 and FP32 a subclass of VR32. - Adding a D(V,B) addressing mode for scatter/gather operations - Adding 1-, 2-, and 3-bit immediate operands for some 4-bit fields. Until now all immediate operands have been the same width as the underlying field (hence the assert->return change in decode[SU]ImmOperand). In addition, sys::getHostCPUName is extended to detect running natively on a z13 machine. Based on a patch by Richard Sandiford. llvm-svn: 236520
* Fix regression in parsing armv{6,7}hl- triples. These are used by SUSEIsmail Donmez2015-05-051-2/+3
| | | | | | | | and Redhat currently. Reviewed by Jonathan Roelofs. llvm-svn: 236492
* YAML: Add an optional 'flow' field to the mapping trait to allow flow ↵Alex Lorenz2015-05-041-4/+46
| | | | | | | | | | | | | mapping output. This patch adds an optional 'flow' field to the MappingTrait class so that yaml IO will be able to output flow mappings. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9450 llvm-svn: 236456
* Replace windows_error calls with mapWindowsError.Yaron Keren2015-05-042-34/+26
| | | | | | | | After r210687, windows_error does nothing but call mapWindowsError. Other Windows/*.inc files directly call mapWindowsError. This patch updates Path.inc and Process.inc to do the same. llvm-svn: 236409
* YAML: Fix the output of sequences that contain flow sequences. Alex Lorenz2015-05-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug where the YAML Output class emitted a sequence of flow sequences without the '-' characters. Before: seq: [ a, b ] [ c, d ] After: seq: - [ a, b ] - [ c, d ] Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9206 llvm-svn: 236329
* Fix omission from adding sparcel (original http://reviews.llvm.org/D9263)Douglas Katzman2015-05-011-0/+1
| | | | | | | | "obviously" it needs to go in parseArch *and* getArchTypeForLLVMName. Differential Revision: http://reviews.llvm.org/D9436 llvm-svn: 236322
* Fix -Wpessimizing-move warnings by removing std::move calls.Richard Trieu2015-04-301-2/+2
| | | | llvm-svn: 236278
* New architecture name - 'sparcel' for Sparc little-endian.Douglas Katzman2015-04-291-0/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D9263 llvm-svn: 236139
* Fixes a hang that can occur if a signal comes in during malloc calls.Chris Bieneman2015-04-271-0/+6
| | | | | | We need to dereference the signals mutex during handler registration so that we force its construction. This is to prevent the first use being during handling an actual signal because you can't safely allocate memory in a signal handler. llvm-svn: 235914
* Fix build broken by incorrect class name.Zachary Turner2015-04-271-3/+3
| | | | llvm-svn: 235901
* Make an RAII com initializer.Zachary Turner2015-04-274-0/+88
| | | | | | | Differential Revision: http://reviews.llvm.org/D9267 Reviewed By: Aaron Ballman, David Majnemer llvm-svn: 235898
* Assert that Process::FindInEnvPath() is passed a relative path.Nico Weber2015-04-241-0/+1
| | | | | | | It misbehaves with absolute paths. (So does path::append().) Goes with clang r235787. llvm-svn: 235788
* Use the cleaner syntx value initialization to zero initialize POD structs.Yaron Keren2015-04-241-6/+3
| | | | | | Suggestion from David Blaikie! llvm-svn: 235721
* Silence clang warning: missing field 'Dr0' initializer.Yaron Keren2015-04-241-1/+2
| | | | llvm-svn: 235719
* Fix APInt long division algorithmPawel Bylica2015-04-241-19/+9
| | | | | | | | | | | | | | | | Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" handling. Test Plan: Unit test that reveals the bug included. Reviewers: chandlerc, yaron.keren Reviewed By: yaron.keren Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9196 llvm-svn: 235699
* Remove FilesToRemove->push_back(Filename) from sys::DontRemoveFileOnSignal.Yaron Keren2015-04-211-1/+0
| | | | llvm-svn: 235408
* Don't allow pwrite to resize a stream.Rafael Espindola2015-04-201-9/+6
| | | | | | | | | | | | | | | | | | | | | The current implementations could exhibit some behavior differences: raw_fd_ostream: Whatever the underlying fd does with seek+write. In a normal file, the write position would be back to the old offset. raw_svector_ostream: The write position is always the end of the stream, so after pwrite the write position would be the new end. This matches what OS_X (all BSD?) do with a pwrite in a O_APPEND fd. Given that we don't need that feature and don't use O_APPEND a lot in LLVM, just disallow it. I am open to suggestions on renaming pwrite to something else, but this fixes the issue for now. Thanks to Yaron Keren for reporting it. llvm-svn: 235303
* Revert r235177 as the Handle is used to fail GetExitCodeProcess on purpose.Yaron Keren2015-04-171-1/+3
| | | | | | | Avoid double closing of the handle by testing GetLastErr for ERROR_INVALID_HANDLE and not calling CloseHandle(PI.ProcessHandle) then. llvm-svn: 235184
* Eliminate superfluous CloseHandle(PI.ProcessHandle).Yaron Keren2015-04-171-1/+0
| | | | | | | This handle will always be closed few lines later, resulting in an error for the second CloseHandle. llvm-svn: 235177
* Fix lib\support\Windows/TimeValue.inc(48): warning C4189:Yaron Keren2015-04-151-0/+1
| | | | | | 'Error' : local variable is initialized but not referenced. llvm-svn: 234982
* Use the ability to pwrite to simplify the ELF writer.Rafael Espindola2015-04-141-1/+1
| | | | | | | | | | | | Now we don't have to do 2 synchronized passes to compute offsets and then write the file. This also includes a fix for the corner case of seeking in /dev/null. It is not an error, but on some systems (Linux) the returned offset is always 0. An error is signaled by returning -1. This is checked by the existing tests now that "clang -o /dev/null ..." seeks. llvm-svn: 234952
* Add raw_pwrite_stream type.Rafael Espindola2015-04-141-2/+29
| | | | | | | This is a raw_ostream that also supports pwrite. I will be used in a sec. llvm-svn: 234895
* Fix SupportsSeeking detection on windows.Rafael Espindola2015-04-131-0/+7
| | | | | | Will be tested by existing tests once used (soon). llvm-svn: 234737
* Add r234615 back, but make sure outs() is binary.Rafael Espindola2015-04-131-25/+21
| | | | | | | | | | | Original message. Have one raw_fd_ostream constructor forward to the other. This fixes some odd behaviour differences between the two. In particular, the version that takes a FD no longer unconditionally sets stdout to binary. llvm-svn: 234734
* Revert r234615, "Have one raw_fd_ostream constructor forward to the other."NAKAMURA Takumi2015-04-131-18/+24
| | | | | | | | | It broke MSVCRT hosts: LLVM :: Object/check_binary_output.ll LLVM :: Object/extract.ll llvm-svn: 234721
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-4/+2
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* Remember if lseek works in this FD.Rafael Espindola2015-04-101-1/+2
| | | | | | It will be used in clang in a sec. llvm-svn: 234619
* Have one raw_fd_ostream constructor forward to the other.Rafael Espindola2015-04-101-24/+18
| | | | | | | This fixes some odd behavior differences between the two. In particular, the version that takes a FD no longer unconditionally sets stdout to binary. llvm-svn: 234615
* [FS] Report errors from llvm::sys::fs::rename on WindowsReid Kleckner2015-04-101-0/+1
| | | | | | | | | | Previously we would always report success, which is pretty bogus. I'm too lazy to write a test where rename will portably fail on all platforms. I'm just trying to fix breakage introduced by r234597, which happened to tickle this. llvm-svn: 234611
OpenPOWER on IntegriCloud