summaryrefslogtreecommitdiff
path: root/llvm/lib/TableGen/TableGenBackend.cpp
AgeCommit message (Collapse)Author
2024-10-04[TableGen] Change backend callback to require const RecordKeeper (#111064)Rahul Joshi
Change TableGen backend callback function to require a const RecordKeeper argument (by changing it from function_ref to just a function pointer). This undoes parts of https://github.com/llvm/llvm-project/pull/104716 which was added to enable gradual migration of TableGen backends to use const RecordKeeper (by allowing either const or non-const references). Now that all backends have been migrated to const reference, we do not need this. This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-08-26[TableGen] Allow emitter callbacks to use `const RecordKeeper &` (#104716)Rahul Joshi
- Refactor TableGen backend options to allow specifying a callback function that takes either a const reference or a non-const reference to `RecordKeeper`. This will enable gradual migration of code to use const references and pointers to `RecordKeeper` and `Record` in the TableGen backends. - Refactor handling of the callback command line options. Move variable for the command line option from the header to the CPP file, and add a function `ApplyCallback` to apply the selected callback. - Change callbacks in TableGen.cpp to take const reference. They use the `Opt` class to register their callbacks. - Change IntrinsicEmitter to use the `OptClass` to define its callbacks. It already uses a const reference in the implementation.
2023-09-26[llvm][tblgen] Add `Source Filename` for `emitSourceFileHeader` (#65744)Shao-Ce SUN
I think this is very helpful for reading generated `.inc` files.
2023-09-26ReformatNAKAMURA Takumi
2023-03-21TableGen: Introduce `llvm::TableGen::Emitter` to register backendsNAKAMURA Takumi
`Opt(flag, func, desc)` registers an option into `Action`. `OptClass<EmitterC>` is also available if `EmitterC(RK).run(OS)` is capable. `Action` is defined as `ManagedStatic<cl::opt>` to guarantee to be created when each registration of emitter is invoked. `llvm::TableGenMain(argv0, MainFn)` invokes `Action` instead of `MainFn` Differential Revision: https://reviews.llvm.org/D144351
2020-03-02Explicitly include <cassert> when using assertJoerg Sonnenberger
Depending on the OS used, a module-enabled build can fail due to the special handling <cassert> gets as textual header.
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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
2015-05-26[TableGen] Fix line wrapping logic for the autogenerated header to use math ↵Craig Topper
that makes more sense (at least to me). The old code had a bug if the description was between 75 and 85 characters or so as it substracted PSLen from Desc.size() instead of MAX_LINE_LEN in the compare. It also calculated odd values for PosE on the last split and just let StringRef::slice take care of it being larger than the description string. llvm-svn: 238187
2015-05-26[TableGen] Rewrite an assert to not do a bunch unsigned math and then try to ↵Craig Topper
ensure the result is a positive number. I think the fact that it was explicitly excluding 0 kept this from being a tautology. The exclusion of 0 for the old math was also a bug that's easily hit if the description gets split into multiple lines. llvm-svn: 238186
2015-05-26[TableGen] Put a space between '*' and description in the autogenerated ↵Craig Topper
tablegen header. Minor cleanup in surrounding code. llvm-svn: 238185
2015-05-26[TableGen] Fix indentation. NFCCraig Topper
llvm-svn: 238181
2015-05-26[TableGen] Include header for each cpp file first. NFCCraig Topper
llvm-svn: 238180
2013-01-28A bugfix for tblgen, in the function ‘emitSourceFileHeader’.Nadav Rotem
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
2012-06-19Emit TableGen's header comment with C-style comments, so it can be used from ↵Benjamin Kramer
C89 code. Should silence warnings when compiling the X86 disassembler. llvm-svn: 158723
2012-06-13Eliminate struct TableGenBackend.Jakob Stoklund Olesen
TableGen backends are simply written as functions now. Patch by Sean Silva! llvm-svn: 158389
2012-06-11Write llvm-tblgen backends as functions instead of sub-classes.Jakob Stoklund Olesen
The TableGenBackend base class doesn't do much, and will be removed completely soon. Patch by Sean Silva! llvm-svn: 158311
2012-02-19StringRef'ize EmitSourceFileHeader().Ahmed Charles
llvm-svn: 150917
2011-12-20Unweaken vtables as per ↵David Blaikie
http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
2011-10-01Move TableGen's parser and entry point into a libraryPeter Collingbourne
This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951