summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/TGParser.h
Commit message (Collapse)AuthorAgeFilesLines
* [TableGen] Remove RecordVal constructor that takes a StringRef and ↵Craig Topper2017-06-011-1/+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: Some more std::string->StringInit* replacementsMatthias Braun2016-12-051-9/+3
| | | | llvm-svn: 288653
* TableGen/TGParser: Prefer SmallVector/ArrayRef over std::vectorMatthias Braun2016-12-051-12/+11
| | | | llvm-svn: 288649
* TableGen/Record: Replace std::vector with SmallVector/ArrayRefMatthias Braun2016-12-051-1/+3
| | | | llvm-svn: 288648
* TableGen: Use StringInit instead of std::string for DagInit arg namesMatthias Braun2016-12-051-1/+1
| | | | llvm-svn: 288644
* TableGen: Use StringRef instead of const std::string& for parametersMatthias Braun2016-12-041-4/+3
| | | | | | | | 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] Change TGParser::SetValue to take an ArrayRef instead of ↵Craig Topper2016-01-041-2/+2
| | | | | | std::vector reference. Use None in many places where a default constructed vector was being passed. NFC llvm-svn: 256726
* [TableGen] Fix a bug that caused the wrong name for a record built from a ↵Craig Topper2016-01-041-3/+6
| | | | | | | | | | | | multiclass containing a defm called NAME that references another multiclass that contains a defm that uses NAME concatenated with other strings. It would end up doing the concatenations from the second multiclass twice. This occured because SetValue detected a self assignment when trying to set the value of NAME to a VarInit called NAME. NAME is special here and it will get cleaned up later. So add a flag to suppress the self assignment check for this case. Strangely the self-assignment error was returning false indicating it wasn't an error, but it wasn't doing the right thing. So this also changes it to report an error. This fixes the names of some AVX512 FMA instructions that showed this double expansion. llvm-svn: 256725
* [TblGen] ArrayRefize TGParser. No functional change intended.Benjamin Kramer2015-10-241-10/+6
| | | | llvm-svn: 251186
* [TableGen] Resolve complex def names inside multiclassesHal Finkel2015-05-211-1/+3
| | | | | | | | | We had not been trying hard enough to resolve def names inside multiclasses that had complex concatenations, etc. Now we'll try harder. Patch by Amaury Sechet! llvm-svn: 237877
* Replace std::map<K, V*> with std::map<K, std::unique_ptr<V>> to handle ↵Craig Topper2014-12-111-1/+1
| | | | | | | | ownership and deletion of the values. Ideally we would store the MultiClasses by value directly in the maps, but I had some trouble with that before and this at least fixes the leak. llvm-svn: 223997
* Revert r222957 "Replace std::map<K, V*> with std::map<K, V> to handle ↵Craig Topper2014-11-301-1/+1
| | | | | | | | | | ownership and deletion of the values." Upon further review I think the MultiClass is being copied into the map instead of being moved due to the copy constructor on the nested Record type. This ultimately got exposed when the vector in DefPrototype vector was changed to hold unique_ptrs in another commit. This caused gcc 4.7 to fail due to the use of the copy constructor on unique_ptr with the error pointing back to one of the insert calls from this commit. Not sure why clang was able to build. This reverts commit 710cdf729f84b428bf41aa8d32dbdb35fff79fde. llvm-svn: 222971
* Replace std::map<K, V*> with std::map<K, V> to handle ownership and deletion ↵Craig Topper2014-11-291-1/+1
| | | | | | of the values. llvm-svn: 222957
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* Fix error in tablegen when either operand of !if is an empty list.Matt Arsenault2014-06-101-1/+1
| | | | | | !if([Something], []) would error with "No type for list". llvm-svn: 210572
* [C++] Use 'nullptr'.Craig Topper2014-04-281-6/+6
| | | | llvm-svn: 207394
* remove a bunch of unused private methodsNuno Lopes2014-03-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | found with a smarter version of -Wunused-member-function that I'm playwing with. Appologies in advance if I removed someone's WIP code. include/llvm/CodeGen/MachineSSAUpdater.h | 1 include/llvm/IR/DebugInfo.h | 3 lib/CodeGen/MachineSSAUpdater.cpp | 10 -- lib/CodeGen/PostRASchedulerList.cpp | 1 lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 10 -- lib/IR/DebugInfo.cpp | 12 -- lib/MC/MCAsmStreamer.cpp | 2 lib/Support/YAMLParser.cpp | 39 --------- lib/TableGen/TGParser.cpp | 16 --- lib/TableGen/TGParser.h | 1 lib/Target/AArch64/AArch64TargetTransformInfo.cpp | 9 -- lib/Target/ARM/ARMCodeEmitter.cpp | 12 -- lib/Target/ARM/ARMFastISel.cpp | 84 -------------------- lib/Target/Mips/MipsCodeEmitter.cpp | 11 -- lib/Target/Mips/MipsConstantIslandPass.cpp | 12 -- lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 21 ----- lib/Target/NVPTX/NVPTXISelDAGToDAG.h | 2 lib/Target/PowerPC/PPCFastISel.cpp | 1 lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 lib/Transforms/Instrumentation/BoundsChecking.cpp | 2 lib/Transforms/Instrumentation/MemorySanitizer.cpp | 1 lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 8 - lib/Transforms/Scalar/SCCP.cpp | 1 utils/TableGen/CodeEmitterGen.cpp | 2 24 files changed, 2 insertions(+), 261 deletions(-) llvm-svn: 204560
* [TableGen] Use the same anonymous name as the prefix on all multiclass defsHal Finkel2014-01-021-1/+1
| | | | | | | | | | | | | | | | TableGen had been generating a different name for an anonymous multiclass's NAME for every def in the multiclass. This had an unfortunate side effect: it was impossible to reference one def within the multiclass from another (in the parameter list, for example). By making sure we only generate an anonymous name once per multiclass (which, as it turns out, requires only changing the name parameter to reference type), we can now concatenate NAME within the multiclass with a def name in order to generate a reference to that def. This does not matter so much, in and of itself, but is necessary for a follow-up commit that will fix variable capturing in implicit anonymous multiclass defs (and that is important). llvm-svn: 198340
* TableGen: Generate valid identifiers for anonymous recordsAlp Toker2013-12-211-2/+6
| | | | | | | | | | Backends like OptParserEmitter assume that record names can be used as valid identifiers. The period '.' in generated anonymous names broke that assumption, causing a build-time error and in practice forcing all records to be named. llvm-svn: 197869
* tblgen: Diagnose duplicate includes.Sean Silva2013-02-071-1/+1
| | | | | | | | | | | | | | | A double inclusion will pretty much always be an error in TableGen, so there's no point going on just to die with "def already defined" or whatnot. I'm not too thrilled about the "public: ... private: ..." to expose the DependenciesMapTy, but I really didn't see a better way to keep that type centralized. It's a smell that indicates that some refactoring is needed to make this code more loosely coupled. This should avoid all bugs of the same nature as PR15189. llvm-svn: 174582
* TableGen: Keep track of superclass reference ranges.Jordan Rose2013-01-101-1/+1
| | | | | | | | | | def foo : bar; ~~~ This allows us to produce more precise diagnostics about a certain superclass, and even provide fixits. llvm-svn: 172085
* tblgen: Factor out common code.Sean Silva2013-01-091-0/+1
| | | | llvm-svn: 171951
* Inline this into its only caller.Sean Silva2013-01-091-1/+0
| | | | | | | | | | | It's clearer and additionally this gets rid of the usage of `DefmID`, which doesn't really correspond to anything in the language (it was just used in the name of this parsing function which parsed a `MultiClassID` and returned that multiclass's record). This area of the code still needs a lot of work. llvm-svn: 171938
* Sort includes for all of the .h files under the 'lib' tree. These wereChandler Carruth2012-12-041-2/+2
| | | | | | | | | | missed in the first pass because the script didn't yet handle include guards. Note that the script is now able to handle all of these headers without manual edits. =] llvm-svn: 169224
* tblgen: Whitespace and 80-col cleanup.Sean Silva2012-10-041-11/+12
| | | | llvm-svn: 165190
* Simplify TGParser::ProcessForEachDefs.Jakob Stoklund Olesen2012-05-241-11/+9
| | | | | | Use static type checking. llvm-svn: 157430
* Remove stray semi-colon.Daniel Dunbar2012-02-281-1/+1
| | | | llvm-svn: 151629
* Add Foreach LoopDavid Greene2012-02-221-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add some data structures to represent for loops. These will be referenced during object processing to do any needed iteration and instantiation. Add foreach keyword support to the lexer. Add a mode to indicate that we're parsing a foreach loop. This allows the value parser to early-out when processing the foreach value list. Add a routine to parse foreach iteration declarations. This is separate from ParseDeclaration because the type of the named value (the iterator) doesn't match the type of the initializer value (the value list). It also needs to add two values to the foreach record: the iterator and the value list. Add parsing support for foreach. Add the code to process foreach loops and create defs based on iterator values. Allow foreach loops to be matched at the top level. When parsing an IDValue check if it is a foreach loop iterator for one of the active loops. If so, return a VarInit for it. Add Emacs keyword support for foreach. Add VIM keyword support for foreach. Add tests to check foreach operation. Add TableGen documentation for foreach. Support foreach with multiple objects. Support non-braced foreach body with one object. Do not require types for the foreach declaration. Assume the iterator type from the iteration list element type. llvm-svn: 151164
* Process Defm Prefix as InitDavid Greene2011-10-191-1/+1
| | | | | | | Parse and process a defm prefix as an Init expression. This allows paste operations to create defm prefixes. llvm-svn: 142523
* Parse Def ID as ValueDavid Greene2011-10-191-1/+1
| | | | | | | Allow def and defm IDs to be general values. We need this for paste functionality. llvm-svn: 142522
* Make ID Parsing More FlexibleDavid Greene2011-10-191-4/+18
| | | | | | | | | | | | | | | | | | | Add a mode control to value and ID parsers. The two modes are: - Parse a value. Expect the parsed ID to map to an existing object. - Parse a name. Expect the parsed ID to not map to any existing object. The first is used when parsing an identifier to be looked up, for example a record field or template argument. The second is used for parsing declarations. Paste functionality implies that declarations can contain arbitrary expressions so we need to be able to call into the general value parser to parse declarations with paste operators. So we need a way to parse a value-like thing without expecting that the result will map to some existing object. This parse mode provides that. llvm-svn: 142519
* Make Template Arg Names InitsDavid Greene2011-10-191-2/+2
| | | | | | | | Allow template arg names to be Inits. This is further work to implement paste as it allows template names to participate in paste operations. llvm-svn: 142500
* Let SetValue Take and Init NameDavid Greene2011-10-191-1/+6
| | | | | | | Convert SetValue to take the value name as an Init. This allows us to set values for variables whose names are not yet fully resolved. llvm-svn: 142499
* Remove MultidefsDavid Greene2011-10-071-1/+0
| | | | | | | | | | | | | | | | | | | Multidefs are a bit unwieldy and incomplete. Remove them in favor of another mechanism, probably for loops. Revert "Make Test More Thorough" Revert "Fix a typo." Revert "Vim Support for Multidefs" Revert "Emacs Support for Multidefs" Revert "Document Multidefs" Revert "Add a Multidef Test" Revert "Update Test for Multidefs" Revert "Process Multidefs" Revert "Parser Multidef Support" Revert "Lexer Support for Multidefs" Revert "Add Multidef Data Structures" llvm-svn: 141378
* Parser Multidef SupportDavid Greene2011-10-051-0/+1
| | | | | | | | | | | | | | | Add parser support to recognize multidefs. No processing on the multidef is done at this point. The grammar is: MultiDef = MULTIDEF ObjectName < Value, Declaration, Value > ObjectBody The first Value must be resolveable to a list and the second Value must be resolveable to an integer. The Declaration is a temporary value used as an iterator to refer to list items during processing. It may be passed into the ObjectBody where it will be substituted with the list value used to instantiate each def. llvm-svn: 141232
* Refactor Multiclass Def ProcessingDavid Greene2011-10-051-0/+15
| | | | | | | | Move the code to instantiate a multiclass def, bind its arguments and resolve its members into three helper functions. These will be reused to support a new kind of multiclass def: a multidef. llvm-svn: 141229
* Move TableGen's parser and entry point into a libraryPeter Collingbourne2011-10-011-0/+122
This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951
OpenPOWER on IntegriCloud