summaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
AgeCommit message (Collapse)Author
2025-04-17[NFC][TableGen] Code cleanup in Wasm disassember emitter (#135992)Rahul Joshi
- Use range for loop to iterate over instructions. - Emit generated code in anonymous namespace instead of `llvm` and reduce the scope of this to just the type declarations. - Emit generated tables as static constexpr - Replace code to search in operand table with `std::search`. - Skip the last "null" entry in PrefixTable and use range for loop to search PrefixTable in the .cpp code. - Do not generate `WebAssemblyInstructionTableSize` definition as its already defined in the .cpp file. - Remove {} for single statement loop/if/else bodies.
2025-01-16[TableGen] Use std::pair instead of std::make_pair. NFC. (#123174)Jay Foad
Also use brace initialization and emplace to avoid explicitly constructing std::pair, and the same for std::tuple.
2024-09-18[LLVM][TableGen] Change WebAsm Emitter to use const RecordKeeper (#109051)Rahul Joshi
Change WebAssemblyDisassemblerEmitter 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-03-25[RFC][TableGen] Restructure TableGen Source (#80847)Pierre van Houtryve
Refactor of the llvm-tblgen source into: - a "Basic" library, which contains the bare minimum utilities to build `llvm-min-tablegen` - a "Common" library which contains all of the helpers for TableGen backends. Such helpers can be shared by more than one backend, and even unit tested (e.g. CodeExpander is, maybe we can add more over time) Fixes #80647
2024-02-14[TableGen] Stop using make_pair and make_tuple. NFC. (#81730)Jay Foad
These are unnecessary since C++17.
2024-02-09[NFC] clang-format utils/TableGen (#80973)Pierre van Houtryve
``` find llvm/utils/TableGen -iname "*.h" -o -iname "*.cpp" | xargs clang-format-16 -i ``` Split from #80847
2022-05-17[WebAssembly][NFC] Convert StackBased instruction field to 'bit' from stringAlex Bradbury
This is (IMHO) cleaner and (objectively) more strongly typed than using strings. A follow-on patch will do the same for IsWasm64. Differential Revision: https://reviews.llvm.org/D125713
2022-05-16[WebAssembly][TableGen][NFCI] Use getValueAsBit rather than converting ↵Alex Bradbury
TableGen 'bit' to string The logic around IsCanonical previously used getAsString and compared to "1". Just using getValueAsBit is simpler.
2022-05-11[TableGen] Remove the use of global Record stateRiver Riddle
This commits removes TableGens reliance on managed static global record state by moving the RecordContext into the RecordKeeper. The RecordKeeper is now treated similarly to a (LLVM|MLIR|etc)Context object and is passed to static construction functions. This is an important step forward in removing TableGens reliance on global state, and in a followup will allow for users that parse tablegen to parse multiple tablegen files without worrying about Record lifetime. Differential Revision: https://reviews.llvm.org/D125276
2022-01-31Cleanup llvm/utils/TableGen headersserge-sans-paille
Based on the output of include-what-you-use. It's an utility directory, so no much impact on other code areas. clang++ -E -Iinclude -I../llvm/include ../llvm/utils/TableGen/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 4327274 after: 4316190 Related discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D118466
2021-01-02[TableGen] Use llvm::append_range (NFC)Kazu Hirata
2020-10-28[WebAssembly] Prototype extending multiplication SIMD instructionsThomas Lively
As proposed in https://github.com/WebAssembly/simd/pull/376. This commit implements new builtin functions and intrinsics for these instructions, but does not yet add them to wasm_simd128.h because they have not yet been merged to the proposal. These are the first instructions with opcodes greater than 0xff, so this commit updates the MC layer and disassembler to handle that correctly. Differential Revision: https://reviews.llvm.org/D90253
2019-08-25[TableGen] Correct comments for end of namespace. NFCBjorn Pettersson
Summary: Update end-of-namespace comments generated by tablegen emitters to fulfill the rules setup by clang-tidy's llvm-namespace-comment checker. Fixed a few end-of-namespace comments in the tablegen source code as well. Reviewers: craig.topper Reviewed By: craig.topper Subscribers: craig.topper, stoklund, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66396 llvm-svn: 369865
2019-02-05Fix typo in comment, NFCIKrasimir Georgiev
llvm-svn: 353176
2019-02-05[WebAssembly] Make disassembler always emit most canonical name.Wouter van Oortmerssen
Summary: There are a few instructions that all map to the same opcode, so when disassembling, we have to pick one. That was just the first one before (the except_ref variant in the case of "call"), now it is the one marked as IsCanonical in tablegen, or failing that, the shortest name (which is typically the "canonical" one). Also introduced a canonical "end" instruction for this purpose. Reviewers: dschuff, tlively Subscribers: sbc100, jgravelle-google, aheejin, llvm-commits, sunfish Tags: #llvm Differential Revision: https://reviews.llvm.org/D57713 llvm-svn: 353131
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
2019-01-03[WebAssembly] Fixed disassembler not knowing about new brlist operandWouter van Oortmerssen
Summary: The previously introduced new operand type for br_table didn't have a disassembler implementation, causing an assert. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56227 llvm-svn: 350366
2018-11-09[WebAssembly] Read prefixed opcodes as ULEB128sThomas Lively
Summary: Depends on D54126. Reviewers: aheejin, dschuff, aardappel Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54138 llvm-svn: 346465
2018-10-22[WebAssembly][NFC] Remove WebAssemblyStackifier TableGen backendThomas Lively
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-30[WebAssembly] Made disassembler only use stack instructions.Wouter van Oortmerssen
Summary: Now uses the StackBased bit from the tablegen defs to identify stack instructions (and ignore register based or non-wasm instructions). Also changed how we store operands, since we now have up to 16 of them per instruction. To not cause static data bloat, these are compressed into a tiny table. + a few other cleanups. Tested: - MCTest - llvm-lit -v `find test -name WebAssembly` Reviewers: dschuff, jgravelle-google, sunfish, tlively Subscribers: sbc100, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D51320 llvm-svn: 341081
2018-05-10[WebAssembly] Initial Disassembler.Sam Clegg
This implements a new table-gen emitter to create tables for a wasm disassembler, and a dissassembler to use them. Comes with 2 tests, that tests a few instructions manually. Is also able to disassemble large .wasm files with objdump reasonably. Not working so well, to be addressed in followups: - objdump appears to be passing an incorrect starting point. - since the disassembler works an instruction at a time, and it is disassembling stack instruction, it has no idea of pseudo register assignments. These registers are required for the instruction printing code that follows. For now, all such registers appear in the output as $0. Patch by Wouter van Oortmerssen Differential Revision: https://reviews.llvm.org/D45848 llvm-svn: 332052