summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "TableGen: Fix typeIsConvertibleTo for record types"Nicolai Haehnle2018-02-232-16/+15
| | | | | | | | | | This reverts r325884. Clang's TableGen has dependencies on the exact ordering of superclasses. Revert this change fully for now to fix the build. Change-Id: Ib297f5571cc7809f00838702ad7ab53d47335b26 llvm-svn: 325891
* TableGen: Avoid using resolveListElementReference in TGParserNicolai Haehnle2018-02-231-1/+1
| | | | | | | | | | | | | | | | | A subsequent change intends to remove resolveListElementReference entirely. This part of the removal can be split out for better bisectability. Change-Id: Ibd762d88fd2d1e2cc116a259e2a27a5e9f9a8b10 Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43561 Change-Id: Ifb695041cef1964ad8a3102f448249501a9243f0 llvm-svn: 325886
* TableGen: Fix typeIsConvertibleTo for record typesNicolai Haehnle2018-02-232-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Only check whether the left-hand side type is a subclass (or equal to) the right-hand side type. This requires a further fix in handling !if expressions and in type resolution. Furthermore, reverse the order of superclasses so that resolveTypes will find a least common ancestor at least in simple cases. Add a test that used to be accepted without flagging the obvious type error. Change-Id: Ib366db1a4e6a079f1a0851e469b402cddae76714 Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43559 llvm-svn: 325884
* TableGen: Add !size operationNicolai Haehnle2018-02-234-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Returns the size of a list. I have found this to be rather useful in some development for the AMDGPU backend where we could simplify our .td files by concatenating list<LLVMType> for complex intrinsics. Doing so requires us to compute the position argument for LLVMMatchType. Basically, the usage is in a pattern that looks somewhat like this: list<LLVMType> argtypes = !listconcat(base, [llvm_any_ty, LLVMMatchType<!size(base)>]); Change-Id: I360a0b000fd488d18bea412228230fd93722bd2c Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits, tpr Differential Revision: https://reviews.llvm.org/D43553 llvm-svn: 325883
* TableGen: Add strict assertions to sanity check earlier type checkingNicolai Haehnle2018-02-221-0/+3
| | | | | | | | | | | | | | | | Summary: Both of these errors should have been caught by type-checking during parsing. Change-Id: I891087936fd1a91d21bcda57c256e3edbe12b94d Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43558 llvm-svn: 325800
* TableGen: Allow implicit casting between string and codeNicolai Haehnle2018-02-221-0/+14
| | | | | | | | | | | | | | | | | | | | | Summary: Perhaps the distinction between the two should be removed entirely in the long term, and the [{ ... }] syntax should just be a convenient way of writing multi-line strings. In the meantime, a lot of existing .td files are quite relaxed about string vs. code, and this change allows switching on more consistent type checks without breaking those. Change-Id: If85e3e04469e41b58e2703b62ac0032d2711713c Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43557 llvm-svn: 325799
* TableGen: Fix type of resolved and converted listsNicolai Haehnle2018-02-221-16/+15
| | | | | | | | | | | | | | | | | Summary: There are no new test cases, but a subsequent patch will introduce assertions that would be triggered by existing test cases without this fix. Change-Id: I6a82d4b311b012aff3932978ae86f6a2dcfbf725 Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43556 llvm-svn: 325798
* TableGen: Fix type deduction for !foreachNicolai Haehnle2018-02-221-0/+8
| | | | | | | | | | | | | | | | | Summary: In the case of !foreach(id, input-list, transform) where the type of input-list is list<A> and the type of transform is B, we now correctly deduce list<B> as the type of the !foreach. Change-Id: Ia19dd65eecc5991dd648280ba6a15f6a20fd61de Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43555 llvm-svn: 325797
* TableGen: Generalize type deduction for !listconcatNicolai Haehnle2018-02-221-3/+1
| | | | | | | | | | | | | | | Summary: This way, it should work even with complex operands. Change-Id: Iaccf5bbb50bd5882a0ba5d59689e4381315fb361 Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43554 llvm-svn: 325796
* TableGen: Add some more helpful error messagesNicolai Haehnle2018-02-221-5/+9
| | | | | | | | | | | | | Summary: Some fairly simple changes to start with. Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43552 Change-Id: I0c92731b36d309c6edfcae42595ae1a70cc051c9 llvm-svn: 325795
* [tablegen] Fixed few !foreach evaluation issues.Artem Belevich2018-02-091-41/+26
| | | | | | | | | | | | | | * !foreach on lists didn't evaluate operands of the RHS operator. This made nested operators silently fail. * A typo in the code could result in a wrong value substituted for an operation which produced a false '!foreach requires an operator' error. * Keep recursion over the DAG within ForeachHelper. This simplifies things a bit as we no longer need to pass the Type around in order to prevent recursion. Differential Revision: https://reviews.llvm.org/D43083 llvm-svn: 324758
* [TblGen] Inline an (almost) trivial accessor. No functionality change.Benjamin Kramer2018-01-231-4/+0
| | | | llvm-svn: 323276
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-1/+1
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* [TableGen] Give the option of tolerating duplicate register namesAlex Bradbury2017-12-071-11/+14
| | | | | | | | | | | | | | | | | | A number of architectures re-use the same register names (e.g. for both 32-bit FPRs and 64-bit FPRs). They are currently unable to use the tablegen'erated MatchRegisterName and MatchRegisterAltName, as tablegen (when built with asserts enabled) will fail. When the AllowDuplicateRegisterNames in AsmParser is set, duplicated register names will be tolerated. A backend can then coerce registers to the desired register class by (for instance) implementing validateTargetOperandClass. At least the in-tree Sparc backend could benefit from this, as does RISC-V (single and double precision floating point registers). Differential Revision: https://reviews.llvm.org/D39845 llvm-svn: 320018
* [globalisel][regbank] Warn about MIR ambiguities when register bank/class ↵Daniel Sanders2017-11-011-0/+4
| | | | | | names clash. llvm-svn: 317132
* Reverting r315590; it did not include changes for llvm-tblgen, which is ↵Aaron Ballman2017-10-152-6/+6
| | | | | | | | causing link errors for several people. Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1 llvm-svn: 315854
* [dump] Remove NDEBUG from test to enable dump methods [NFC]Don Hinton2017-10-122-6/+6
| | | | | | | | | | | | | | | Summary: Add LLVM_FORCE_ENABLE_DUMP cmake option, and use it along with LLVM_ENABLE_ASSERTIONS to set LLVM_ENABLE_DUMP. Remove NDEBUG and only use LLVM_ENABLE_DUMP to enable dump methods. Move definition of LLVM_ENABLE_DUMP from config.h to llvm-config.h so it'll be picked up by public headers. Differential Revision: https://reviews.llvm.org/D38406 llvm-svn: 315590
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-2/+2
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* Untabify.NAKAMURA Takumi2017-08-281-1/+1
| | | | llvm-svn: 311875
* [BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and ↵Eugene Zelenko2017-06-162-24/+39
| | | | | | Include What You Use warnings; other minor fixes (NFC). llvm-svn: 305537
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [TableGen] Remove RecordVal constructor that takes a StringRef and ↵Craig Topper2017-06-013-11/+6
| | | | | | | | Record::setName(StringRef). Leave just the versions that take an Init. They weren't used often enough to justify having two different interfaces. Push the responsiblity of creating a StringInit up to the caller. llvm-svn: 304388
* [TableGen] Make Record::getValueAsString and getValueAsListOfStrings return ↵Craig Topper2017-05-311-3/+3
| | | | | | | | | | | | StringRefs instead of std::string Internally both these methods just return the result of getValue on either a StringInit or a CodeInit object. In both cases this returns a StringRef pointing to a string allocated in the BumpPtrAllocator so its not going anywhere. So we can just pass that StringRef along. This is a fairly naive patch that targets just the build failures caused by this change. There's additional work that can be done to avoid creating std::string at call sites that still think getValueAsString returns a std::string. I'll try to clean those up in future patches. Differential Revision: https://reviews.llvm.org/D33710 llvm-svn: 304325
* [TableGen] Make one of RecordVal's constructors delegate to the other to ↵Craig Topper2017-05-311-6/+0
| | | | | | reduce duplicate code. llvm-svn: 304280
* [TableGen] Use StringMap instead of DenseMap<StringRef> to unique CodeInit ↵Craig Topper2017-05-291-16/+10
| | | | | | | | and StringInit objects. Override the allocator to keep using the BumpPtrAllocator. NFCI StringMap is better suited to mapping strings than a DenseMap. llvm-svn: 304178
* [TableGen] Introduce DagInit::getArgs that returns an ArrayRef. Use it to ↵Craig Topper2017-05-291-1/+1
| | | | | | fix 80 column violations in arg_begin/arg_end. Remove DagInit::args and use getArgs instead. NFC llvm-svn: 304177
* [TableGen] Prevent DagInit from leaking its Args and ArgNames when they ↵Craig Topper2017-05-271-11/+16
| | | | | | | | | | exceed the size of the SmallVector. DagInits are allocated in a BumpPtrAllocator so they are never destructed. This means the destructor for the SmallVector never runs. To fix this we now allocate the vectors in the BumpPtrAllocator too using TrailingObjects. llvm-svn: 304077
* [TableGen] Remove all the static vectors named TheActualPool.Craig Topper2017-05-271-12/+0
| | | | | | These used to hold std::unique_ptrs that managed the allocation for the various *Init object so that they would be deleted on exit. Everything is allocated in a BumpPtrAllocator name so there is no reason for these to still exist. llvm-svn: 304066
* Use print() instead of dump() in codeMatthias Braun2017-01-281-0/+2
| | | | | | | The dump() functions are meant to be used in a debugger, code should typically use something like print(errs()); llvm-svn: 293365
* Cleanup dump() functions.Matthias Braun2017-01-282-1/+11
| | | | | | | | | | | | | | | | | | We had various variants of defining dump() functions in LLVM. Normalize them (this should just consistently implement the things discussed in http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html For reference: - Public headers should just declare the dump() method but not use LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - The definition of a dump method should look like this: #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MyClass::dump() { // print stuff to dbgs()... } #endif llvm-svn: 293359
* [Hexagon, TableGen] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-01-041-7/+12
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 290925
* [TableGen] Centralize/Unify error handling.Davide Italiano2016-12-051-23/+21
| | | | llvm-svn: 288724
* TableGen: Some more std::string->StringInit* replacementsMatthias Braun2016-12-053-37/+27
| | | | llvm-svn: 288653
* TableGen: TableGenStringKey is no longer necessary as of r288642Matthias Braun2016-12-051-55/+0
| | | | llvm-svn: 288651
* TableGen: Use range based for; reserve vectors where possibleMatthias Braun2016-12-051-18/+23
| | | | llvm-svn: 288650
* TableGen/TGParser: Prefer SmallVector/ArrayRef over std::vectorMatthias Braun2016-12-052-68/+81
| | | | llvm-svn: 288649
* TableGen/Record: Replace std::vector with SmallVector/ArrayRefMatthias Braun2016-12-053-38/+42
| | | | llvm-svn: 288648
* ListInit::convertInitializerTo: avoid foldingset lookup if nothing changedMatthias Braun2016-12-051-4/+13
| | | | llvm-svn: 288647
* TableGen: Use StringInit instead of std::string for DagInit arg namesMatthias Braun2016-12-053-21/+22
| | | | llvm-svn: 288644
* TableGen: Use StringInit instead of std::string for DagInit nameMatthias Braun2016-12-052-10/+10
| | | | llvm-svn: 288643
* TableGen: Use more StringInit instead of StringRefMatthias Braun2016-12-052-27/+25
| | | | | | | | This forces the code to call StringInit::get on the string early and avoids storing duplicates in std::string and sometimes allows pointer comparisons instead of string comparisons. llvm-svn: 288642
* TableGen: Factor out STRCONCAT constructor, add shortcut.Matthias Braun2016-12-051-26/+25
| | | | | | | | Introduce new constructor for STRCONCAT binop with a shortcut that immediately concatenates if the two arguments are StringInits. Makes the QualifyName code more readable and tablegen 2-3% faster. llvm-svn: 288639
* TableGen/Record: Move PointerIntPair to less used field of RecordValMatthias Braun2016-12-051-4/+4
| | | | llvm-svn: 288638
* TableGen: Store Records on a BumpPtrAllocatorMatthias Braun2016-12-041-56/+70
| | | | | | | All these records are internalized and will live until exit. This makes them perfect candidates for a fast BumpPtrAllocator. llvm-svn: 288613
* TableGen: Use StringRef instead of const std::string& in return vals.Matthias Braun2016-12-041-5/+5
| | | | | | | This will allow to switch to a different string storage in an upcoming commit. llvm-svn: 288612
* TableGen: Optimize common string concatenation with SmallStringMatthias Braun2016-12-041-2/+7
| | | | llvm-svn: 288611
* TableGen: Use StringRef instead of const std::string& for parametersMatthias Braun2016-12-043-24/+20
| | | | | | | | This avoid an extra construction of a std::string (and a heap allocation) when the caller only has a StringRef but no std::string at hand. llvm-svn: 288610
* TableGen: Add operator !orMatt Arsenault2016-11-154-2/+9
| | | | llvm-svn: 286936
* Fix some Clang-tidy modernize-use-using and Include What You Use warnings; ↵Eugene Zelenko2016-08-233-33/+34
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D23789 llvm-svn: 279535
* Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-1/+1
| | | | | | Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
OpenPOWER on IntegriCloud