aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/TableGen/TGLexer.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-08-15[llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere1-2/+2
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
2019-05-14TableGen: support #ifndef in addition to #ifdef.Tim Northover1-5/+13
TableGen has a limited preprocessor, which only really supports easier. llvm-svn: 360670
2019-04-10[TableGen] Introduce !listsplat 'binary' operatorRoman Lebedev1-0/+1
Summary: ``` ``!listsplat(a, size)`` A list value that contains the value ``a`` ``size`` times. Example: ``!listsplat(0, 2)`` results in ``[0, 0]``. ``` I plan to use this in X86ScheduleBdVer2.td for LoadRes handling. This is a little bit controversial because unlike every other binary operator the types aren't identical. Reviewers: stoklund, javed.absar, nhaehnle, craig.topper Reviewed By: javed.absar Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60367 llvm-svn: 358117
2019-03-01[Tablegen] Add support for the !mul operator.Nicola Zaghen1-0/+1
This is a small addition to arithmetic operations that improves expressiveness of the language. Differential Revision: https://reviews.llvm.org/D58775 llvm-svn: 355187
2019-01-25[TblGen] Extend !if semantics through new feature !condJaved Absar1-0/+1
This patch extends TableGen language with !cond operator. Instead of embedding !if inside !if which can get cumbersome, one can now use !cond. Below is an example to convert an integer 'x' into a string: !cond(!lt(x,0) : "Negative", !eq(x,0) : "Zero", !eq(x,1) : "One, 1 : "MoreThanOne") Reviewed By: hfinkel, simon_tatham, greened Differential Revision: https://reviews.llvm.org/D55758 llvm-svn: 352185
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-11-27[TableGen] Preprocessing supportVyacheslav Zakharin1-22/+535
Differential Revision: https://reviews.llvm.org/D54926 llvm-svn: 347686
2018-11-17Reverted r347092 due to the following build fails:Vyacheslav Zakharin1-535/+22
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/8662 http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26263 llvm-svn: 347129
2018-11-16Preprocessing support in tablegen.Vyacheslav Zakharin1-22/+535
Differential Revision: https://reviews.llvm.org/D53840 llvm-svn: 347092
2018-03-14TableGen: Add !ne, !le, !lt, !ge, and !gt comparisonsNicolai Haehnle1-0/+5
Change-Id: I8e2ece677268972d578a787467f7ef52a1f33a71 Differential revision: https://reviews.llvm.org/D44114 llvm-svn: 327496
2018-03-14TableGen: Add !dag function for constructionNicolai Haehnle1-0/+1
This allows constructing DAG nodes with programmatically determined names, and can simplify constructing DAG nodes in other cases as well. Also, add documentation and some very simple tests for the already existing !con. Change-Id: Ida61cd82e99752548d7109ce8da34d29da56a5f7 Differential revision: https://reviews.llvm.org/D44110 llvm-svn: 327492
2018-03-09TableGen: Remove space at EOL in TGLexer.{h,cpp}Nicolai Haehnle1-25/+25
Change-Id: Ica5f39470174e85f173d3b6db95789033f75ce17 llvm-svn: 327158
2018-03-09TableGen: Add a defset statementNicolai Haehnle1-0/+1
Allows capturing a list of concrete instantiated defs. This can be combined with foreach to create parallel sets of def instantiations with less repetition in the source. This purpose is largely also served by multiclasses, but in some cases multiclasses can't be used. The motivating example for this change is having a large set of intrinsics, which are generated from the IntrinsicsBackend.td file included by Intrinsics.td, and a corresponding set of instruction selection patterns, which are generated via the backend's .td files. Multiclasses cannot be used to eliminate the redundancy in this case, because a multiclass cannot span both LLVM's common .td files and the backend .td files at the same time. Change-Id: I879e35042dceea542a5e6776fad23c5e0e69e76b Differential revision: https://reviews.llvm.org/D44109 llvm-svn: 327121
2018-03-09TableGen: add !isa operationNicolai Haehnle1-0/+1
Change-Id: Iddb724c3ae706d82933a2d82c91d07e0e36b30e3 Differential revision: https://reviews.llvm.org/D44105 llvm-svn: 327117
2018-03-06TableGen: Add !foldl operationNicolai Haehnle1-0/+1
Change-Id: I63d67bf6e0b315e2d3360e47e3b62c9517f38987 llvm-svn: 326790
2018-02-23TableGen: Add !size operationNicolai Haehnle1-0/+1
Summary: Returns the size of a list. I have found this to be rather useful in some development for the AMDGPU backend where we could simplify our .td files by concatenating list<LLVMType> for complex intrinsics. Doing so requires us to compute the position argument for LLVMMatchType. Basically, the usage is in a pattern that looks somewhat like this: list<LLVMType> argtypes = !listconcat(base, [llvm_any_ty, LLVMMatchType<!size(base)>]); Change-Id: I360a0b000fd488d18bea412228230fd93722bd2c Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits, tpr Differential Revision: https://reviews.llvm.org/D43553 llvm-svn: 325883
2016-11-15TableGen: Add operator !orMatt Arsenault1-0/+1
llvm-svn: 286936
2016-08-23Fix some Clang-tidy modernize-use-using and Include What You Use warnings; ↵Eugene Zelenko1-6/+5
other minor fixes. Differential revision: https://reviews.llvm.org/D23789 llvm-svn: 279535
2016-08-17Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner1-1/+1
Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
2016-08-17Replace "fallthrough" comments with LLVM_FALLTHROUGHJustin Bogner1-1/+1
This is a mechanical change of comments in switches like fallthrough, fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead. llvm-svn: 278902
2014-08-07Change TableGen so that binary literals such as 0b001 are now sized.Pete Cooper1-1/+1
Instead of these becoming an integer literal internally, they now become bits<n> values. Prior to this change, 0b001 was 1 bit long. This is confusing as clearly the user gave 3 bits. This new type holds both the literal value and the size, and so can ensure sizes match on initializers. For example, this used to be legal bits<1> x = 0b00; but now it must be written as bits<2> x = 0b00; llvm-svn: 215084
2014-08-05Allow binary and for tblgen math.Joerg Sonnenberger1-0/+1
llvm-svn: 214851
2014-07-06This only needs a StringRef.Rafael Espindola1-9/+9
llvm-svn: 212402
2014-07-06SourceMgr: make valid buffer IDs start from oneAlp Toker1-2/+2
Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned representation to enable more idiomatic usage. Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1 to identify the main file. llvm-svn: 212398
2014-05-07[tablegen] Add !listconcat operator with the similar semantics as !strconcatDaniel Sanders1-0/+1
Summary: It concatenates two or more lists. In addition to the !strconcat semantics the lists must have the same element type. My overall aim is to make it easy to append to Instruction.Predicates rather than override it. This can be done by concatenating lists passed as arguments, or by concatenating lists passed in additional fields. Reviewers: dsanders Reviewed By: dsanders Subscribers: hfinkel, llvm-commits Differential Revision: http://reviews.llvm.org/D3506 llvm-svn: 208183
2014-04-09[C++11] Make use of 'nullptr' in TableGen library.Craig Topper1-5/+5
llvm-svn: 205830
2013-02-07tblgen: Diagnose duplicate includes.Sean Silva1-1/+9
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
2013-01-25Add an addition operator to TableGenHal Finkel1-0/+1
This adds an !add(a, b) operator to tablegen; this will be used to cleanup the PPC register definitions. llvm-svn: 173445
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-6/+5
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
2012-02-22Add Foreach LoopDavid Greene1-0/+1
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
2011-12-22TableGen: add a commentDylan Noblesmith1-1/+1
llvm-svn: 147199
2011-12-22try to fix MSVC buildDylan Noblesmith1-0/+3
llvm-svn: 147198
2011-12-22drop unneeded config.h includesDylan Noblesmith1-1/+0
llvm-svn: 147197
2011-10-19Implement PasteDavid Greene1-5/+5
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
2011-10-19Disambiguate Numbers and IdentifiersDavid Greene1-1/+37
Use lookahead to determine whether a number is really a number or is part of something forming an identifier. This won't come into play until the paste operator is recognized as a unique token. llvm-svn: 142513
2011-10-19Add PeekDavid Greene1-0/+4
Add a peek function to let the Lexer look at a character arbitrarily far ahead in the stream without consuming anything. We need this to disambiguate numbers and operands of a paste operation. For example: def foo#8i Without lookahead the lexer will treat '8' as a number rather than as part of a string to be pasted to form an identifier. llvm-svn: 142512
2011-10-07Remove MultidefsDavid Greene1-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
2011-10-06Use StringSwitch.Benjamin Kramer1-19/+21
llvm-svn: 141305
2011-10-06Simplify code. No functionality change.Benjamin Kramer1-26/+24
llvm-svn: 141299
2011-10-06Fix TypoDavid Greene1-1/+1
Compare the entire keyword string. llvm-svn: 141295
2011-10-05Lexer Support for MultidefsDavid Greene1-0/+1
Add keyword support for multidefs. llvm-svn: 141231
2011-10-01Move TableGen's parser and entry point into a libraryPeter Collingbourne1-0/+435
This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951