summaryrefslogtreecommitdiff
path: root/utils/TableGen/TGParser.cpp
Commit message (Collapse)AuthorAge
* Move TableGen's parser and entry point into a libraryPeter Collingbourne2011-10-01
| | | | | | This is the first step towards splitting LLVM and Clang's tblgen executables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140951 91177308-0d34-0410-b5e6-96231b3b80d8
* Better Error ReportingDavid Greene2011-09-19
| | | | | | | Report missing template arguments more helpfully by supplying the name of the missing argument in the error message. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140034 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Record Name an InitDavid Greene2011-08-10
| | | | | | | | | | | Use an Init (ultimately a StringInit) to represent the Record name. This allows the name to be composed by standard TableGen operators. This will enable us to get rid of the ugly #NAME# hack processing and naturally replace it with operators. It also increases flexibility and power of the TableGen language by allowing record identifiers to be computed dynamically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137232 91177308-0d34-0410-b5e6-96231b3b80d8
* Unconstify InitsDavid Greene2011-07-29
| | | | | | | | Remove const qualifiers from Init references, per Chris' request. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136531 91177308-0d34-0410-b5e6-96231b3b80d8
* [AVX] Create Inits Via Factory MethodDavid Greene2011-07-29
| | | | | | | Replace uses of new *Init with *Init::get. This hides the allocation implementation so that we can unique Inits in various ways. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136486 91177308-0d34-0410-b5e6-96231b3b80d8
* [AVX] Constify InitsDavid Greene2011-07-29
| | | | | | | Make references to Inits const everywhere. This is the final step before making them unique. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136485 91177308-0d34-0410-b5e6-96231b3b80d8
* [AVX] Remove Mutating Members from InitsDavid Greene2011-07-29
| | | | | | | Get rid of all Init members that modify internal state. This is in preparation for making references to Inits const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136483 91177308-0d34-0410-b5e6-96231b3b80d8
* Intern all RecTy subclass instances to avoid duplicates.Jakob Stoklund Olesen2011-07-18
| | | | | | | | | | | | | | | | | Make all of the RecTy constructors private, and use get() factory methods instead. Return singleton instances when it makes sense. ListTy instance pointers are stored in the element RecTy instance. BitsRecTy instance pointers, one per length, are stored in a static vector. Also unique DefInit instances. A Record has a unique DefInit which has a unique RecordRecTy instance. This saves some 200k-300k RecTy allocations when parsing ARM.td. It reduces TableGen's heap usage by almost 50%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135399 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r134921, 134917, 134908 and 134907. They're causing failuresEric Christopher2011-07-11
| | | | | | | in multiple buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134936 91177308-0d34-0410-b5e6-96231b3b80d8
* Use get(0 Instead of Create()David Greene2011-07-11
| | | | | | | | Respond to some feedback asking for a name change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134921 91177308-0d34-0410-b5e6-96231b3b80d8
* [AVX] Make Inits FoldableDavid Greene2011-07-11
| | | | | | | | | | | | | | | | | | Manage Inits in a FoldingSet. This provides several benefits: - Memory for Inits is properly managed - Duplicate Inits are folded into Flyweights, saving memory - It enforces const-correctness, protecting against certain classes of bugs The above benefits allow Inits to be used in more contexts, which in turn provides more dynamism to TableGen. This enhanced capability will be used by the AVX code generator to a fold common patterns together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134907 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing 'return on failure'. Previously we'd crash after emittingJim Grosbach2011-03-11
| | | | | | the diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127480 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename lisp-like functions as suggested by Gabor Greif as loooong timeDavid Greene2011-01-07
| | | | | | | ago. This is both easier to learn and easier to read. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123001 91177308-0d34-0410-b5e6-96231b3b80d8
* various cleanups to tblgen, patch by Garrison Venn!Chris Lattner2010-12-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121837 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for using the `!if' operator when initializing variables:Bill Wendling2010-12-13
| | | | | | | | | | | | class A<bit a, bits<3> x, bits<3> y> { bits<3> z; let z = !if(a, x, y); } The variable z will get the value of x when 'a' is 1 and 'y' when a is '0'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121666 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate the Records global variable, patch by Garrison Venn!Chris Lattner2010-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121659 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a crash on:Chris Lattner2010-10-31
| | | | | | | | | | | | | | let Constraints = "$val = $dst", Defs = [EFLAGS] in, isCodeGenOnly = 1 { we now get: X86InstrCompiler.td:653:52: error: Expected class, def, defm, multiclass or let definition let Constraints = "$val = $dst", Defs = [EFLAGS] in, isCodeGenOnly = 1 { ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117863 91177308-0d34-0410-b5e6-96231b3b80d8
* fix the !eq operator in tblgen to return a bit instead of an int.Chris Lattner2010-10-31
| | | | | | | | | Use this to make the X86 and ARM targets set isCodeGenOnly=1 automatically for their instructions that have Format=Pseudo, resolving a hack in tblgen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117862 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove -llvmc-temp-hack from tblgen.Mikhail Glushenkov2010-10-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117197 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing whitespace.Mikhail Glushenkov2010-10-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117195 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize tblgen's dag parsing logic to handle arbitrary expressionsChris Lattner2010-10-06
| | | | | | | | | | | | | | | | as the operator of the dag. Specifically, this allows parsing things like (F.x 4) in addition to just (a 4). Unfortunately, this runs afoul of an idiom being used by llvmc. It is using dags like (foo [1,2,3]) to represent a list of stuff being passed into foo. With this change, this is parsed as a [1,2,3] subscript on foo instead of being the first argument to the dag. Cope with this in the short term by requiring a "-llvmc-temp-hack" argument to tblgen to get the old parsing behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115742 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanupsChris Lattner2010-10-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115739 91177308-0d34-0410-b5e6-96231b3b80d8
* remove the !nameconcat tblgen feature. It "shorthand" and only used in 4 placesChris Lattner2010-10-06
| | | | | | | where !cast is just as short. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115722 91177308-0d34-0410-b5e6-96231b3b80d8
* allow !strconcat to take more than two operands to eliminateChris Lattner2010-10-05
| | | | | | | | | !strconcat(!strconcat(!strconcat(!strconcat Simplify some x86 td files to use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115719 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance tblgen to support anonymous defm's, use this toChris Lattner2010-10-05
| | | | | | | simplify the X86 CMOVmr's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115702 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a subtle multiclass bug: when using class inheritance onBruno Cardoso Lopes2010-06-22
| | | | | | | | a toplevel 'defm', make sure to properly resolve references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106570 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach tablegen how to inherit from classes in 'defm' definitions.Bruno Cardoso Lopes2010-06-18
| | | | | | | | | The rule is simple: only inherit from a class list if they come in the end, after the last multiclass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106305 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach tablegen to allow "let" expressions inside multiclasses,Bruno Cardoso Lopes2010-06-10
| | | | | | | providing more ways to factor out commonality from the records. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105776 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach tablegen to support 'defm' inside multiclasses.Bruno Cardoso Lopes2010-06-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105519 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an !eq() operator to TableGen. It operates on strings only.David Greene2010-01-05
| | | | | | | Use !cast<string>() to compare other types of objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92754 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix whitespace.Bob Wilson2009-11-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89582 91177308-0d34-0410-b5e6-96231b3b80d8
* This void is implicit in C++.Dan Gohman2009-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78848 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace std::iostreams with raw_ostream in TableGen.Daniel Dunbar2009-07-03
| | | | | | | | | - Sorry, I can't help myself. - No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74742 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve TableGen error reporting.David Greene2009-06-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74443 91177308-0d34-0410-b5e6-96231b3b80d8
* rename TGLoc -> SMLoc.Chris Lattner2009-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73843 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 73074 and 73099 because Windows doesn't have POSIXDavid Greene2009-06-09
| | | | | | | | regular expressions. We will add an OpenBSD implementation and re-apply ASAP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73138 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a !patsubst operator. Use on string types.David Greene2009-06-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73099 91177308-0d34-0410-b5e6-96231b3b80d8
* Make IntInits and ListInits typed. This helps deduce types of !if andDavid Greene2009-06-08
| | | | | | | | | other operators. For the rare cases where a list type cannot be deduced, provide a []<type> syntax, where <type> is the list element type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73078 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a !regmatch operator to do pattern matching in TableGen.David Greene2009-06-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73074 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement !if, analogous to $(if) in GNU make.David Greene2009-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71815 91177308-0d34-0410-b5e6-96231b3b80d8
* Graduate LLVM to the big leagues by embedding a LISP processor into TableGen.David Greene2009-05-14
| | | | | | | | | | | Ok, not really, but do support some common LISP functions: * car * cdr * null git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71805 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a !foreach operator analogous to GNU make's $(foreach).David Greene2009-05-14
| | | | | | | | | | | | | | | Use it on dags and lists like this: class decls { string name; } def Decls : decls; class B<list<string> names> : A<!foreach(Decls.name, names, !strconcat(Decls.name, ", Sr."))>; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71803 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a !subst operation simmilar to $(subst) in GNU make to doDavid Greene2009-05-14
| | | | | | | | | | | | | | | | | def/var/string substitution on generic pattern templates. For example: def Type; def v4f32 : Type; def TYPE : Type; class GenType<Type t> { let type = !(subst TYPE, v4f32, t); } def TheType : GenType<TYPE>; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71801 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement !cast.David Greene2009-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71794 91177308-0d34-0410-b5e6-96231b3b80d8
* Operation EnhancementsDavid Greene2009-05-14
| | | | | | | | | | | | Create an OpInit class to serve as a base for all operation Inits. Move parsing of operation constructs to separate functions and reference from multiple places. Add some commented out new operations. Coming soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71789 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow multiclass def names to contain "#NAME"" where TableGen replacesDavid Greene2009-05-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #NAME# with the name of the defm instantiating the multiclass. This is useful for AVX instruction naming where a "V" prefix is standard throughout the ISA. For example: multiclass SSE_AVX_Inst<...> { def SS : Instr<...>; def SD : Instr<...>; def PS : Instr<...>; def PD : Instr<...>; def V#NAME#SS : Instr<...>; def V#NAME#SD : Instr<...>; def V#NAME#PS : Instr<...>; def V#NAME#PD : Instr<...>; } defm ADD : SSE_AVX_Inst<...>; Results in ADDSS ADDSD ADDPS ADDPD VADDSS VADDSD VADDPS VADDPD git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70979 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the CurMultiClass formal parameter of TGParser::AddSubMultiClassBob Wilson2009-04-30
| | | | | | | | so that it doesn't shadow the instance variable of the same name. Make the parameter names in method declarations match the definitions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70502 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary "class" keywords.Bob Wilson2009-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70499 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix trailing whitespace and 80-col. violations in recent TableGen changes.Bob Wilson2009-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70319 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix multiclass inheritance to limit value resolution to new defs addedDavid Greene2009-04-24
| | | | | | | | by base multiclasses. Do not attempt to alter defs from previous base multiclasses. This fixes multiple multiclass inheritance. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69974 91177308-0d34-0410-b5e6-96231b3b80d8