]> granicus.if.org Git - llvm/commit
[WebAssembly] Assembler/InstPrinter: support call_indirect type index.
authorWouter van Oortmerssen <aardappel@gmail.com>
Thu, 1 Aug 2019 18:08:26 +0000 (18:08 +0000)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 1 Aug 2019 18:08:26 +0000 (18:08 +0000)
commitd19209e69147291daa0135fafc6c17ac4df61f90
tree9c9d012e872ce76ebfc7aa207bf03a7f56543b97
parent20c752794313589620b5a6c4dc59dc68c47a88e7
[WebAssembly] Assembler/InstPrinter: support call_indirect type index.

A TYPE_INDEX operand (as used by call_indirect) used to be represented
by the InstPrinter as a symbol (e.g. .Ltype_index0@TYPE_INDEX) which
was a bit of a mismatch with the WasmObjectWriter which expects an
unnamed symbol, to receive the signature from and then turn into a
reloc.

There was really no good way to round-trip this information. An earlier
version of this patch tried to attach the signature information using
a .functype, but that ran into trouble when the symbol was re-emitted
without a name. Removing the name was a giant hack also.

The current version changes the assembly syntax to have an inline
signature spec for TYPEINDEX operands that is always unnamed, which
is much more elegant both in syntax and in implementation (as now the
assembler is able to follow the same path as the regular backend)

Reviewers: sbc100, dschuff, aheejin, jgravelle-google, sunfish, tlively

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367590 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
test/CodeGen/WebAssembly/reg-stackify.ll
test/MC/WebAssembly/basic-assembly.s
test/MC/WebAssembly/tail-call-encodings.s
test/MC/WebAssembly/type-index.s [new file with mode: 0644]