HomePhabricator

[WebAssembly] Added initial AsmParser implementation.

Authored by dschuff on Mar 20 2018, 1:06 PM.

Description

[WebAssembly] Added initial AsmParser implementation.

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.

Patch by Wouter van Oortmerssen

Differential Revision: https://reviews.llvm.org/D44329

llvm-svn: 328028

Details

Committed
dschuffMar 20 2018, 1:06 PM
Differential Revision
D44329: [WebAssembly] Added initial AsmParser implementation.
Parents
rG36afbee1d819: [AArch64] Adjust the cost model for Exynos M3
Branches
Unknown
Tags
Unknown