summaryrefslogtreecommitdiff
path: root/llvm/lib/TableGen/Main.cpp
AgeCommit message (Collapse)Author
2025-04-13[StrTable] Use string literal emission for intrinsics on non-MSVC platforms ↵Reid Kleckner
(#124856) This mainly transitions the LLVM intrinsic string table from character emission to string literal emission, which I confirmed happens for me locally. I moved the guts of StringToOffsetTable to a cpp file so I could move the `EmitLongStrLiterals` cl::opt global to a non-vague linkage home in the `TableGen` library. I had to add missing FormatVariadic.h includes to account for moving other includes to a cpp file.
2025-01-27[TableGen] Add assert to validate `Objects` list for `HwModeSelect` (#123794)Rahul Joshi
- Bail out of TableGen if any asserts fail before running the backend. - Add asserts to validate that the `Objects` and `Modes` lists for various `HwModeSelect` subclasses are of same length. - Eliminate equivalent check in CodeGenHWModes.cpp
2024-10-04[TableGen] Factor out timer code into a new `TGTimer` class (#111054)Rahul Joshi
Factor out the timer related functionality from `RecordKeeper` to a new `TGTimer` class in a new file.
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.
2024-07-03[llvm] Avoid 'raw_string_ostream::str' (NFC)Youngsuk Kim
Since `raw_string_ostream` doesn't own the string buffer, it is desirable (in terms of memory safety) for users to directly reference the string buffer rather than use `raw_string_ostream::str()`. Work towards TODO comment to remove `raw_string_ostream::str()`.
2023-12-03[llvm] Stop including vector (NFC)Kazu Hirata
Identified with clangd.
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
2023-03-21TableGen: Make 2nd arg `MainFn` of `TableGenMain(argv0, MainFn)` optional.NAKAMURA Takumi
2023-02-17llvm-tblgen: Apply IWYU partiallyNAKAMURA Takumi
2022-01-28Cleanup include dependencies for LLVMTableGenserge-sans-paille
Based on the output of include-what-you-use. No other library seems affected by the new forward declaration. $ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/TableGen/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 795231 after: 750654 Related Discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D118374
2021-11-03[TableGen] Emit a warning for unused template argsCullen Rhodes
Add a warning to TableGen for unused template arguments in classes and multiclasses, for example: multiclass Foo<int x> { def bar; } $ llvm-tblgen foo.td foo.td:1:20: warning: unused template argument: Foo::x multiclass Foo<int x> { ^ A flag '--no-warn-on-unused-template-args' is added to disable the warning. The warning is disabled for LLVM and sub-projects if 'LLVM_ENABLE_WARNINGS=OFF'. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D109359
2021-04-07[SystemZ][z/OS][TableGen] TableGen files should be textAbhina Sreeskantharajan
This patch sets tablegen files as text. It should have no effect on Windows after this patch landed https://reviews.llvm.org/rG82b3e28e836d2f5c8cfd6e1047b93c088522365a. Reviewed By: anirudhp Differential Revision: https://reviews.llvm.org/D100036
2021-03-26[Windows] Turn off text mode in TableGen and Rewriter to stop CRLF translationAbhina Sreeskantharajan
This patch should fix the errors shown on the Windows bots by turning off text mode. I plan to investigate a better fix but this should unblock the buildbots for now. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99363
2021-03-25[NFC] Reordering parameters in getFile and getFileOrSTDINAbhina Sreeskantharajan
In future patches I will be setting the IsText parameter frequently so I will refactor the args to be in the following order. I have removed the FileSize parameter because it is never used. ``` static ErrorOr<std::unique_ptr<MemoryBuffer>> getFile(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true, bool IsVolatile = false); static ErrorOr<std::unique_ptr<MemoryBuffer>> getFileOrSTDIN(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true); static ErrorOr<std::unique_ptr<MB>> getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsText, bool RequiresNullTerminator, bool IsVolatile); static ErrorOr<std::unique_ptr<WritableMemoryBuffer>> getFile(const Twine &Filename, bool IsVolatile = false); ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D99182
2021-03-23[NFC] Formatting changesAbhina Sreeskantharajan
This patch addresses some formatting changes from the comments in https://reviews.llvm.org/D97785. Reviewed By: anirudhp Differential Revision: https://reviews.llvm.org/D99072
2021-03-19[SystemZ][z/OS] Distinguish between text and binary files on z/OSAbhina Sreeskantharajan
This patch consists of the initial changes to help distinguish between text and binary content correctly on z/OS. I would like to get feedback from Windows users on setting OF_None for all ToolOutputFiles. This seems to have been done as an optimization to prevent CRLF translation on Windows in the past. Reviewed By: zibi Differential Revision: https://reviews.llvm.org/D97785
2020-11-14[TableGen] Add frontend/backend phase timing capability.Paul C. Anagnostopoulos
Describe in the BackEnd Developer's Guide. Instrument a few backends. Remove an old unused timing facility. Add a null backend for timing the parser. Differential Revision: https://reviews.llvm.org/D91388
2020-10-02[TableGen] New backend to print detailed records.Paul C. Anagnostopoulos
Pertinent lints are fixed.
2020-04-25[TableGen] [NFC] Make argv0 constAlex Brachet
`argv0` was never being modified. No changes made except to the type. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D78840
2019-11-20Tablegen: Remove the error for duplicate include files.River Riddle
This error was originally added a while(7 years) ago when including multiple files was basically always an error. Tablegen now has preprocessor support, which allows for building nice c/c++ style include guards. With the current error being reported, we unfortunately need to double guard when including files: * In user of MyFile.td #ifndef MYFILE_TD include MyFile.td #endif * In MyFile.td #ifndef MYFILE_TD #define MYFILE_TD ... #endif Differential Revision: https://reviews.llvm.org/D70410
2019-10-03Reland r349624: Let TableGen write output only if it changed, instead of ↵Nico Weber
doing so in cmake Move the write-if-changed logic behind a flag and don't pass it with the MSVC generator. msbuild doesn't have a restat optimization, so not doing write-if-change there doesn't have a cost, and it should fix whatever causes PR43385. llvm-svn: 373664
2019-10-01Revert rL349624 : Let TableGen write output only if it changed, instead of ↵Simon Pilgrim
doing so in cmake, attempt 2 Differential Revision: https://reviews.llvm.org/D55842 ----------------- As discussed on PR43385 this is causing Visual Studio msbuilds to perpetually rebuild all tablegen generated files llvm-svn: 373338
2019-09-11[TableGen] Skip CRLF conversion when writing outputReid Kleckner
Doing the CRLF translation while writing the file defeats our optimization to not update the file if it hasn't changed. Fixes PR43271. llvm-svn: 371683
2019-08-05Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song
F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
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
2018-12-19Let TableGen write output only if it changed, instead of doing so in cmake, ↵Nico Weber
attempt 2 This relands r330742: """ Let TableGen write output only if it changed, instead of doing so in cmake. Removes one subprocess and one temp file from the build for each tablegen invocation. No intended behavior change. """ In particular, if you see rebuilds after this change that you didn't see before this change, that's unintended and it's fine to revert this change again (but let me know). r330742 got reverted because some people reported that llvm-tblgen ran on every build after it. This could happen if the depfile output got deleted without deleting the main .inc output. To fix, make TableGen always write the depfile, but keep writing the main .inc output only if it has changed. This matches what we did in cmake before. Differential Revision: https://reviews.llvm.org/D55842 llvm-svn: 349624
2018-11-27[TableGen] Preprocessing supportVyacheslav Zakharin
Differential Revision: https://reviews.llvm.org/D54926 llvm-svn: 347686
2018-11-17Reverted r347092 due to the following build fails:Vyacheslav Zakharin
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 Zakharin
Differential Revision: https://reviews.llvm.org/D53840 llvm-svn: 347092
2018-05-07Revert r330742: Let TableGen write output only if it changed, instead of ↵Chandler Carruth
doing so in cmake. This change causes us to re-run tablegen for every single target on every single build. This is much, much worse than the problem being fixed AFAICT. On my system, it makes a clean rebuild of `llc` with nothing changed go from .5s to over 8s. On systems with less parallelism, slower file systems, or high process startup overhead this will be even more extreme. The only way I see this could be a win is in clean builds where we churn the filesystem. But I think incremental rebuild is more important, and so if we want to re-instate this, it needs to be done in a way that doesn't trigger constant re-runs of tablegen. llvm-svn: 331702
2018-05-01Remove \brief commands from doxygen comments.Adrian Prantl
We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
2018-04-24Let TableGen write output only if it changed, instead of doing so in cmake.Nico Weber
Removes one subprocess and one temp file from the build for each tablegen invocation. No intended behavior change. https://reviews.llvm.org/D45899 llvm-svn: 330742
2017-12-28Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer
Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
2017-09-23[Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner
This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
2016-12-05[TableGen] Centralize/Unify error handling.Davide Italiano
llvm-svn: 288724
2015-05-26[TableGen] Include header for each cpp file first. NFCCraig Topper
llvm-svn: 238180
2015-05-26[TableGen] Remove unneeded namespace around a function. Just put llvm:: on ↵Craig Topper
the definition since it's already declared in a header file. llvm-svn: 238178
2015-05-26[TableGen] Use 'static' instead of an anonymous namespace.Craig Topper
llvm-svn: 238177
2014-12-11Use range-based for loops. NFCCraig Topper
llvm-svn: 224005
2014-08-25Modernize raw_fd_ostream's constructor a bit.Rafael Espindola
Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
2014-08-21Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using ↵David Blaikie
std::unique_ptr llvm-svn: 216223
2014-07-06Update the MemoryBuffer API to use ErrorOr.Rafael Espindola
llvm-svn: 212405
2014-06-13Remove 'using std::errro_code' from lib.Rafael Espindola
llvm-svn: 210871
2014-06-12Don't use 'using std::error_code' in include/llvm.Rafael Espindola
This should make sure that most new uses use the std prefix. llvm-svn: 210835
2014-06-12Remove system_error.h.Rafael Espindola
This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
2014-04-29raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer
necessary. llvm-svn: 207593
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
2014-03-05[C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles
llvm-svn: 202957
2014-02-24Replace the F_Binary flag with a F_Text one.Rafael Espindola
After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
2014-02-24Don't make F_None the default.Rafael Espindola
This will make it easier to switch the default to being binary files. llvm-svn: 202042