summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/TGParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Print out the location of expanded multiclass defs in TableGen errors.Jakob Stoklund Olesen2012-08-221-1/+4
| | | | | | | | | | | | | | | | | | | When reporting an error for a defm, we would previously only report the location of the outer defm, which is not always where the error is. Now we also print the location of the expanded multiclass defs: lib/Target/X86/X86InstrSSE.td:2902:12: error: foo defm ADD : basic_sse12_fp_binop_s<0x58, "add", fadd, SSE_ALU_ITINS_S>, ^ lib/Target/X86/X86InstrSSE.td:2801:11: note: instantiated from multiclass defm PD : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"), OpNode, VR128, ^ lib/Target/X86/X86InstrSSE.td:194:5: note: instantiated from multiclass def rm : PI<opc, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2), ^ llvm-svn: 162409
* TableGen: Allow use of #NAME# outside of 'def' names.Jim Grosbach2012-08-021-11/+21
| | | | | | | | | | | | | | | | | | | | | Previously, def NAME values were only populated, and references to NAME resolved, when NAME was referenced in the 'def' entry of the multiclass sub-entry. e.g., multiclass foo<...> { def prefix_#NAME : ... } It's useful, however, to be able to reference NAME even when the default def name is used. For example, when a multiclass has 'def : Pat<...>' or 'def : InstAlias<...>' entries which refer to earlier instruction definitions in the same multiclass. e.g., multiclass myMulti<RegisterClass rc> { def _r : myI<(outs rc:$d), (ins rc:$r), "r $d, $r", []>; def : InstAlias<\"wilma $r\", (!cast<Instruction>(NAME#\"_r\") rc:$r, rc:$r)>; } llvm-svn: 161198
* Add support for range expressions in TableGen foreach loops.Jakob Stoklund Olesen2012-05-241-15/+50
| | | | | | | | | | | | Like this: foreach i = 0-127 in ... Use braces for composite ranges: foreach i = {0-3,9-7} in ... llvm-svn: 157432
* Don't put TGParser scratch results in the output.Jakob Stoklund Olesen2012-05-241-2/+2
| | | | | | Only fully expanded Records should go into RecordKeeper. llvm-svn: 157431
* Simplify TGParser::ProcessForEachDefs.Jakob Stoklund Olesen2012-05-241-92/+63
| | | | | | Use static type checking. llvm-svn: 157430
* Add Foreach LoopDavid Greene2012-02-221-2/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-4/+4
| | | | llvm-svn: 149967
* Fix Record Name ReferenceDavid Greene2012-01-281-1/+1
| | | | | | Get the record name though the init to avoid an assert. llvm-svn: 149153
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-5/+0
| | | | llvm-svn: 148578
* TblGen diagnostic for mismatched template instantiation.Jim Grosbach2012-01-201-0/+4
| | | | | | | | | | | | | | | | | | Providing a template argment to a non-templatized class was crashing tblgen. Add a diagnostic. For example, $ cat bug.td class A; def B : A<0> { } $ llvm-tblgen bug.td bug.td:3:11: error: template argument provided to non-template class def B : A<0> { ^ llvm-svn: 148565
* Delete CodeInit and CodeRecTy from TableGen.Jakob Stoklund Olesen2012-01-131-3/+3
| | | | | | | The code type was always identical to a string anyway. Now it is simply a synonym. The code literal syntax [{...}] is still valid. llvm-svn: 148092
* Use uniqued StringInit pointers for lookups.Jakob Stoklund Olesen2012-01-131-1/+1
| | | | | | | This avoids a gazillion StringMap and dynamic_cast calls, making TableGen run 3x faster. llvm-svn: 148091
* Check for error after InstantiateMultclassDef.Jim Grosbach2011-12-021-0/+2
| | | | llvm-svn: 145689
* Implement PasteDavid Greene2011-10-191-22/+60
| | | | | | | | | | | | | | Add a paste operator '#' to take two identifier-like strings and joint them. Internally paste gets represented as a !strconcat() with any necessary casts to string added. This will be used to implement basic for loop functionality as in: for i = [0, 1, 2, 3, 4, 5, 6, 7] { def R#i : Register<...> } llvm-svn: 142525
* Process NAMEDavid Greene2011-10-191-8/+35
| | | | | | | During multiclass def instantiation, replace NAME in any expressions with the value of the def or defm ID. llvm-svn: 142524
* Process Defm Prefix as InitDavid Greene2011-10-191-19/+39
| | | | | | | 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-13/+41
| | | | | | | Allow def and defm IDs to be general values. We need this for paste functionality. llvm-svn: 142522
* Don't Parse Object Body as a NameDavid Greene2011-10-191-0/+4
| | | | | | | | Stop parsing a value if we are in name parsing mode and we see a left brace. A left brace indicates the start of an object body when we are parsing a name. llvm-svn: 142521
* Use Parse ModeDavid Greene2011-10-191-2/+9
| | | | | | | Augment the value parser to respect the parse mode and not error if an ID doesn't map to an object and we are in name parsing mode. llvm-svn: 142520
* Make ID Parsing More FlexibleDavid Greene2011-10-191-6/+8
| | | | | | | | | | | | | | | | | | | 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
* Add NAME MemberDavid Greene2011-10-191-1/+1
| | | | | | | | Add a Value named "NAME" to each Record. This will be set to the def or defm name when instantiating multiclasses. This will replace the #NAME# processing hack once paste functionality is in place. llvm-svn: 142518
* Fix Name AccessDavid Greene2011-10-191-2/+3
| | | | | | Get the Record name as a string explicitly to avoid asserts. llvm-svn: 142517
* Fix Name AccessDavid Greene2011-10-191-1/+2
| | | | | | Get the Record name as a string explicitly to avoid asserts. llvm-svn: 142516
* Fix Name AccessDavid Greene2011-10-191-2/+3
| | | | | | Get the Record name as a string explicitly to avoid asserts. llvm-svn: 142515
* Fix Name AccessDavid Greene2011-10-191-1/+2
| | | | | | Get the Record name by string explicitly to avoid potential asserts. llvm-svn: 142514
* Make Template Arg Names InitsDavid Greene2011-10-191-29/+35
| | | | | | | | 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-8/+11
| | | | | | | 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-175/+1
| | | | | | | | | | | | | | | | | | | 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
* Prefix Template Arg Names with Multiclass NameDavid Greene2011-10-051-0/+3
| | | | | | | | For consistency, prefix multiclass template arg names with the multiclass name followed by "::" to avoid name clashes among multiclass arguments and other entities in the multiclass. llvm-svn: 141239
* Process MultidefsDavid Greene2011-10-051-0/+86
| | | | | | | | | | Process each multidef declared in a multiclass. Iterate through the list and instantiate a def in the multiclass for each item, resolving the list item to the temporary iterator (possibly) used in the multidef ObjectBody. We then process each generated def in the normal way. llvm-svn: 141233
* Parser Multidef SupportDavid Greene2011-10-051-1/+88
| | | | | | | | | | | | | | | 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-87/+116
| | | | | | | | 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/+2163
This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951
OpenPOWER on IntegriCloud