[PATCH] D44329: [WebAssembly] Added initial AsmParser implementation.

Wouter van Oortmerssen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 14:37:46 PST 2018


aardappel created this revision.
aardappel added reviewers: jgravelle-google, dschuff, sunfish.
Herald added subscribers: aheejin, sbc100, mgorny, jfb.

It uses the MC framework and the tablegen matcher to do the
heavy lifting. Can handle both explicit and implicit locals
(-disable-wasm-explicit-locals). Comes with a small regression
test.

This is a first basic implementation that can parse most llvm .s
output and round-trips most instructions succesfully, but in order
to keep the commit small, does not address all issues.

There are a fair number of mismatches between what MC / assembly
matcher think a "CPU" should look like and what WASM provides,
some already have workarounds in this commit (e.g. the way it
deals with register operands) and some that require further work.
Some of that further work may involve changing what the
Disassembler outputs (and what s2wasm parses), so are probably
best left to followups.

Some known things missing:

- Many directives are ignored and not emitted.
- Vararg calls are parsed but extra args not emitted.
- Loop signatures are likely incorrect.
- $drop= is not emitted.
- Disassembler does not output SIMD types correctly, so assembler can't test them.


Repository:
  rL LLVM

https://reviews.llvm.org/D44329

Files:
  lib/MC/MCExpr.cpp
  lib/Target/WebAssembly/AsmParser/CMakeLists.txt
  lib/Target/WebAssembly/AsmParser/LLVMBuild.txt
  lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  lib/Target/WebAssembly/CMakeLists.txt
  lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
  lib/Target/WebAssembly/LLVMBuild.txt
  lib/Target/WebAssembly/WebAssemblyRegisterInfo.td
  test/MC/WebAssembly/basic-assembly.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44329.137843.patch
Type: text/x-patch
Size: 36480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180309/083d4b7f/attachment.bin>


More information about the llvm-commits mailing list