summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Record.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* TableGen: Add !size operationNicolai Haehnle2018-02-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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] 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
* Reverting r315590; it did not include changes for llvm-tblgen, which is ↵Aaron Ballman2017-10-151-5/+5
| | | | | | | | 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-121-5/+5
| | | | | | | | | | | | | | | 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
* Untabify.NAKAMURA Takumi2017-08-281-1/+1
| | | | llvm-svn: 311875
* [BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and ↵Eugene Zelenko2017-06-161-19/+24
| | | | | | Include What You Use warnings; other minor fixes (NFC). llvm-svn: 305537
* [TableGen] Remove RecordVal constructor that takes a StringRef and ↵Craig Topper2017-06-011-6/+1
| | | | | | | | 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
* Cleanup dump() functions.Matthias Braun2017-01-281-0/+10
| | | | | | | | | | | | | | | | | | 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
* TableGen: Some more std::string->StringInit* replacementsMatthias Braun2016-12-051-2/+2
| | | | 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/Record: Replace std::vector with SmallVector/ArrayRefMatthias Braun2016-12-051-27/+28
| | | | 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-051-12/+12
| | | | llvm-svn: 288644
* TableGen: Use StringInit instead of std::string for DagInit nameMatthias Braun2016-12-051-8/+8
| | | | llvm-svn: 288643
* TableGen: Use more StringInit instead of StringRefMatthias Braun2016-12-051-17/+10
| | | | | | | | 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-041-18/+16
| | | | | | | | 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-151-0/+3
| | | | llvm-svn: 286936
* Fix some Clang-tidy modernize-use-using and Include What You Use warnings; ↵Eugene Zelenko2016-08-231-13/+10
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D23789 llvm-svn: 279535
* [TableGen] Autobrief-ize Record. NFC.Ahmed Bougacha2016-07-141-2/+2
| | | | llvm-svn: 275425
* [TableGen] Cleanup Record comments. NFC.Ahmed Bougacha2016-07-141-65/+1
| | | | | | | LLVM doesn't use exceptions anymore. Also remove the implementation comments. Some of them diverged. llvm-svn: 275424
* TableGen: promote "code" type from syntactic sugar.Tim Northover2016-07-051-0/+25
| | | | | | | It's being immediately converted to a "string", but being able to tell what type the field was originally can be useful in backends. llvm-svn: 274575
* Avoid copies of std::strings and APInt/APFloats where we only read from itBenjamin Kramer2016-06-081-1/+1
| | | | | | | | As suggested by clang-tidy's performance-unnecessary-copy-initialization. This can easily hit lifetime issues, so I audited every change and ran the tests under asan, which came back clean. llvm-svn: 272126
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-6/+6
| | | | | | | | r259192 post commit comment. clang part in r259232, this is the LLVM part of the patch. llvm-svn: 259240
* [TableGen] Use FoldingSets instead of DenseMaps to unique UnOpInit, ↵Craig Topper2016-01-181-39/+79
| | | | | | BinOpInit and TernOpInit. This remove the memory needed to store the key for the DenseMap. NFC llvm-svn: 258071
* [TableGen] Fix an assert I missed in r258063.Craig Topper2016-01-181-1/+1
| | | | llvm-svn: 258068
* [TableGen] Merge the SuperClass Record and SMRange vector into a single ↵Craig Topper2016-01-181-9/+9
| | | | | | vector. This removes the state needed to manage the extra vector thus reducing the size of the Record class. NFC llvm-svn: 258065
* [TableGen] Allocate the Init pointer array for BitsInit/ListInit after the ↵Craig Topper2016-01-181-8/+14
| | | | | | BitsInit/ListInit object itself. Saves a bit of memory. NFC llvm-svn: 258063
* [TableGen] Use some free space in Init to store the opcode for ↵Craig Topper2016-01-041-4/+4
| | | | | | UnOpInit/BinOpInit/TernOpInit allowing those types to be a little smaller. NFC llvm-svn: 256733
* [TblGen] ArrayRefize TGParser. No functional change intended.Benjamin Kramer2015-10-241-1/+1
| | | | llvm-svn: 251186
* TableGen: Support folding casts from bits to intMatt Arsenault2015-07-311-0/+8
| | | | | | | | | | | | | | | This is to fix an incorrect error when trying to initialize DwarfNumbers with a !cast<int> of a bits initializer. getValuesAsListOfInts("DwarfNumbers") would not see an IntInit and instead the cast, so would give up. It seems likely that this could be generalized to attempt the convertInitializerTo for any type. I'm not really sure why the existing code seems to special case the string cast cases when convertInitializerTo seems like it should generally handle this sort of thing. llvm-svn: 243722
* [TableGen] Change a couple methods to return an ArrayRef instead of a const ↵Craig Topper2015-07-061-1/+1
| | | | | | std::vector reference. NFC llvm-svn: 241430
* [TableGen] Restore the use of the TheInit field in Record to cache the ↵Craig Topper2015-06-241-7/+3
| | | | | | Record's DefInit. I broke this when I fixed memory leaks recently. Remove the DenseMap that mapped Record's to DefInit. llvm-svn: 240524
* [TableGen] Change OpInit::getNumOperands and getOperand to use unsigned ↵Craig Topper2015-06-061-2/+2
| | | | | | integers. NFC llvm-svn: 239210
* [TableGen] Remove trailing whitespace, add space between 'if' and paren, ↵Craig Topper2015-06-061-16/+16
| | | | | | other formatting fixes. NFC llvm-svn: 239209
OpenPOWER on IntegriCloud