1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/MC/WebAssembly/tail-call-encodings.s
Wouter van Oortmerssen 83a02771fb [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

llvm-svn: 367590
2019-08-01 18:08:26 +00:00

24 lines
607 B
ArmAsm

# RUN: llvm-mc -show-encoding -triple=wasm32-unkown-unknown -mattr=+tail-call < %s | FileCheck %s
bar1:
.functype bar1 () -> ()
end_function
foo1:
.functype foo1 () -> ()
# CHECK: return_call bar1 # encoding: [0x12,
# CHECK-NEXT: fixup A - offset: 1, value: bar1, kind: fixup_uleb128_i32
return_call bar1
end_function
foo2:
.functype foo2 () -> ()
# CHECK: return_call_indirect (i32) -> (i32) # encoding: [0x13,
# CHECK-NEXT: fixup A - offset: 1, value: .Ltypeindex0@TYPEINDEX, kind: fixup_uleb128_i32
return_call_indirect (i32) -> (i32)
end_function