-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
12 changed files
with
375 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| if not 'WebAssembly' in config.root.targets: | ||
| config.unsupported = True | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # RUN: llvm-mc --disassemble %s -triple=wasm32-unknown-unknown | FileCheck %s | ||
|
|
||
| # CHECK: .text | ||
|
|
||
| # CHECK: nop | ||
| 0x01 | ||
|
|
||
| # CHECK: i32.add $0=, $0, $0 | ||
| # NOTE: registers are meaningless, as there is no context for what they are. | ||
| 0x6a | ||
|
|
||
| # CHECK: i64.const $0=, -1 | ||
| 0x42 0x7F | ||
|
|
||
| # CHECK: i64.load32_u $0=, 16($0):p2align=1 | ||
| 0x35 0x01 0x10 | ||
|
|
||
| # CHECK: block | ||
| # 3 | ||
| # FIXME: WebAssemblyInstPrinter does not currently print block number. | ||
| 0x02 0x03 | ||
|
|
||
| # CHECK: call_indirect | ||
| # $0=, 128, 0 | ||
| # FIXME: WebAssemblyInstPrinter does not print immediates. | ||
| 0x11 0x80 0x01 0x00 | ||
|
|
||
| # CHECK: get_local $0=, 128 | ||
| 0x20 0x80 0x01 | ||
|
|
||
| # Prefix byte example: | ||
| # CHECK: i64.trunc_u:sat/f64 $0=, $0 | ||
| 0xFC 0x07 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.