summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen
Commit message (Collapse)AuthorAgeFilesLines
...
* tblgen: Diagnose duplicate includes.Sean Silva2013-02-074-10/+23
| | | | | | | | | | | | | | | 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
* A bugfix for tblgen, in the function ‘emitSourceFileHeader’.Nadav Rotem2013-01-281-6/+25
| | | | | | | | | When the first parameter (‘Desc’) is more than 80 characters long, it will result the header line that contains the description to be more Than (4GB!) long. Not only it takes forever to produce, the output file cannot be open, since its ginormous. Patch by Elior Malul. llvm-svn: 173672
* Add an addition operator to TableGenHal Finkel2013-01-254-1/+9
| | | | | | | This adds an !add(a, b) operator to tablegen; this will be used to cleanup the PPC register definitions. llvm-svn: 173445
* TableGen: Keep track of superclass reference ranges.Jordan Rose2013-01-102-34/+46
| | | | | | | | | | def foo : bar; ~~~ This allows us to produce more precise diagnostics about a certain superclass, and even provide fixits. llvm-svn: 172085
* TableGen: record anonymous instantiations of classes.Jordan Rose2013-01-101-6/+16
| | | | llvm-svn: 172084
* tblgen: use an early return to reduce indentation.Sean Silva2013-01-091-18/+18
| | | | llvm-svn: 171954
* tblgen: Factor out common code.Sean Silva2013-01-092-17/+18
| | | | llvm-svn: 171951
* Inline this into its only caller.Sean Silva2013-01-092-12/+5
| | | | | | | | | | | 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
* tblgen: Reuse function that is 2 lines above.Sean Silva2013-01-091-11/+2
| | | | llvm-svn: 171937
* fix copy-paste-oSean Silva2013-01-091-2/+2
| | | | llvm-svn: 171936
* docs: Bring TableGen syntax a bit closer to reality.Sean Silva2013-01-091-1/+6
| | | | | | | | | It's not just def's but actually a limited subset of Object's that are allowed inside a multiclass. Spotted by Joel Jones. llvm-svn: 171935
* Revert r171140. We don't actually need to support #NAME. Because NAME by ↵Craig Topper2013-01-071-5/+1
| | | | | | itself is interpreted just fine. llvm-svn: 171695
* Simplify TableGen type-compatibility checks.Sean Silva2013-01-071-7/+38
| | | | | | Patch by Elior Malul! llvm-svn: 171684
* Update tablegen parser to allow defm names to start with #NAME.Craig Topper2012-12-271-1/+5
| | | | llvm-svn: 171140
* Sort includes for all of the .h files under the 'lib' tree. These wereChandler Carruth2012-12-042-3/+3
| | | | | | | | | | 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
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-034-15/+13
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Remove exception handling usage from tblgen.Joerg Sonnenberger2012-10-255-134/+113
| | | | | | | | | | | Most places can use PrintFatalError as the unwinding mechanism was not used for anything other than printing the error. The single exception was CodeGenDAGPatterns.cpp, where intermediate errors during type resolution were ignored to simplify incremental platform development. This use is replaced by an error flag in TreePattern and bailout earlier in various places if it is set. llvm-svn: 166712
* In preparation for removing exception handling in tablegen, addJoerg Sonnenberger2012-10-251-0/+12
| | | | | | PrintFatalError, which combines PrintError with exit(1). llvm-svn: 166690
* tblgen: Compile TableGen without RTTI.Sean Silva2012-10-102-4/+0
| | | | | | TableGen no longer needs RTTI! llvm-svn: 165651
* tblgen: Use semantically correct RTTI functions.Sean Silva2012-10-102-36/+21
| | | | | | Also, some minor cleanup. llvm-svn: 165647
* tblgen: Mechanically move dynamic_cast<> to dyn_cast<>.Sean Silva2012-10-102-94/+94
| | | | | | | | | | Some of these dyn_cast<>'s would be better phrased as isa<> or cast<>. That will happen in a future patch. There are also two dyn_cast_or_null<>'s slipped in instead of dyn_cast<>'s, since they were causing crashes with just dyn_cast<>. llvm-svn: 165646
* tblgen: Rename handleDependencies -> createDependencyFileSean Silva2012-10-091-2/+2
| | | | llvm-svn: 165544
* tblgen: Move dependency file output to a separate function.Sean Silva2012-10-091-21/+31
| | | | | | This keeps it out of the main flow of TableGenMain. llvm-svn: 165542
* tblgen: Remove pointless method call.Sean Silva2012-10-091-1/+0
| | | | llvm-svn: 165511
* tblgen: Use appropriate LLVM-style RTTI functions.Sean Silva2012-10-051-21/+9
| | | | | | | Use isa<> or cast<> when semantically that is what is happening. Also some trivial "style" cleanups at fix sites. llvm-svn: 165292
* tblgen: Replace uses of dynamic_cast<XXXRecTy> with dyn_cast<>.Sean Silva2012-10-052-25/+25
| | | | | | | | This is a mechanical change of dynamic_cast<> to dyn_cast<>. A number of these uses are actually more like isa<> or cast<>, and will be changed to the semanticaly appropriate one in a future patch. llvm-svn: 165291
* tblgen: Whitespace and 80-col cleanup.Sean Silva2012-10-041-11/+12
| | | | llvm-svn: 165190
* tblgen: Remove last traces of old TableGenMain API.Sean Silva2012-10-033-36/+1
| | | | llvm-svn: 165168
* tblgen: Put new TableGenMain API in place.Sean Silva2012-10-031-0/+19
| | | | | | | | In order to avoid rev-lock with Clang when moving to the new API, also preserve the current API temporarily and insert a shim to implement the new API in terms of the old. llvm-svn: 165165
* 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
OpenPOWER on IntegriCloud