summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen
Commit message (Collapse)AuthorAgeFilesLines
* De-nest if's and fix mix-upSean Silva2012-09-191-41/+37
| | | | | | | | | | | | | | | | | | Two deeply nested if's obscured that the sense of the conditions was mixed up. Amazingly, TableGen's output is exactly the same even with the sense of the tests fixed; it seems that all of TableGen's conversions are symmetric so that the inverted sense was nonetheless correct "by accident". As such, I couldn't come up with a test case. If there does in fact exist a non-symmetric conversion in TableGen's type system, then a test case should be prepared. Despite the symmetry, both if's are left in place for robustness in the face of future changes. Review by Jakob. llvm-svn: 164195
* Re-work bit/bits value resolving in tblgenMichael Liao2012-09-062-138/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This patch is inspired by the failure of the following code snippet which is used to convert enumerable values into encoding bits to improve the readability of td files. class S<int s> { bits<2> V = !if(!eq(s, 8), {0, 0}, !if(!eq(s, 16), {0, 1}, !if(!eq(s, 32), {1, 0}, !if(!eq(s, 64), {1, 1}, {?, ?})))); } Later, PR8330 is found to report not exactly the same bug relevant issue to bit/bits values. - Instead of resolving bit/bits values separately through resolveBitReference(), this patch adds getBit() for all Inits and resolves bit value by resolving plus getting the specified bit. This unifies the resolving of bit with other values and removes redundant logic for resolving bit only. In addition, BitsInit::resolveReferences() is optimized to take advantage of this origanization by resolving VarBitInit's variable reference first and then getting bits from it. - The type interference in '!if' operator is revised to support possible combinations of int and bits/bit in MHS and RHS. - As there may be illegal assignments from integer value to bit, says assign 2 to a bit, but we only check this during instantiation in some cases, e.g. bit V = !if(!eq(x, 17), 0, 2); Verbose diagnostic message is generated when invalid value is resolveed to help locating the error. - PR8330 is fixed as well. llvm-svn: 163360
* Tristate mayLoad, mayStore, and hasSideEffects.Jakob Stoklund Olesen2012-08-231-0/+17
| | | | | | | Keep track of the set/unset state of these bits along with their true/false values, but treat '?' as '0' for now. llvm-svn: 162461
* Print out the location of expanded multiclass defs in TableGen errors.Jakob Stoklund Olesen2012-08-222-5/+19
| | | | | | | | | | | | | | | | | | | 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
* TableGen: Location information for diagnostic.Jim Grosbach2012-07-121-1/+1
| | | | | | | | | | | def Pat<...>; Results in 'record name is not a string!' diagnostic. Not the best, but the lack of location information moves it from not very helpful into completely useless. We're in the Record class when throwing the error, so just add the location info directly. llvm-svn: 160098
* Emit TableGen's header comment with C-style comments, so it can be used from ↵Benjamin Kramer2012-06-191-4/+18
| | | | | | | | C89 code. Should silence warnings when compiling the X86 disassembler. llvm-svn: 158723
* Eliminate struct TableGenBackend.Jakob Stoklund Olesen2012-06-131-9/+2
| | | | | | | | TableGen backends are simply written as functions now. Patch by Sean Silva! llvm-svn: 158389
* Write llvm-tblgen backends as functions instead of sub-classes.Jakob Stoklund Olesen2012-06-111-1/+4
| | | | | | | | | The TableGenBackend base class doesn't do much, and will be removed completely soon. Patch by Sean Silva! llvm-svn: 158311
* Fix 80 columns.Michael J. Spencer2012-06-011-3/+6
| | | | llvm-svn: 157788
* 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-242-103/+72
| | | | | | Use static type checking. llvm-svn: 157430
* Emit memcmp directly from the StringMatcherEmitter.Benjamin Kramer2012-05-201-4/+4
| | | | | | | | | There should be no difference in the resulting binary, given a sufficiently smart compiler. However we already had compiler timeouts on the generated code in Intrinsics.gen, this hopefully makes the lives of slow buildbots a little easier. llvm-svn: 157161
* Move llvm-tblgen's StringMatcher into the TableGen library so it canDouglas Gregor2012-05-022-0/+150
| | | | | | be used by clang-tblgen. llvm-svn: 156000
* Fix copy/paste-o.Jim Grosbach2012-04-181-1/+1
| | | | llvm-svn: 155016
* TableGen add warning diagnostic helper functions.Jim Grosbach2012-04-181-0/+16
| | | | llvm-svn: 155012
* Fix infinite loop in nested multiclasses.Jakob Stoklund Olesen2012-03-071-6/+2
| | | | | | Patch by Michael Liao! llvm-svn: 152232
* Switch the TableGen record's string-based DenseMap key to use the newChandler Carruth2012-03-051-5/+11
| | | | | | | | hashing infrastructure. I wonder why we don't just use StringMap here, and I may revisit the issue if I have time, but for now I'm just trying to consolidate. llvm-svn: 152023
* Remove stray semi-colon.Daniel Dunbar2012-02-281-1/+1
| | | | llvm-svn: 151629
* Add Foreach LoopDavid Greene2012-02-224-5/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* StringRef'ize EmitSourceFileHeader().Ahmed Charles2012-02-191-1/+1
| | | | llvm-svn: 150917
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-072-5/+5
| | | | llvm-svn: 149967
* Implement String Cast from IntegerDavid Greene2012-01-301-0/+5
| | | | | | Allow casts from integer to string. llvm-svn: 149273
* 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
* Removing unused default switch cases in switches over enums that already ↵David Blaikie2012-01-161-3/+0
| | | | | | | | account for all enumeration values explicitly. (This time I believe I've checked all the -Wreturn-type warnings from GCC & added the couple of llvm_unreachables necessary to silence them. If I've missed any, I'll happily fix them as soon as I know about them) llvm-svn: 148262
* Delete CodeInit and CodeRecTy from TableGen.Jakob Stoklund Olesen2012-01-132-33/+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-132-21/+9
| | | | | | | This avoids a gazillion StringMap and dynamic_cast calls, making TableGen run 3x faster. llvm-svn: 148091
* TableGen: add a commentDylan Noblesmith2011-12-221-1/+1
| | | | llvm-svn: 147199
* try to fix MSVC buildDylan Noblesmith2011-12-221-0/+3
| | | | llvm-svn: 147198
* drop unneeded config.h includesDylan Noblesmith2011-12-221-1/+0
| | | | llvm-svn: 147197
* Fix up the CMake build for the new files added in r146960, they'reChandler Carruth2011-12-201-0/+1
| | | | | | likely to stay either way that discussion ends up resolving itself. llvm-svn: 146966
* Unweaken vtables as per ↵David Blaikie2011-12-203-0/+27
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* LLVMBuild: Remove trailing newline, which irked me.Daniel Dunbar2011-12-121-1/+0
| | | | llvm-svn: 146409
* Check for error after InstantiateMultclassDef.Jim Grosbach2011-12-021-0/+2
| | | | llvm-svn: 145689
* build/CMake: Finish removal of add_llvm_library_dependencies.Daniel Dunbar2011-11-291-4/+0
| | | | llvm-svn: 145420
* ARM vldm and vstm VFP instructions can take a data type suffix.Jim Grosbach2011-11-111-1/+1
| | | | | | | | | | | | It's ignored by the assembler when present, but is legal syntax. Other instructions have something similar, but for some mnemonics it's only sometimes not significant, so this quick check in the parser will need refactored into something more robust soon-ish. This gets some basics working in the meantime. Partial for rdar://10435264 llvm-svn: 144422
* build: Add initial cut at LLVMBuild.txt files.Daniel Dunbar2011-11-031-0/+23
| | | | llvm-svn: 143634
* Implement PasteDavid Greene2011-10-193-28/+67
| | | | | | | | | | | | | | 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-192-20/+40
| | | | | | | 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-192-14/+42
| | | | | | | 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-192-10/+26
| | | | | | | | | | | | | | | | | | | 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-192-1/+6
| | | | | | | | 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
OpenPOWER on IntegriCloud