summaryrefslogtreecommitdiffstats
path: root/llvm/utils
Commit message (Collapse)AuthorAgeFilesLines
* [TableGen] Cleanup capturing of instruction namespace for the fast isel ↵Craig Topper2017-07-071-11/+7
| | | | | | emitter to remove a std::string and duplicated code. NFC llvm-svn: 307363
* [TableGen] Use StringRef instead of std::string for CodeGenInstruction ↵Craig Topper2017-07-078-16/+16
| | | | | | namespace. NFC llvm-svn: 307362
* [TableGen] Fix some mismatches in the use of Namespace fields versus Target ↵Craig Topper2017-07-072-3/+3
| | | | | | | | | | | | name in some of our emitters. Some of our emitters were using the name of the Target to reference things that were created by others emitters using Namespace. Apparently all targets have the same Target name as their instruction and register Namespace field? Someone on IRC had a target that didn't do this and was getting build errors. This patch is a necessary, but maybe not sufficient fix. llvm-svn: 307358
* [lit] Modify LIT to accept environment variable LIT_FILTER to select tests.George Karpenkov2017-07-072-1/+7
| | | | | | | | | This is especially useful when lit is invoked indirectly by the build system, and additional arguments can not be easily specified. Differential Revision: https://reviews.llvm.org/D35091 llvm-svn: 307339
* [lit] Factor out some shell input/output redirection logic, NFCReid Kleckner2017-07-061-70/+97
| | | | | | | This is a very light refactoring aimed at improving readability. There is definitely still room for improvement here. llvm-svn: 307310
* [opt-viewer] Move under tools, install itAdam Nemet2017-07-066-872/+0
| | | | | | | | | | | | | | | | | | | | We weren't installing opt-viewer and co before, this fixes the omission. I am also moving the tools from utils/ to tools/. I believe that this is more appropriate since these tools have matured greatly in the past year through contributions by multiple people (thanks!) so they are ready to become external tools. The tools are installed under <install>/share/opt-viewer/. I am *not* adding the llvm- prefix. If people feel strongly about adding that, this is probably a good time since the new location will require some mental adjustment anyway. Fixes PR33521 Differential Revision: https://reviews.llvm.org/D35048 llvm-svn: 307285
* Fixes to Dockerfile scripts.Ilya Biryukov2017-07-061-4/+7
| | | | | | | | | | | - Put buildfiles into /tmp/clang-build/build, instead of /tmp/clang-build. We checkout the sources to /tmp/clang-build/src and running cmake in /tmp/clang-build was done by mistake. - Don't add an extra ';' at the start of enabled projects list. It worked either way, but looked strange. - Minor comment update. llvm-svn: 307258
* Made a script to build docker images easier to use.Ilya Biryukov2017-07-061-9/+45
| | | | | | | | | | | | | | | | | | Summary: - Removed double indirection via command-line args (i.e. two `--` options of `build_docker_image.sh`). - Added a comment on how to build 2-stage clang install into the `build_docker_image.sh`, it used to be only in the `docs/Docker.rst`. Reviewers: klimek, mehdi_amini Reviewed By: klimek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35050 llvm-svn: 307256
* [globalisel][tablegen] Rename and re-comment render functions to match the ↵Daniel Sanders2017-07-061-7/+7
| | | | | | | | | | new MatchTables. NFC. The conversion to MatchTable left the function names and comments referring to C++ statements and expressions. Updated the names and comments to account for the fact that they're no longer unconstrained statements/expressions. llvm-svn: 307248
* [globalisel][tablegen] Rename and re-comment to match the new MatchTables. NFC.Daniel Sanders2017-07-061-46/+47
| | | | | | | | The conversion to MatchTable left the function names and comments referring to C++ statements and expressions. Updated the names and comments to account for the fact that they're no longer unconstrained statements/expressions. llvm-svn: 307246
* [globalisel][tablegen] Import rules containing intrinsic_wo_chain.Daniel Sanders2017-07-061-4/+27
| | | | | | | | | | | | | | | | | Summary: As of this patch, 1018 out of 3938 rules are currently imported. Depends on D32275 Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar Reviewed By: qcolombet Subscribers: dberris, igorb, llvm-commits Differential Revision: https://reviews.llvm.org/D32278 llvm-svn: 307240
* [lit] Fix unit test discovery for Visual Studio builds.David L. Jones2017-07-061-1/+4
| | | | | | | | | | | | | | | | | | | | Fix by Andrew Ng! The Visual Studio build can contain output for multiple configuration types ( e.g. Debug, Release & RelWithDebInfo) within the same build output directory. Therefore when discovering unit tests, the "build mode" sub directory containing the appropriate configuration is included in the search. This sub directory may not always be present, so a test for its existence is required. Reviewers: zturner, modocache, dlj Reviewed By: zturner, dlj Subscribers: grimar, bd1976llvm, gbreynoo, edd, jhenderson, llvm-commits Differential Revision: https://reviews.llvm.org/D34976 llvm-svn: 307235
* [tablegen] Avoid creating temporary stringsAlexander Shaposhnikov2017-07-054-15/+10
| | | | | | | | | | | | | If a method / function returns a StringRef but the variable is of type const std::string& a temporary string is created (StringRef has a cast operator to std::string), which is a suboptimal behavior. Differential revision: https://reviews.llvm.org/D34994 Test plan: make check-all llvm-svn: 307195
* [globalisel][tablegen] Finish fixing compile-time regressions by merging the ↵Daniel Sanders2017-07-051-36/+26
| | | | | | | | | | | | | | | | | | | | | | | matcher and emitter state machines. Summary: Also, made a few minor tweaks to shave off a little more cumulative memory consumption: * All rules share a single NewMIs instead of constructing their own. Only one will end up using it. * Use MIs.resize(1) instead of MIs.clear();MIs.push_back(I) and prevent GIM_RecordInsn from changing MIs[0]. Depends on D33764 Reviewers: rovka, vitalybuka, ab, t.p.northover, qcolombet, aditya_nandakumar Reviewed By: ab Subscribers: kristof.beyls, igorb, llvm-commits Differential Revision: https://reviews.llvm.org/D33766 llvm-svn: 307159
* [AsmParser] Mnemonic Spell CorrectorSjoerd Meijer2017-07-051-0/+43
| | | | | | | | | | | | | | | | | | This implements suggesting other mnemonics when an invalid one is specified, for example: $ echo "adXd r1,r2,#3" | llvm-mc -triple arm <stdin>:1:1: error: invalid instruction, did you mean: add, qadd? adXd r1,r2,#3 ^ The implementation is target agnostic, but as a first step I have added it only to the ARM backend; so the ARM backend is a good example if someone wants to enable this too for another target. Differential Revision: https://reviews.llvm.org/D33128 llvm-svn: 307148
* [globalisel][tablegen] Fix the misuse of STATISTICS() on release builds ↵Daniel Sanders2017-07-051-4/+4
| | | | | | | | | | | | (like r307088) after r307133. r307133 brought back a couple instances of the same mistake that was already fixed by r307088. Fixed it again. Using NumPatternEmitted as a unique id for the tables is not valid on release builds since the counters don't count in that case. llvm-svn: 307146
* [globalisel][tablegen] Added instruction emission to the state-machine-based ↵Daniel Sanders2017-07-051-105/+105
| | | | | | | | | | | | | | | | | | | | | | | matcher. Summary: This further improves the compile-time regressions that will be caused by a re-commit of r303259. Also added included preliminary work in preparation for the multi-insn emitter since I needed to change the relevant part of the API for this patch anyway. Depends on D33758 Reviewers: rovka, vitalybuka, ab, t.p.northover, qcolombet, aditya_nandakumar Reviewed By: ab Subscribers: kristof.beyls, igorb, llvm-commits Differential Revision: https://reviews.llvm.org/D33764 llvm-svn: 307133
* [globalisel][tablegen] Fix release builds after r307079Daniel Sanders2017-07-041-2/+7
| | | | | | | | | Using NumPatternEmitted as a unique id for the tables is not valid on release builds since the counters don't count in that case. Also fix an unused variable warning. llvm-svn: 307088
* NFC. Removed mention of missing script from build_docker_image.sh.Ilya Biryukov2017-07-041-1/+3
| | | | llvm-svn: 307080
* [globalisel][tablegen] Partially fix compile-time regressions by converting ↵Daniel Sanders2017-07-041-156/+299
| | | | | | | | | | | | | | | | | | | | | | matcher to state-machine(s) Summary: Replace the matcher if-statements for each rule with a state-machine. This significantly reduces compile time, memory allocations, and cumulative memory allocation when compiling AArch64InstructionSelector.cpp.o after r303259 is recommitted. The following patches will expand on this further to fully fix the regressions. Reviewers: rovka, ab, t.p.northover, qcolombet, aditya_nandakumar Reviewed By: ab Subscribers: vitalybuka, aemerson, javed.absar, igorb, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D33758 llvm-svn: 307079
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-045-5/+5
| | | | llvm-svn: 307075
* [tablegen] Avoid creating a temporary vector in getInstructionCaseAlexander Shaposhnikov2017-07-041-8/+6
| | | | | | | | | | | | | Record::getValues returns ArrayRef which has a cast operator to std::vector, as a result a temporary vector is created if the type of the variable is const std::vector& that is suboptimal in this case. Differential revision: https://reviews.llvm.org/D34969 Test plan: make check-all llvm-svn: 307063
* Fixed argument parsing in docker scripts.Ilya Biryukov2017-07-031-0/+1
| | | | llvm-svn: 307031
* [lit] Factor out listdir logic shared by different test formats.David L. Jones2017-06-303-44/+58
| | | | | | | | | | | | | | | | | | | | Summary: The lit test formats use largely the same logic for discovering tests. There are some superficial differences in the logic, which seem reasonable enough to handle in a single routine. At a high level, the common goal is "look for files that end with one of these suffixes, and skip anything starting with a dot." The balance of the logic specific to ShTest and GoogleTest collapses quite a bit, so that getTestsInDirectory is only a couple of lines around a call to the new function. Reviewers: zturner, MatzeB, modocache Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D34855 llvm-svn: 306895
* Revert "[lit] Clean output directories before running tests."Zachary Turner2017-06-303-51/+39
| | | | | | | | | This reverts commit da6318a92fba793e4f2447ec478b001392d57d43. This is causing failures on some build bots due to what appears to be some kind of lit ordering dependency. llvm-svn: 306833
* [lit] Clean output directories before running tests.Zachary Turner2017-06-303-39/+51
| | | | | | | | | | | | | | | | | | Presently lit leaks files in the tests' output directories. Specifically, if a test creates output files, lit makes no effort to remove them prior to the next test run. This is problematic because it leads to false positives whenever a test passes because stale files were present. In general it is a source of flakiness that should be removed. This patch addresses this by building the list of all test directories that are part of the current run set, and then deleting those directories and recreating them anew. This gives each test a clean baseline to start from. Differential Revision: https://reviews.llvm.org/D34732 llvm-svn: 306832
* Added Dockerfiles to build clang from sources.Ilya Biryukov2017-06-309-0/+445
| | | | | | | | | | | | Reviewers: klimek, chandlerc, mehdi_amini Reviewed By: klimek, mehdi_amini Subscribers: mehdi_amini, jlebar, llvm-commits Differential Revision: https://reviews.llvm.org/D34197 llvm-svn: 306810
* Remove `inline` keyword from inline `classof` methodsSam Clegg2017-06-291-35/+35
| | | | | | | | | | | | | | | | | | | | | | The style guide states that the explicit `inline` should not be used with inline methods. classof is very common inline method with a fair amount on inconsistency: $ git grep classof ./include | grep inline | wc -l 230 $ git grep classof ./include | grep -v inline | wc -l 257 I chose to target this method rather the larger change since this method is easily cargo-culted (I did it at least once). I considered doing the larger change and removing all occurrences but that would be a much larger change. Differential Revision: https://reviews.llvm.org/D33906 llvm-svn: 306731
* [opt-viewer] Add progress indicators (PR33522)Brian Gesiak2017-06-295-44/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Provide feedback to users of opt-diff.py, opt-stats.py, and opt-viewer.py, on how many YAML files have finished being processed, and how many HTML files have been generated. This feedback is particularly helpful for opt-viewer.py, which may take a long time to complete when given many large YAML files as input. The progress indicators use simple output such as the following: ``` Reading YAML files... 9 of 1197 ``` Test plan: Run `utils/opt-viewer/opt-*.py` on a CentOS and macOS machine, using Python 3.4 and Python 2.7 respectively, and ensure the output is formatted well on both. Reviewers: anemet, davidxl Reviewed By: anemet Subscribers: simon.f.whittaker, llvm-commits Differential Revision: https://reviews.llvm.org/D34735 llvm-svn: 306726
* [opt-viewer] Python 3 support in opt-viewer.pyBrian Gesiak2017-06-292-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Minor changes that allow opt-stats.py to support both Python 2 and 3. In addition to the same dictionary iterator changes that were necessary in https://reviews.llvm.org/D34564, this diff also: * Explcitly converts strings to bytes when reading from and writing to stdin and stdout. * No longer uses dictionaries as a sort key for optimization remarks. Dictionary sort order in Python 2 is pretty esoteric anyway, so it's not clear that the additional sorting had a benefit for end users (for details, https://stackoverflow.com/a/3484456/679254 is a good resource on Python 2 dictionary sort order). Reviewers: anemet, davidxl Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34647 llvm-svn: 306720
* [opt-viewer] opt-viewer.py takes -o argumentBrian Gesiak2017-06-291-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Change how the output directory is specified when invoking opt-viewer.py, from `opt-viewer.py yaml_file_one yaml_file_two output_dir` to `opt-viewer.py -o output_dir yaml_file_one yaml_file_two`. This makes it easier to pipe the results of another command into opt-viewer.py. For example: ``` find . -name "*.yaml" -print | xargs /path/to/opt-viewer.py -o html ``` Reviewers: anemet, davidxl Reviewed By: anemet Subscribers: fhahn, llvm-commits Differential Revision: https://reviews.llvm.org/D34711 llvm-svn: 306694
* [lit] Re-apply: Fix some convoluted logic around Unicode encoding, and ↵David L. Jones2017-06-292-51/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | de-duplicate across modules that used it. (Take 2: this patch re-applies r306625, which was reverted in r306629. This patch includes only trivial fixes.) In Python2 and Python3, the various (non-)?Unicode string types are sort of spaghetti. Python2 has unicode support tacked on via the 'unicode' type, which is distinct from 'str' (which are bytes). Python3 takes the "unicode-everywhere" approach, with 'str' representing a Unicode string. Both have a 'bytes' type. In Python3, it is the only way to represent raw bytes. However, in Python2, 'bytes' is an alias for 'str'. This leads to interesting problems when an interface requires a precise type, but has to run under both Python2 and Python3. The previous logic appeared to be correct in all cases, but went through more layers of indirection than necessary. This change does the necessary conversions in one shot, with documentation about which paths might be taken in Python2 or Python3. Changes from r306625: some tests just print binary outputs, so in those cases, fall back to str() in Python3. For googletests, add one missing call to to_string(). (Tested by verifying the visible breakage with Python3. Verified that everything works in py2 and py3.) llvm-svn: 306643
* Revert "[lit] Fix some convoluted logic around Unicode encoding, and ↵David L. Jones2017-06-292-62/+51
| | | | | | | | de-duplicate across modules that used it." This reverts r306625. llvm-svn: 306629
* Fix spelling: uncode -> unicode.David L. Jones2017-06-291-1/+1
| | | | | | | Remember kids: there is no 'I' in str or bytes, but there is ALWAYS an 'I' in unicode. llvm-svn: 306626
* [lit] Fix some convoluted logic around Unicode encoding, and de-duplicate ↵David L. Jones2017-06-292-51/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | across modules that used it. Summary: In Python2 and Python3, the various (non-)?Unicode string types are sort of spaghetti. Python2 has unicode support tacked on via the 'unicode' type, which is distinct from 'str' (which are bytes). Python3 takes the "unicode-everywhere" approach, with 'str' representing a Unicode string. Both have a 'bytes' type. In Python3, it is the only way to represent raw bytes. However, in Python2, 'bytes' is an alias for 'str'. This leads to interesting problems when an interface requires a precise type, but has to run under both Python2 and Python3. The previous logic appeared to be correct in all cases, but went through more layers of indirection than necessary. This change does the necessary conversions in one shot, with documentation about which paths might be taken in Python2 or Python3. Reviewers: zturner, modocache Subscribers: llvm-commits, sanjoy Differential Revision: https://reviews.llvm.org/D34793 llvm-svn: 306625
* [lit] Remove dead code not referenced in the LLVM SVN repo.David L. Jones2017-06-293-120/+90
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change removes the intermediate 'FileBasedTest' format from lit. This format is only ever used by the ShTest format, so the logic can be moved into ShTest directly. In order to better clarify what the TestFormat subclasses do, I fleshed out the TestFormat base class with Python's notion of abstract methods, using @abc.abstractmethod. This gives a convenient way to document the expected interface, without the risk of instantiating an abstract class (that's what ABCMeta does -- it raises an exception if you try to instantiate a class which has abstract methods, but not if you instantiate a subclass that implements them). Reviewers: zturner, modocache Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D34792 llvm-svn: 306623
* [lit] Remove dead code (not referenced anywhere), and clarify some function ↵David L. Jones2017-06-281-177/+41
| | | | | | | | | | | | | | | | | | | | | | | names. Summary: The dead code seems to be unreferenced, according to textual search across the LLVM SVN repo. The clarification part of this change alters the name of a module-level function so that it is different from the name of the class-methods that call it. Currently, there are no erroneous references, but stylistically (c.f. PEP-8), internal "helper" functions should generally be named accordingly by prepending an underscore. (I also chose to add '_impl', which isn't necessary, but helps me at least to mentally disambiguate the interface and implementation functions.) Reviewers: zturner, modocache Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D34775 llvm-svn: 306600
* Break up long lines, NFCKrzysztof Parzyszek2017-06-281-2/+4
| | | | llvm-svn: 306585
* [globalisel][tablegen] Post-commit review nits for r306388. NFCDaniel Sanders2017-06-281-37/+31
| | | | | | One early exit and a missing assert string. llvm-svn: 306552
* [globalisel][tablegen] Multiple 80-col corrections.Daniel Sanders2017-06-281-20/+41
| | | | llvm-svn: 306544
* [TableGen] Improve Debug Output for --debug-only=subtarget-emitter NFCIJoel Jones2017-06-282-0/+8
| | | | | | | | | Add headers for each section of output, with white space and "+++" to improve readability. Differential Revision: https://reviews.llvm.org/D34713 llvm-svn: 306492
* [opt-viewer] Python 3 support in opt-diff.pyBrian Gesiak2017-06-271-2/+2
| | | | | | | | | | | | | | | | Summary: The `file()` builtin is not available in Python 3; use `open()` instead. https://docs.python.org/3.0/whatsnew/3.0.html#builtins Reviewers: anemet, davidxl, davide Reviewed By: davide Subscribers: davide, fhahn, llvm-commits Differential Revision: https://reviews.llvm.org/D34670 llvm-svn: 306423
* Change sort function used in tblgen to be strict weak orderingDavid Green2017-06-271-1/+1
| | | | | | | The windows debug is failing as the sort function is not strict weak ordering, so switch a >= to a >. llvm-svn: 306422
* [globalisel][tablegen] Add support for EXTRACT_SUBREG.Daniel Sanders2017-06-273-10/+236
| | | | | | | | | | | | | | | | Summary: After this patch, we finally have test cases that require multiple instruction emission. Depends on D33590 Reviewers: ab, qcolombet, t.p.northover, rovka, kristof.beyls Subscribers: javed.absar, llvm-commits, igorb Differential Revision: https://reviews.llvm.org/D33596 llvm-svn: 306388
* [TableGen] Fix bug in TableGen CodeGenPatterns when adding variants of the ↵Ayman Musa2017-06-271-2/+2
| | | | | | | | | | | | | | | | | patterns. All patterns reside in a std::vector container, where new variants are added to it using the standard library's emplace_back function. When calling this with a new element while there is no enough allocated space, a bigger space is allocated and all the old info in the small vector is copied to the newly allocated vector, then the old vector is freed. The problem is that before doing this "copying", we take a reference of one of the elements in the old vector, and after the "copying" we add it to the new vector. As the old vector is freed after the copying, the reference now does not point to a valid element. Added new function to the API of CodeGenDAGPatterns class to return the same information as a copy in order to avoid this issue. This was revealed in rL305465 that added many patterns and forced the reallocation of the vector which caused crashes in windows bots. Differential Revision: https://reviews.llvm.org/D34341 llvm-svn: 306371
* [opt-viewer] Python 3 support in opt-stats.pyBrian Gesiak2017-06-262-4/+22
| | | | | | | | | | | | | | Summary: Minor changes that allow opt-stats.py to support both Python 2 and 3. Reviewers: anemet, davidxl Reviewed By: anemet Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34564 llvm-svn: 306306
* [TableGen] Remove some copies around PatternToMatch.Craig Topper2017-06-252-16/+14
| | | | | | | | | | | | | | | | | | | Summary: This patch does a few things that should remove some copies around PatternsToMatch. These were noticed while reviewing code for D34341. Change constructor to take Dstregs by value and move it into the class. Change one of the callers to add std::move to the argument so that it gets moved. Make AddPatternToMatch take PatternToMatch by rvalue reference so we can move it into the PatternsToMatch vector. I believe we should have a implicit default move constructor available on PatternToMatch. I chose rvalue reference because both callers call it with temporaries already. Reviewers: RKSimon, aymanmus, spatel Reviewed By: aymanmus Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34411 llvm-svn: 306251
* [opt-viewer] Remove positional arg checks (NFC)Brian Gesiak2017-06-232-8/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: opt-stats.py and opt-viewer.py's argument parsers both take a positional argument 'yaml_files'. Positional arguments in Python's argparse module are required by default, so the subsequent checks for `len(args.yaml_files) == 0` are unnecessary -- if the length was zero, then the call to `parser.parse_args()` would have thrown an error already. Because there is no way for `len(args.yaml_files)` to be zero at these points, removing the code is NFC. Reviewers: anemet, davidxl Reviewed By: anemet Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34567 llvm-svn: 306147
* [TableGen] Take a parameter by reference instead of pointer so we don't have ↵Craig Topper2017-06-201-4/+4
| | | | | | to add & on both callers. NFC llvm-svn: 305807
* [TableGen] Use range based for loop. NFCCraig Topper2017-06-201-3/+1
| | | | llvm-svn: 305806
OpenPOWER on IntegriCloud