[PATCH] D45848: [WebAssembly] Initial Disassembler.

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 16:54:57 PDT 2018


dschuff added a comment.

haven't looked at most of the code, but thought about the register operand issue.



================
Comment at: lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp:170
+      case MCOI::OPERAND_REGISTER: {
+        // These are NOT actually in the instruction stream, but MC is going to
+        // expect operands to be present for them!
----------------
I think we will need to generate the register assignments, either here or in a post-processing step. I don't think it currently makes sense to have a second version of all the instructions with implicit operands (even though they wouldn't be needed by MC in explicit-locals mode).

You'd think it ought to be as simple as running a "pass" over the MCInsts, but  last I checked there wasn't really any facility for running passes over MC; it's structured much more like a stream. (and looking at the use of `getInstruction` in  e.g. LLVMDisasmInstruction in MCDisassembler or in llvm-objdump, it looks like the returned MCInsts just get passed directly through to the printer. We could maybe hang some state off of the WebAssemblyDisassembler?


Repository:
  rL LLVM

https://reviews.llvm.org/D45848





More information about the llvm-commits mailing list