[WebAssembly] Initial Disassembler.
authorSam Clegg <sbc@chromium.org>
Thu, 10 May 2018 22:16:44 +0000 (22:16 +0000)
committerSam Clegg <sbc@chromium.org>
Thu, 10 May 2018 22:16:44 +0000 (22:16 +0000)
commit16c16827bc7e21ff628e89562e32960eb3d7ca1d
tree5dab905667f9fdc837a4a8f21df3141fafd5ccff
parent65e9f1f2c9d5a9d4422472184ae9a6bb1e1d7552
[WebAssembly] Initial Disassembler.

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
12 files changed:
llvm/lib/Target/WebAssembly/CMakeLists.txt
llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
llvm/lib/Target/WebAssembly/WebAssembly.td
llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
llvm/test/MC/Disassembler/WebAssembly/lit.local.cfg [new file with mode: 0644]
llvm/test/MC/Disassembler/WebAssembly/wasm.txt [new file with mode: 0644]
llvm/unittests/MC/Disassembler.cpp
llvm/utils/TableGen/CMakeLists.txt
llvm/utils/TableGen/DisassemblerEmitter.cpp
llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp [new file with mode: 0644]
llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.h [new file with mode: 0644]