aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/TableGen.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-01-03[llvm-(min-)tblgen] Avoid redundant source compilation (#114494)Michael Kruse1-97/+0
All the sources of `llvm-min-tblgen` are also used for `llvm-tblgen`, with identical compilation flags. Reuse the object files of `llvm-min-tblgen` for `llvm-tblgen` by applying the usual source structure of an executable: One file per executable which named after the executable name containing the (in this case trivial) main function, which just calls the tblgen_main in TableGen.cpp. This should also clear up any confusion (including mine) of where each executable's main function is. While this slightly reduces build time, the main motivation is ccache. Using the hard_link option, building the object files for `llvm-tblgen` will result in a hard link to the same object file already used for `llvm-min-tblgen`. To signal the build system that the file is new, ccache will update the file's time stamp. Unfortunately, time stamps are shared between all hard-linked files s.t. this will indirectly also update the time stamps for the object files used for `llvm-tblgen`. At the next run, Ninja will recognize this time stamp discrepancy to the expected stamp recorded in `.ninja_log` and rebuild those object files for `llvm-min-tblgen`, which again will also update the stamp for the `llvm-tblgen`... . This is especially annoying for tablegen because it means Ninja will re-run all tablegenning in every build. I am using the hard_link option because it reduces the cost of having multiple build-trees of the LLVM sources and reduces the wear to the SSD they are stored on.
2025-01-02Revert "[llvm-(min-)tblgen] Avoid redundant source compilation (#114494)"Michael Kruse1-0/+97
This reverts commit f6cb56902c6dcafede21eb6662910b6ff661fc0f. Buildbot failures such as https://lab.llvm.org/buildbot/#/builders/89/builds/13541: ``` /usr/bin/ld: utils/TableGen/Basic/CMakeFiles/obj.LLVMTableGenBasic.dir/ARMTargetDefEmitter.cpp.o: undefined reference to symbol '_ZN4llvm23EnableABIBreakingChecksE' /usr/bin/ld: /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/./lib/libLLVMSupport.so.20.0git: error adding symbols: DSO missing from command line ``` Going to investigate.
2025-01-02[llvm-(min-)tblgen] Avoid redundant source compilation (#114494)Michael Kruse1-97/+0
All the sources of `llvm-min-tblgen` are also used for `llvm-tblgen`, with identical compilation flags. Reuse the object files of `llvm-min-tblgen` for `llvm-tblgen` by applying the usual source structure of an executable: One file per executable which named after the executable name containing the (in this case trivial) main function, which just calls the tblgen_main in TableGen.cpp. This should also clear up any confusion (including mine) of where each executable's main function is. While this slightly reduces build time, the main motivation is ccache. Using the hard_link option, building the object files for `llvm-tblgen` will result in a hard link to the same object file already used for `llvm-min-tblgen`. To signal the build system that the file is new, ccache will update the file's time stamp. Unfortunately, time stamps are shared between all hard-linked files s.t. this will indirectly also update the time stamps for the object files used for `llvm-tblgen`. At the next run, Ninja will recognize this time stamp discrepancy to the expected stamp recorded in `.ninja_log` and rebuild those object files for `llvm-min-tblgen`, which again will also update the stamp for the `llvm-tblgen`... . This is especially annoying for tablegen because it means Ninja will re-run all tablegenning in every build. I am using the hard_link option because it reduces the cost of having multiple build-trees of the LLVM sources and reduces the wear to the SSD they are stored on.
2024-10-29[TableGen] [NFC] Refine TableGen code to comply with `clang-tidy` checks ↵Jerry Sun1-6/+6
(#113318) Code cleanups for TableGen files, changes includes function names, variable names and unused imports. --------- Co-authored-by: Matt Arsenault <Matthew.Arsenault@amd.com>
2024-09-19[LLVM][TableGen] Change PrintEnums to use const RecordKeeper (#109200)Rahul Joshi1-2/+2
Change PrintEnums to use const RecordKeeper. 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-09-09[TableGen] Change SetTheory set/vec to use const Record * (#107692)Rahul Joshi1-1/+1
Change SetTheory::RecSet/RecVec to use const Record pointers.
2024-09-05[TableGen] Add const variants of accessors for backend (#106658)Rahul Joshi1-1/+1
Split RecordKeeper `getAllDerivedDefinitions` family of functions into two variants: (a) non-const ones that return vectors of `Record *` and (b) const ones, that return vector/ArrayRef of `const Record *`. This will help gradual migration of TableGen backends to use `const RecordKeeper` and by implication change code to work with const pointers and better const correctness. Existing backends are not yet compatible with the const family of functions, so change them to use a non-constant `RecordKeeper` reference, till they are migrated.
2024-08-26[TableGen] Allow emitter callbacks to use `const RecordKeeper &` (#104716)Rahul Joshi1-4/+4
- 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-08-21[NFC][TableGen] Change global variables from anonymous NS to static (#105504)Rahul Joshi1-12/+9
- Move global variables in TableGen.cpp out of anonymous namespace and make them static, per LLVM coding standards.
2023-03-21llvm-tblgen: Rewrite emitters to use `TableGen::Emitter`NAKAMURA Takumi1-251/+37
Each emitter became self-contained since it has the registration of option. Differential Revision: https://reviews.llvm.org/D144351
2023-03-21ReformatNAKAMURA Takumi1-6/+5
2023-02-19llvm-tblgen: ReformatNAKAMURA Takumi1-2/+1
2023-02-17llvm-tblgen: Apply IWYU partiallyNAKAMURA Takumi1-0/+4
2023-01-11[TargetParser] Generate the defs for RISCV CPUs using llvm-tblgen.Francesco Petrogalli1-2/+7
Rework the change to prevent build failures. NFCI. The failing code was submitted as cf7a8305a2b4ddfd299c748136cb9a2960ef7089 and reverted via 8bd65e535fb33bc48805bafed8217b16a853e158. The rework in this new commit prevents failures like the following: FAILED: tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/RISCV.cpp.o /usr/bin/c++ [bunch of non interesting stuff] -c <path-to>/llvm-project/clang/lib/Basic/Targets/RISCV.cpp In file included from <path-to>/llvm-project/clang/lib/Basic/Targets/RISCV.cpp:19: <path-to>/llvm-project/llvm/include/llvm/TargetParser/RISCVTargetParser.h:29:10: fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file or directory 29 | #include "llvm/TargetParser/RISCVTargetParserDef.inc" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These failures happen because the library LLVMTargetParser depends on RISCVTargetParserTableGen, which is a tablegen target that generates the list of CPUs in llvm/TargetParser/RISCVTargetParserDef.inc. This *.inc file is included by the public header file llvm/TargetParser/RISCVTargetParser.h. The header file llvm/TargetParser/RISCVTargetParser.h is also used in components (clangDriver and clangBasic) that link into LLVMTargetParser, but on some configurations such components might end up being built before TargetParser is ready. The fix is to make sure that clangDriver and clangBasic depend on the tablegen target RISCVTargetParserTableGen, which generates the .inc file whether or not LLVMTargetParser is ready. WRT the original patch at https://reviews.llvm.org/D137517, this commit is just adding RISCVTargetParserTableGen in the DEPENDS list of clangDriver and clangBasic.
2023-01-11Revert "[TargetParser] Generate the defs for RISCV CPUs using llvm-tblgen."Francesco Petrogalli1-7/+2
This reverts commit cf7a8305a2b4ddfd299c748136cb9a2960ef7089.
2023-01-11[TargetParser] Generate the defs for RISCV CPUs using llvm-tblgen.Francesco Petrogalli1-2/+7
This patch removes the file `llvm/include/llvm/TargetParser/RISCVTargetParser.def` and replaces it with a tablegen-generated `.inc` file out of `llvm/lib/Target/RISCV/RISCV.td`. The module system has been updated to make sure we can build clang/llvm with `-DLLVM_ENABLE_MODULES=On` Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D137517
2022-06-14[TableGen][DirectX] Add tableGen backend to generate DXIL operation for ↵python3kgae1-1/+7
DirectX backend. A new tableGen backend gen-dxil-enum is added to generate enum for DXIL operation and operation class. A new file "DXILConstants.inc" will be generated when build DirectX target which include the enums. More tableGen backends will be added to replace manually written table in DirectX backend. The unused fields in dxil_inst will be used in future PR. Reviewed By: bogner Differential Revision: https://reviews.llvm.org/D125435
2022-05-30[TableGen] Remove code beadsSheng1-6/+0
Code beads is useless since the only user, M68k, has moved on to a new encoding/decoding infrastructure. Reviewed By: myhsu Differential Revision: https://reviews.llvm.org/D126349
2022-05-24Revert "[TableGen] Remove code beads"Sylvestre Ledru1-0/+6
It is breaking the build with: /build/llvm-toolchain-snapshot-15~++20220524114008+96323c9f4c10/llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp:478:10: fatal error: 'M68kGenMCCodeBeads.inc' file not found ^~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. Remove the #include causes: error: undefined reference to 'llvm::M68k::getMCInstrBeads(unsigned int)' This reverts commit f50be3d21808ae113c40a68a9ac6581f203d92d2.
2022-05-24[TableGen] Remove code beadsSheng1-6/+0
Code beads is useless since the only user, M68k, has moved on to a new encoding/decoding infrastructure.
2022-03-18[TableGen] X86 mnemonic tables backendAmir Ayupov1-0/+6
Add tablegen backend that generates X86 mnemonic-based opcode groupings, e.g. `isADD`, `isTEST`, etc. Addresses https://lists.llvm.org/pipermail/llvm-dev/2022-January/154526.html Reviewed By: skan Differential Revision: https://reviews.llvm.org/D121571
2022-01-28[tblgen] Disable lsan weak hook when building with msvcPierre Gousseau1-1/+2
This change is to fix a link time error when building llvm with msvc. MSVC's implementation does not support weak hook or lsan so this change disables lsan's weak hook definition. Only GCC supports LSan. Tested with visual studio 2019 v16.9.6 Reviewed By: aaron.ballman, rnk Differential Revision: https://reviews.llvm.org/D118162
2021-03-23[openacc][openmp] Reduce number of generated file and prefer inclusion of .incValentin Clement1-7/+1
Follow up from D92955 and D83636. This patch makes the base cpp files OMP.cpp and ACC.cpp normal files and they now include the XXX.inc file generated by tablegen. This reduces the number of file generated by the DirectiveEmitter backend and makes it closer to the proposal in D83636. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D93560
2021-03-08[M68k][TableGen](1/8) TableGen related changesMin-Yih Hsu1-0/+6
- Add a new TableGen backend: CodeBeads - Add support to generate logical operand information For the first item, it is currently a workaround of M68k's (complex) instruction encoding. A typical architecture, especially CISC one like X86, normally uses `MCInstrDesc::TSFlags` to carry instruction encoding info. However, at the early days of M68k backend development, we found it difficult to fit every possible encoding into the 64-bit `MCInstrDesc::TSFlags`. Therefore CodeBeads was invented to provide an alternative, arbitrary length container for instruciton encoding info. However, in the long term we incline not to use a new TG backend for less common pattern like what we encountered in M68k. A bug has been created to host to discussion on migrating from CodeBeads to more concise solution: https://bugs.llvm.org/show_bug.cgi?id=48792 The second item was also served for similar purpose. It created utility functions that tell you the index of a `MachineOperand` in a `MachineInst` given a logical operand index. In normal cases a logical operand is the same as `MachineOperand`, but for operands using complex addressing mode a logical operand might be consisting of multiple `MachineOperand`. The TableGen-ed `getLogicalOperandIdx`, for instance, can give you the mapping between these two concepts. Nevertheless, we hope to remove this feature in the future if possible. Since it's not really useful for the targets supported by LLVM now either. Authors: myhsu, m4yers, glaubitz Differential Revision: https://reviews.llvm.org/D88385
2020-11-14[TableGen] Add frontend/backend phase timing capability.Paul C. Anagnostopoulos1-9/+6
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. Anagnostopoulos1-0/+6
Pertinent lints are fixed.
2020-07-28[Support] Use InitLLVM in llvm-stress, sancov and TableGenAnirudh Prasad1-7/+2
This patch refactors the llvm tools namely, llvm-stress and sancov, as well as the llvm TableGen utility, to use the new InitLLVM interface which encapsulates PrettyStackTrace. This is from https://reviews.llvm.org/D70702, but only for LLVM. Reviewed-by: Kai Differential Revision: https://reviews.llvm.org/D83484
2020-07-11[flang][openmp] Check clauses allowed semantic with tablegen generated mapValentin Clement1-2/+8
Summary: This patch is enabling the generation of clauses enum sets for semantics check in Flang through tablegen. Enum sets and directive - sets map is generated by the new tablegen infrsatructure for OpenMP and other directive languages. The semantic checks for OpenMP are modified to use this newly generated map. Reviewers: DavidTruby, sscalpone, kiranchandramohan, ichoyjx, jdoerfert Reviewed By: DavidTruby, ichoyjx Subscribers: mgorny, yaxunl, hiraditya, guansong, sstefan1, aaron.ballman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D83326
2020-06-30[openmp] Move Directive and Clause helper function to tablegenValentin Clement1-5/+11
Summary: Follow up to D81736. Move getOpenMPDirectiveKind, getOpenMPClauseKind, getOpenMPDirectiveName and getOpenMPClauseName to the new tablegen code generation. The code is generated in a new file named OMP.cpp.inc Reviewers: jdoerfert, jdenny, thakis Reviewed By: jdoerfert, jdenny Subscribers: mgorny, yaxunl, hiraditya, guansong, sstefan1, llvm-commits, thakis Tags: #llvm Differential Revision: https://reviews.llvm.org/D82405
2020-06-23[openmp] Base of tablegen generated OpenMP common declarationValentin Clement1-1/+7
Summary: As discussed previously when landing patch for OpenMP in Flang, the idea is to share common part of the OpenMP declaration between the different Frontend. While doing this it was thought that moving to tablegen instead of Macros will also give a cleaner and more powerful way of generating these declaration. This first part of a future series of patches is setting up the base .td file for DirectiveLanguage as well as the OpenMP version of it. The base file is meant to be used by other directive language such as OpenACC. In this first patch, the Directive and Clause enums are generated with tablegen instead of the macros on OMPConstants.h. The next pacth will extend this to other enum and move the Flang frontend to use it. Reviewers: jdoerfert, DavidTruby, fghanim, ABataev, jdenny, hfinkel, jhuber6, kiranchandramohan, kiranktp Reviewed By: jdoerfert, jdenny Subscribers: arphaman, martong, cfe-commits, mgorny, yaxunl, hiraditya, guansong, jfb, sstefan1, aaron.ballman, llvm-commits Tags: #llvm, #openmp, #clang Differential Revision: https://reviews.llvm.org/D81736
2020-06-22Revert commit 9e52530 because of dependencies issueValentin Clement1-7/+1
This reverts commit 9e525309fb3cbea4ab341b54d127d97831962285.
2020-06-22[openmp] Base of tablegen generated OpenMP common declarationValentin Clement1-1/+7
Summary: As discussed previously when landing patch for OpenMP in Flang, the idea is to share common part of the OpenMP declaration between the different Frontend. While doing this it was thought that moving to tablegen instead of Macros will also give a cleaner and more powerful way of generating these declaration. This first part of a future series of patches is setting up the base .td file for DirectiveLanguage as well as the OpenMP version of it. The base file is meant to be used by other directive language such as OpenACC. In this first patch, the Directive and Clause enums are generated with tablegen instead of the macros on OMPConstants.h. The next pacth will extend this to other enum and move the Flang frontend to use it. Reviewers: jdoerfert, DavidTruby, fghanim, ABataev, jdenny, hfinkel, jhuber6, kiranchandramohan, kiranktp Reviewed By: jdoerfert, jdenny Subscribers: cfe-commits, mgorny, yaxunl, hiraditya, guansong, jfb, sstefan1, aaron.ballman, llvm-commits Tags: #llvm, #openmp, #clang Differential Revision: https://reviews.llvm.org/D81736
2020-01-27[tablegen] Emit string literals instead of char arraysLuke Drummond1-0/+6
This changes the generated (Instr|Asm|Reg|Regclass)Name tables from this form: extern const char HexagonInstrNameData[] = { /* 0 */ 'G', '_', 'F', 'L', 'O', 'G', '1', '0', 0, /* 9 */ 'E', 'N', 'D', 'L', 'O', 'O', 'P', '0', 0, /* 18 */ 'V', '6', '_', 'v', 'd', 'd', '0', 0, /* 26 */ 'P', 'S', '_', 'v', 'd', 'd', '0', 0, [...] }; ...to this: extern const char HexagonInstrNameData[] = { /* 0 */ "G_FLOG10\0" /* 9 */ "ENDLOOP0\0" /* 18 */ "V6_vdd0\0" /* 26 */ "PS_vdd0\0" [...] }; This should make debugging and exploration a lot easier for mortals, while providing a significant compile-time reduction for common compilers. To avoid issues with low implementation limits, this is disabled by default for visual studio. To force output one way or the other, pass `--long-string-literals=<bool>` to `tablegen` Reviewers: mstorsjo, rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D73044 A variation of this patch was originally committed in ce23515f5ab011 and then reverted in e464b31c due to build failures.
2020-01-23Revert "[tablegen] Emit string literals instead of char arrays"Sergej Jaskiewicz1-6/+0
This reverts commit ce23515f5ab01161c98449d833b3ae013b553aa8. That commit broke some builds on Windows: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13870
2020-01-23[tablegen] Emit string literals instead of char arraysLuke Drummond1-0/+6
This changes the generated (Instr|Asm|Reg|Regclass)Name tables from this form: extern const char HexagonInstrNameData[] = { /* 0 */ 'G', '_', 'F', 'L', 'O', 'G', '1', '0', 0, /* 9 */ 'E', 'N', 'D', 'L', 'O', 'O', 'P', '0', 0, /* 18 */ 'V', '6', '_', 'v', 'd', 'd', '0', 0, /* 26 */ 'P', 'S', '_', 'v', 'd', 'd', '0', 0, [...] }; ...to this: extern const char HexagonInstrNameData[] = { /* 0 */ "G_FLOG10\0" /* 9 */ "ENDLOOP0\0" /* 18 */ "V6_vdd0\0" /* 26 */ "PS_vdd0\0" [...] }; This should make debugging and exploration a lot easier for mortals, while providing a significant compile-time reduction for common compilers. To avoid issues with low implementation limits, this is disabled by default for visual studio or when cross-compiling. To force output one way or the other, pass `--long-string-literals=<bool>` to `tablegen` Reviewers: mstorsjo, rnk Subscribers: llvm-commit Differential Revision: https://reviews.llvm.org/D73044
2019-12-11[TableGen] Remove unused target intrinsic generation logicReid Kleckner1-12/+0
AMDGPU was the last in tree target to use this tablegen mode. I plan to split up the global intrinsic enum similar to the way that clang diagnostics are split up today. I don't plan to build on this mode. Reviewers: arsenm, echristo, efriedma Reviewed By: echristo Differential Revision: https://reviews.llvm.org/D71318
2019-11-25Revert "Use InitLLVM to setup a pretty stack printer"Nico Weber1-2/+2
This reverts commit 3f76260dc0674cc0acb25f550a0f0c594cf537ea. Breaks at least these tests on Windows: Clang :: Driver/clang-offload-bundler.c Clang :: Driver/clang-offload-wrapper.c
2019-11-26Use InitLLVM to setup a pretty stack printerRui Ueyama1-2/+2
InitLLVM does not only save a few lines from main() but also makes the commands do the right thing for multibyte character pathnames on Windows (i.e. canonicalize argv's to UTF-8) because of the code we have in this file: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/InitLLVM.cpp#L32 For many LLVM commands, we already have calls of InitLLVM, but there are still remainings. Differential Revision: https://reviews.llvm.org/D70702
2019-11-22[TableGen] Add backend to generate command guide for tools using libOption.Jonas Devlieghere1-2/+6
For lldb and dsymutil, the command guide is essentially a copy of its help output generated by libOption. Making sure the two stay in sync is tedious and error prone. Given that we already generate the help from a tablegen file, we might as well generate the RST as well. This adds a tablegen backend for generating Sphinx/RST command guides from the tablegen file. Differential revision: https://reviews.llvm.org/D70610
2019-10-04[TableGen] Introduce a generic automaton (DFA) backendJames Molloy1-1/+7
Summary: This patch introduces -gen-automata, a backend for generating deterministic finite-state automata. DFAs are already generated by the -gen-dfa-packetizer backend. This backend is more generic and will hopefully be used to implement the DFA generation (and determinization) for the packetizer in the future. This backend allows not only generation of a DFA from an NFA (nondeterministic finite-state automaton), it also emits sidetables that allow a path through the DFA under a sequence of inputs to be analyzed, and the equivalent set of all possible NFA transitions extracted. This allows a user to not just answer "can my problem be solved?" but also "what is the solution?". Clearly this analysis is more expensive than just playing a DFA forwards so is opt-in. The DFAPacketizer has this behaviour already but this is a more compact and generic representation. Examples are bundled in unittests/TableGen/Automata.td. Some are trivial, but the BinPacking example is a stripped-down version of the original target problem I set out to solve, where we pack values (actually immediates) into bins (an immediate pool in a VLIW bundle) subject to a set of esoteric constraints. Reviewers: t.p.northover Subscribers: mgorny, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67968 llvm-svn: 373718
2019-10-02[gicombiner] Add the boring boilerplate for the declarative combinerDaniel Sanders1-0/+6
Summary: This is the first of a series of patches extracted from a much bigger WIP patch. It merely establishes the tblgen pass and the way empty combiner helpers are declared and integrated into a combiner info. The tablegen pass takes a -combiners option to select the combiner helper that will be generated. This can be given multiple values to generate multiple combiner helpers at once. Doing so helps to minimize parsing overhead. The reason for creating a GlobalISel subdirectory in utils/TableGen is that there will be quite a lot of non-pass files (~15) by the time the patch series is done. Reviewers: volkan Subscribers: mgorny, hiraditya, simoncook, Petar.Avramovic, s.egerton, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68286 llvm-svn: 373527
2019-10-02Fix inconsistent indentation in TableGen.cppDaniel Sanders1-68/+64
The anonymous namespace starts out (incorrectly) indented but isn't indented from the TimeRegionsOpt declaration onwards. llvm-svn: 373516
2019-09-24[tblgen] Disable Leak detection for ASan/GCC and LSan/LLVMKamil Rytarowski1-4/+9
Summary: Add support for sanitizing TableGen.cpp with ASan/GCC and LSan/LLVM. Reviewers: fjricci, kcc, aaron.ballman, mgorny Reviewed By: fjricci Subscribers: jakubjelinek, llvm-commits, #llvm Tags: #llvm Differential Revision: https://reviews.llvm.org/D67908 llvm-svn: 372731
2019-02-11[tblgen] Add a timer covering the time spent reading the Instruction defsDaniel Sanders1-0/+11
This patch adds a -time-regions option to tablegen that can enable timers (currently only one) that assess the performance of tablegen itself. This can be useful for identifying scaling problems with tablegen backends. This particular timer has allowed me to ignore time that is not attributed the GISel combiner pass. It's useful by itself but it is particularly useful in combination with https://reviews.llvm.org/D52954 which causes this period of time to be annotated within Xcode Instruments which in turn allows profile samples and recorded allocations attributed to reading instructions to be filtered out. llvm-svn: 353763
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-10-25[MCSched] Bind PFM Counters to the CPUs instead of the SchedModel.Clement Courbet1-1/+7
Summary: The pfm counters are now in the ExegesisTarget rather than the MCSchedModel (PR39165). This also compresses the pfm counter tables (PR37068). Reviewers: RKSimon, gchatelet Subscribers: mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D52932 llvm-svn: 345243
2018-10-22[WebAssembly][NFC] Remove WebAssemblyStackifier TableGen backendThomas Lively1-7/+1
Summary: Replace its functionality with a TableGen InstrInfo relational instruction mapping. Although arguably more complex than the TableGen backend, the relational mapping is a smaller maintenance burden than a TableGen backend. Reviewers: aardappel, aheejin, dschuff Subscribers: mgorny, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D53307 llvm-svn: 344962
2018-08-27[WebAssembly] TableGen backend for stackifying instructionsThomas Lively1-1/+7
Summary: The new stackification backend generates the giant switch statement used to translate instructions to their stackified forms. I did this because it was more interesting than adding all the different vector versions of the various SIMD instructions to the switch statment manually. Reviewers: aardappel, aheejin, dschuff Subscribers: mgorny, sbc100, jgravelle-google, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D51318 llvm-svn: 340781
2018-07-11[TableGen] Add a general-purpose JSON backend.Simon Tatham1-0/+6
The aim of this backend is to output everything TableGen knows about the record set, similarly to the default -print-records backend. But where -print-records produces output in TableGen's input syntax (convenient for humans to read), this backend produces it as structured JSON data, which is convenient for loading into standard scripting languages such as Python, in order to extract information from the data set in an automated way. The output data contains a JSON representation of the variable definitions in output 'def' records, and a few pieces of metadata such as which of those definitions are tagged with the 'field' prefix and which defs are derived from which classes. It doesn't dump out absolutely every piece of knowledge it _could_ produce, such as type information and complicated arithmetic operator nodes in abstract superclasses; the main aim is to allow consumers of this JSON dump to essentially act as new backends, and backends don't generally need to depend on that kind of data. The new backend is implemented as an EmitJSON() function similar to all of llvm-tblgen's other EmitFoo functions, except that it lives in lib/TableGen instead of utils/TableGen on the basis that I'm expecting to add it to clang-tblgen too in a future patch. To test it, I've written a Python script that loads the JSON output and tests properties of it based on comments in the .td source - more or less like FileCheck, except that the CHECK: lines have Python expressions after them instead of textual pattern matches. Reviewers: nhaehnle Reviewed By: nhaehnle Subscribers: arichardson, labath, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46054 llvm-svn: 336771
2018-06-23[IR] Split Intrinsics.inc into enums and implementationsReid Kleckner1-8/+20
Implements PR34259 Intrinsics.h is a very popular header. Most LLVM TUs care about things like dbg_value, but they don't care how they are implemented. After I split these out, IntrinsicImpl.inc is 1.7 MB, so this saves each LLVM TU from scanning 1.7 MB of source that gets pre-processed away. It also means we can modify intrinsic properties without triggering a full rebuild, but that's probably less of a win. I think the next best thing to do would be to split out the target intrinsics into their own header. Very, very few TUs care about target-specific intrinsics. It's very hard to split up the target independent intrinsics like llvm.expect, assume, and dbg.value, though. llvm-svn: 335407