diff --git a/lld/test/wasm/Inputs/globals.yaml b/lld/test/wasm/Inputs/globals.yaml --- a/lld/test/wasm/Inputs/globals.yaml +++ b/lld/test/wasm/Inputs/globals.yaml @@ -5,8 +5,9 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I64 ParamTypes: + ReturnTypes: + - I64 - Type: FUNCTION FunctionTypes: [ 0 ] - Type: GLOBAL diff --git a/lld/test/wasm/Inputs/undefined-globals.yaml b/lld/test/wasm/Inputs/undefined-globals.yaml --- a/lld/test/wasm/Inputs/undefined-globals.yaml +++ b/lld/test/wasm/Inputs/undefined-globals.yaml @@ -5,8 +5,9 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I64 ParamTypes: + ReturnTypes: + - I64 - Type: IMPORT Imports: - Module: env diff --git a/lld/test/wasm/alias.ll b/lld/test/wasm/alias.ll --- a/lld/test/wasm/alias.ll +++ b/lld/test/wasm/alias.ll @@ -19,8 +19,8 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0 ] ; CHECK-NEXT: - Type: TABLE diff --git a/lld/test/wasm/call-indirect.ll b/lld/test/wasm/call-indirect.ll --- a/lld/test/wasm/call-indirect.ll +++ b/lld/test/wasm/call-indirect.ll @@ -40,22 +40,25 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I64 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I64 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 2 -; CHECK-NEXT: ReturnType: I64 ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I64 +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I64 ; CHECK-NEXT: - Index: 3 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 4 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 3, 1, 3, 4 ] ; CHECK-NEXT: - Type: TABLE diff --git a/lld/test/wasm/event-section.ll b/lld/test/wasm/event-section.ll --- a/lld/test/wasm/event-section.ll +++ b/lld/test/wasm/event-section.ll @@ -20,12 +20,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK: - Type: EVENT ; CHECK-NEXT: Events: diff --git a/lld/test/wasm/function-imports-first.ll b/lld/test/wasm/function-imports-first.ll --- a/lld/test/wasm/function-imports-first.ll +++ b/lld/test/wasm/function-imports-first.ll @@ -17,12 +17,13 @@ ; CHECK: - Type: TYPE ; CHECK: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - F32 +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1 ] ; CHECK: - Type: CODE diff --git a/lld/test/wasm/function-imports.ll b/lld/test/wasm/function-imports.ll --- a/lld/test/wasm/function-imports.ll +++ b/lld/test/wasm/function-imports.ll @@ -18,12 +18,13 @@ ; CHECK: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - F32 +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1 ] ; CHECK: - Type: CODE diff --git a/lld/test/wasm/function-index.test b/lld/test/wasm/function-index.test --- a/lld/test/wasm/function-index.test +++ b/lld/test/wasm/function-index.test @@ -7,12 +7,14 @@ CHECK: - Type: TYPE CHECK: Signatures: CHECK: - Index: 0 -CHECK: ReturnType: I32 CHECK: ParamTypes: CHECK: - F32 +CHECK: ReturnTypes: +CHECK: - I32 CHECK: - Index: 1 -CHECK: ReturnType: I64 CHECK: ParamTypes: CHECK: - F64 +CHECK: ReturnTypes: +CHECK: - I64 CHECK: - Type: FUNCTION CHECK: FunctionTypes: [ 0, 1 ] diff --git a/lld/test/wasm/gc-sections.ll b/lld/test/wasm/gc-sections.ll --- a/lld/test/wasm/gc-sections.ll +++ b/lld/test/wasm/gc-sections.ll @@ -38,14 +38,16 @@ ; CHECK: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 2 -; CHECK-NEXT: ReturnType: I64 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I64 ; CHECK-NEXT: - Type: FUNCTION ; CHECK: - Type: GLOBAL @@ -64,7 +66,7 @@ ; CHECK-NEXT: Value: 456 ; CHECK: - Type: DATA -; CHECK-NEXT: Segments: +; CHECK-NEXT: Segments: ; CHECK-NEXT: - SectionOffset: 7 ; CHECK-NEXT: InitFlags: 0 ; CHECK-NEXT: Offset: @@ -89,18 +91,21 @@ ; NO-GC: - Type: TYPE ; NO-GC-NEXT: Signatures: ; NO-GC-NEXT: - Index: 0 -; NO-GC-NEXT: ReturnType: NORESULT -; NO-GC-NEXT: ParamTypes: +; NO-GC-NEXT: ParamTypes: [] +; NO-GC-NEXT: ReturnTypes: [] ; NO-GC-NEXT: - Index: 1 -; NO-GC-NEXT: ReturnType: I64 ; NO-GC-NEXT: ParamTypes: ; NO-GC-NEXT: - I64 +; NO-GC-NEXT: ReturnTypes: +; NO-GC-NEXT: - I64 ; NO-GC-NEXT: - Index: 2 -; NO-GC-NEXT: ReturnType: I32 -; NO-GC-NEXT: ParamTypes: +; NO-GC-NEXT: ParamTypes: [] +; NO-GC-NEXT: ReturnTypes: +; NO-GC-NEXT: - I32 ; NO-GC-NEXT: - Index: 3 -; NO-GC-NEXT: ReturnType: I64 -; NO-GC-NEXT: ParamTypes: +; NO-GC-NEXT: ParamTypes: [] +; NO-GC-NEXT: ReturnTypes: +; NO-GC-NEXT: - I64 ; NO-GC-NEXT: - Type: FUNCTION ; NO-GC: - Type: GLOBAL @@ -125,7 +130,7 @@ ; NO-GC-NEXT: Value: 456 ; NO-GC: - Type: DATA -; NO-GC-NEXT: Segments: +; NO-GC-NEXT: Segments: ; NO-GC-NEXT: - SectionOffset: 7 ; NO-GC-NEXT: InitFlags: 0 ; NO-GC-NEXT: Offset: diff --git a/lld/test/wasm/local-symbols.ll b/lld/test/wasm/local-symbols.ll --- a/lld/test/wasm/local-symbols.ll +++ b/lld/test/wasm/local-symbols.ll @@ -27,11 +27,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1 ] ; CHECK-NEXT: - Type: TABLE diff --git a/lld/test/wasm/locals-duplicate.test b/lld/test/wasm/locals-duplicate.test --- a/lld/test/wasm/locals-duplicate.test +++ b/lld/test/wasm/locals-duplicate.test @@ -10,8 +10,9 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; CHECK-NEXT: 0, 0 ] @@ -220,8 +221,9 @@ ; RELOC-NEXT: - Type: TYPE ; RELOC-NEXT: Signatures: ; RELOC-NEXT: - Index: 0 -; RELOC-NEXT: ReturnType: I32 -; RELOC-NEXT: ParamTypes: +; RELOC-NEXT: ParamTypes: [] +; RELOC-NEXT: ReturnTypes: +; RELOC-NEXT: - I32 ; RELOC-NEXT: - Type: FUNCTION ; RELOC-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; RELOC-NEXT: 0, 0 ] diff --git a/lld/test/wasm/relocatable.ll b/lld/test/wasm/relocatable.ll --- a/lld/test/wasm/relocatable.ll +++ b/lld/test/wasm/relocatable.ll @@ -44,15 +44,16 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 2 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK-NEXT: - Module: env diff --git a/lld/test/wasm/stack-pointer.ll b/lld/test/wasm/stack-pointer.ll --- a/lld/test/wasm/stack-pointer.ll +++ b/lld/test/wasm/stack-pointer.ll @@ -18,8 +18,9 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK-NEXT: - Module: env diff --git a/lld/test/wasm/undefined-weak-call.ll b/lld/test/wasm/undefined-weak-call.ll --- a/lld/test/wasm/undefined-weak-call.ll +++ b/lld/test/wasm/undefined-weak-call.ll @@ -32,15 +32,16 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 2 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 2 ] ; CHECK-NEXT: - Type: TABLE diff --git a/lld/test/wasm/weak-alias-overide.ll b/lld/test/wasm/weak-alias-overide.ll --- a/lld/test/wasm/weak-alias-overide.ll +++ b/lld/test/wasm/weak-alias-overide.ll @@ -26,11 +26,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 0, 0, 0, 0 ] ; CHECK-NEXT: - Type: TABLE diff --git a/lld/test/wasm/weak-alias.ll b/lld/test/wasm/weak-alias.ll --- a/lld/test/wasm/weak-alias.ll +++ b/lld/test/wasm/weak-alias.ll @@ -23,11 +23,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1, 1 ] ; CHECK-NEXT: - Type: TABLE @@ -131,11 +132,12 @@ ; RELOC-NEXT: - Type: TYPE ; RELOC-NEXT: Signatures: ; RELOC-NEXT: - Index: 0 -; RELOC-NEXT: ReturnType: NORESULT -; RELOC-NEXT: ParamTypes: +; RELOC-NEXT: ParamTypes: [] +; RELOC-NEXT: ReturnTypes: [] ; RELOC-NEXT: - Index: 1 -; RELOC-NEXT: ReturnType: I32 -; RELOC-NEXT: ParamTypes: +; RELOC-NEXT: ParamTypes: [] +; RELOC-NEXT: ReturnTypes: +; RELOC-NEXT: - I32 ; RELOC-NEXT: - Type: IMPORT ; RELOC-NEXT: Imports: ; RELOC-NEXT: - Module: env diff --git a/lld/test/wasm/weak-symbols.ll b/lld/test/wasm/weak-symbols.ll --- a/lld/test/wasm/weak-symbols.ll +++ b/lld/test/wasm/weak-symbols.ll @@ -23,11 +23,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1 ] ; CHECK-NEXT: - Type: TABLE diff --git a/lld/test/wasm/weak-undefined.ll b/lld/test/wasm/weak-undefined.ll --- a/lld/test/wasm/weak-undefined.ll +++ b/lld/test/wasm/weak-undefined.ll @@ -34,11 +34,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: FUNCTION ; CHECK-NEXT: FunctionTypes: [ 0, 0, 1 ] ; CHECK-NEXT: - Type: TABLE diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h --- a/llvm/include/llvm/ObjectYAML/WasmYAML.h +++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h @@ -145,7 +145,7 @@ uint32_t Index; SignatureForm Form = wasm::WASM_TYPE_FUNC; std::vector ParamTypes; - ValueType ReturnType; + std::vector ReturnTypes; }; struct SymbolInfo { diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -881,12 +881,9 @@ Sig.Params.push_back(wasm::ValType(ParamType)); } uint32_t ReturnCount = readVaruint32(Ctx); - if (ReturnCount) { - if (ReturnCount != 1) { - return make_error( - "Multiple return types not supported", object_error::parse_failed); - } - Sig.Returns.push_back(wasm::ValType(readUint8(Ctx))); + while (ReturnCount--) { + uint32_t ReturnType = readUint8(Ctx); + Sig.Returns.push_back(wasm::ValType(ReturnType)); } Signatures.push_back(std::move(Sig)); } diff --git a/llvm/lib/ObjectYAML/WasmEmitter.cpp b/llvm/lib/ObjectYAML/WasmEmitter.cpp --- a/llvm/lib/ObjectYAML/WasmEmitter.cpp +++ b/llvm/lib/ObjectYAML/WasmEmitter.cpp @@ -334,12 +334,9 @@ encodeULEB128(Sig.ParamTypes.size(), OS); for (auto ParamType : Sig.ParamTypes) writeUint8(OS, ParamType); - if (Sig.ReturnType == wasm::WASM_TYPE_NORESULT) { - encodeULEB128(0, OS); - } else { - encodeULEB128(1, OS); - writeUint8(OS, Sig.ReturnType); - } + encodeULEB128(Sig.ReturnTypes.size(), OS); + for (auto ReturnType : Sig.ReturnTypes) + writeUint8(OS, ReturnType); } } diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp --- a/llvm/lib/ObjectYAML/WasmYAML.cpp +++ b/llvm/lib/ObjectYAML/WasmYAML.cpp @@ -295,8 +295,8 @@ void MappingTraits::mapping( IO &IO, WasmYAML::Signature &Signature) { IO.mapRequired("Index", Signature.Index); - IO.mapRequired("ReturnType", Signature.ReturnType); IO.mapRequired("ParamTypes", Signature.ParamTypes); + IO.mapRequired("ReturnTypes", Signature.ReturnTypes); } void MappingTraits::mapping(IO &IO, WasmYAML::Table &Table) { @@ -560,7 +560,6 @@ ECase(V128); ECase(FUNCREF); ECase(FUNC); - ECase(NORESULT); #undef ECase } diff --git a/llvm/test/CodeGen/WebAssembly/multivalue.ll b/llvm/test/CodeGen/WebAssembly/multivalue.ll --- a/llvm/test/CodeGen/WebAssembly/multivalue.ll +++ b/llvm/test/CodeGen/WebAssembly/multivalue.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+multivalue | FileCheck %s +; RUN: llc < %s --filetype=obj -mattr=+multivalue | obj2yaml | FileCheck %s --check-prefix OBJ ; Test that the multivalue returns, function types, and block types ; work as expected. @@ -42,3 +43,19 @@ ; CHECK-NEXT: .int8 43 ; CHECK-NEXT: .int8 10 ; CHECK-NEXT: .ascii "multivalue" + +; OBJ-LABEL: - Type: TYPE +; OBJ-NEXT: Signatures: +; OBJ-NEXT: - Index: 0 +; OBJ-NEXT: ParamTypes: +; OBJ-NEXT: - I32 +; OBJ-NEXT: - I32 +; OBJ-NEXT: ReturnTypes: +; OBJ-NEXT: - I32 +; OBJ-NEXT: - I32 +; OBJ-NEXT: - Index: 1 +; OBJ-NEXT: ParamTypes: +; OBJ-NEXT: - I32 +; OBJ-NEXT: ReturnTypes: +; OBJ-NEXT: - I32 +; OBJ-NEXT: - I64 diff --git a/llvm/test/CodeGen/WebAssembly/tailcall.ll b/llvm/test/CodeGen/WebAssembly/tailcall.ll --- a/llvm/test/CodeGen/WebAssembly/tailcall.ll +++ b/llvm/test/CodeGen/WebAssembly/tailcall.ll @@ -215,12 +215,13 @@ ; return-called functions include the proper return types ; YAML-LABEL: - Index: 8 -; YAML-NEXT: ReturnType: I32 ; YAML-NEXT: ParamTypes: ; YAML-NEXT: - I32 ; YAML-NEXT: - F32 ; YAML-NEXT: - I64 ; YAML-NEXT: - F64 +; YAML-NEXT: ReturnTypes: +; YAML-NEXT: - I32 define i32 @unique_caller(i32 (i32, float, i64, double)** %p) { %f = load i32 (i32, float, i64, double)*, i32 (i32, float, i64, double)** %p %v = tail call i32 %f(i32 0, float 0., i64 0, double 0.) diff --git a/llvm/test/MC/WebAssembly/assembler-binary.ll b/llvm/test/MC/WebAssembly/assembler-binary.ll --- a/llvm/test/MC/WebAssembly/assembler-binary.ll +++ b/llvm/test/MC/WebAssembly/assembler-binary.ll @@ -38,12 +38,12 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK-NEXT: - Module: env diff --git a/llvm/test/MC/WebAssembly/comdat.ll b/llvm/test/MC/WebAssembly/comdat.ll --- a/llvm/test/MC/WebAssembly/comdat.ll +++ b/llvm/test/MC/WebAssembly/comdat.ll @@ -28,8 +28,9 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 -; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ParamTypes: [] +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK-NEXT: - Module: env diff --git a/llvm/test/MC/WebAssembly/data-section.s b/llvm/test/MC/WebAssembly/data-section.s --- a/llvm/test/MC/WebAssembly/data-section.s +++ b/llvm/test/MC/WebAssembly/data-section.s @@ -35,8 +35,9 @@ # BIN-NEXT: - Type: TYPE # BIN-NEXT: Signatures: # BIN-NEXT: - Index: 0 -# BIN-NEXT: ReturnType: I32 # BIN-NEXT: ParamTypes: [] +# BIN-NEXT: ReturnTypes: +# BIN-NEXT: - I32 # BIN-NEXT: - Type: IMPORT # BIN-NEXT: Imports: # BIN-NEXT: - Module: env diff --git a/llvm/test/MC/WebAssembly/event-section.ll b/llvm/test/MC/WebAssembly/event-section.ll --- a/llvm/test/MC/WebAssembly/event-section.ll +++ b/llvm/test/MC/WebAssembly/event-section.ll @@ -19,13 +19,14 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK: - Type: EVENT ; CHECK-NEXT: Events: diff --git a/llvm/test/MC/WebAssembly/external-func-address.ll b/llvm/test/MC/WebAssembly/external-func-address.ll --- a/llvm/test/MC/WebAssembly/external-func-address.ll +++ b/llvm/test/MC/WebAssembly/external-func-address.ll @@ -27,15 +27,16 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK: - Module: env diff --git a/llvm/test/MC/WebAssembly/libcall.ll b/llvm/test/MC/WebAssembly/libcall.ll --- a/llvm/test/MC/WebAssembly/libcall.ll +++ b/llvm/test/MC/WebAssembly/libcall.ll @@ -17,14 +17,15 @@ ; CHECK-NEXT: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: IMPORT diff --git a/llvm/test/MC/WebAssembly/reloc-pic.s b/llvm/test/MC/WebAssembly/reloc-pic.s --- a/llvm/test/MC/WebAssembly/reloc-pic.s +++ b/llvm/test/MC/WebAssembly/reloc-pic.s @@ -52,8 +52,9 @@ # CHECK-NEXT: - Type: TYPE # CHECK-NEXT: Signatures: # CHECK-NEXT: - Index: 0 -# CHECK-NEXT: ReturnType: I32 # CHECK-NEXT: ParamTypes: [] +# CHECK-NEXT: ReturnTypes: +# CHECK-NEXT: - I32 # CHECK-NEXT: - Type: IMPORT # CHECK-NEXT: Imports: # CHECK-NEXT: - Module: env diff --git a/llvm/test/MC/WebAssembly/type-index.s b/llvm/test/MC/WebAssembly/type-index.s --- a/llvm/test/MC/WebAssembly/type-index.s +++ b/llvm/test/MC/WebAssembly/type-index.s @@ -22,13 +22,15 @@ # BIN-NEXT: - Type: TYPE # BIN-NEXT: Signatures: # BIN-NEXT: - Index: 0 -# BIN-NEXT: ReturnType: I32 # BIN-NEXT: ParamTypes: # BIN-NEXT: - I32 +# BIN-NEXT: ReturnTypes: +# BIN-NEXT: - I32 # BIN-NEXT: - Index: 1 -# BIN-NEXT: ReturnType: F64 # BIN-NEXT: ParamTypes: # BIN-NEXT: - F64 +# BIN-NEXT: ReturnTypes: +# BIN-NEXT: - F64 # BIN-NEXT: - Type: IMPORT # BIN-NEXT: Imports: # BIN-NEXT: - Module: env @@ -64,4 +66,3 @@ # BIN-NEXT: Flags: [ BINDING_LOCAL ] # BIN-NEXT: Function: 0 # BIN-NEXT: ... - diff --git a/llvm/test/MC/WebAssembly/types.ll b/llvm/test/MC/WebAssembly/types.ll --- a/llvm/test/MC/WebAssembly/types.ll +++ b/llvm/test/MC/WebAssembly/types.ll @@ -37,32 +37,37 @@ ; CHECK-LABEL: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Index: 2 -; CHECK-NEXT: ReturnType: I64 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I64 ; CHECK-NEXT: - Index: 3 -; CHECK-NEXT: ReturnType: F32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - F32 ; CHECK-NEXT: - Index: 4 -; CHECK-NEXT: ReturnType: F64 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - F64 ; CHECK-NEXT: - Index: 5 -; CHECK-NEXT: ReturnType: V128 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - V128 ; CHECK-NEXT: - Index: 6 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; CHECK-NEXT: - Index: 7 -; CHECK-NEXT: ReturnType: NORESULT ; CHECK-NEXT: ParamTypes: ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 ; CHECK-NEXT: - I32 +; CHECK-NEXT: ReturnTypes: [] ; should be no additional types -; CHECK-NOT: ReturnType +; CHECK-NOT: ReturnTypes diff --git a/llvm/test/MC/WebAssembly/weak-alias.ll b/llvm/test/MC/WebAssembly/weak-alias.ll --- a/llvm/test/MC/WebAssembly/weak-alias.ll +++ b/llvm/test/MC/WebAssembly/weak-alias.ll @@ -49,8 +49,9 @@ ; CHECK: - Type: TYPE ; CHECK-NEXT: Signatures: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ReturnType: I32 ; CHECK-NEXT: ParamTypes: +; CHECK-NEXT: ReturnTypes: +; CHECK-NEXT: - I32 ; CHECK-NEXT: - Type: IMPORT ; CHECK-NEXT: Imports: ; CHECK-NEXT: - Module: env diff --git a/llvm/test/Object/wasm-duplicate-name.test b/llvm/test/Object/wasm-duplicate-name.test --- a/llvm/test/Object/wasm-duplicate-name.test +++ b/llvm/test/Object/wasm-duplicate-name.test @@ -7,9 +7,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: foo diff --git a/llvm/test/Object/wasm-relocs-and-producers.yaml b/llvm/test/Object/wasm-relocs-and-producers.yaml --- a/llvm/test/Object/wasm-relocs-and-producers.yaml +++ b/llvm/test/Object/wasm-relocs-and-producers.yaml @@ -16,8 +16,8 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: NORESULT ParamTypes: [] + ReturnTypes: [] - Type: IMPORT Imports: - Module: env diff --git a/llvm/test/ObjectYAML/wasm/code_section.yaml b/llvm/test/ObjectYAML/wasm/code_section.yaml --- a/llvm/test/ObjectYAML/wasm/code_section.yaml +++ b/llvm/test/ObjectYAML/wasm/code_section.yaml @@ -6,14 +6,15 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: F32 ParamTypes: - I32 + ReturnTypes: + - F32 - Index: 1 - ReturnType: NORESULT ParamTypes: - I32 - I64 + ReturnTypes: [] - Type: FUNCTION FunctionTypes: - 0 @@ -59,14 +60,15 @@ # CHECK: - Type: TYPE # CHECK: Signatures: # CHECK: - Index: 0 -# CHECK: ReturnType: F32 # CHECK: ParamTypes: # CHECK: - I32 +# CHECK: ReturnTypes: +# CHECK: - F32 # CHECK: - Index: 1 -# CHECK: ReturnType: NORESULT # CHECK: ParamTypes: # CHECK: - I32 # CHECK: - I64 +# CHECK: ReturnTypes: [] # CHECK: - Type: CODE # CHECK: Relocations: # CHECK: - Type: R_WASM_TABLE_INDEX_SLEB diff --git a/llvm/test/ObjectYAML/wasm/event_section.yaml b/llvm/test/ObjectYAML/wasm/event_section.yaml --- a/llvm/test/ObjectYAML/wasm/event_section.yaml +++ b/llvm/test/ObjectYAML/wasm/event_section.yaml @@ -7,13 +7,14 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Index: 1 - ReturnType: NORESULT ParamTypes: - I32 + ReturnTypes: [] - Type: FUNCTION FunctionTypes: [ 0 ] - Type: EVENT @@ -53,13 +54,14 @@ # CHECK-NEXT: - Type: TYPE # CHECK-NEXT: Signatures: # CHECK-NEXT: - Index: 0 -# CHECK-NEXT: ReturnType: I32 # CHECK-NEXT: ParamTypes: # CHECK-NEXT: - I32 +# CHECK-NEXT: ReturnTypes: +# CHECK-NEXT: - I32 # CHECK-NEXT: - Index: 1 -# CHECK-NEXT: ReturnType: NORESULT # CHECK-NEXT: ParamTypes: # CHECK-NEXT: - I32 +# CHECK-NEXT: ReturnTypes: [] # CHECK-NEXT: - Type: FUNCTION # CHECK-NEXT: FunctionTypes: [ 0 ] # CHECK-NEXT: - Type: EVENT diff --git a/llvm/test/ObjectYAML/wasm/export_section.yaml b/llvm/test/ObjectYAML/wasm/export_section.yaml --- a/llvm/test/ObjectYAML/wasm/export_section.yaml +++ b/llvm/test/ObjectYAML/wasm/export_section.yaml @@ -6,8 +6,8 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: NORESULT ParamTypes: + ReturnTypes: [] - Type: FUNCTION FunctionTypes: [ 0, 0 ] - Type: GLOBAL @@ -25,7 +25,7 @@ Opcode: I64_CONST Value: 64 - Type: EXPORT - Exports: + Exports: - Name: function_export Kind: FUNCTION Index: 1 @@ -52,7 +52,7 @@ # CHECK: Version: 0x00000001 # CHECK: Sections: # CHECK: - Type: EXPORT -# CHECK: Exports: +# CHECK: Exports: # CHECK: - Name: function_export # CHECK: Kind: FUNCTION # CHECK: Index: 1 diff --git a/llvm/test/ObjectYAML/wasm/function_section.yaml b/llvm/test/ObjectYAML/wasm/function_section.yaml --- a/llvm/test/ObjectYAML/wasm/function_section.yaml +++ b/llvm/test/ObjectYAML/wasm/function_section.yaml @@ -6,12 +6,12 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: NORESULT ParamTypes: + ReturnTypes: [] - Index: 1 - ReturnType: NORESULT ParamTypes: - I32 + ReturnTypes: [] - Type: FUNCTION FunctionTypes: [ 1, 0 ] - Type: CODE diff --git a/llvm/test/ObjectYAML/wasm/import_memory_shared.yaml b/llvm/test/ObjectYAML/wasm/import_memory_shared.yaml --- a/llvm/test/ObjectYAML/wasm/import_memory_shared.yaml +++ b/llvm/test/ObjectYAML/wasm/import_memory_shared.yaml @@ -6,9 +6,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: foo @@ -25,7 +26,7 @@ # CHECK: Version: 0x00000001 # CHECK: Sections: # CHECK: - Type: IMPORT -# CHECK: Imports: +# CHECK: Imports: # CHECK: - Module: foo # CHECK: Field: imported_memory # CHECK: Kind: MEMORY diff --git a/llvm/test/ObjectYAML/wasm/import_section.yaml b/llvm/test/ObjectYAML/wasm/import_section.yaml --- a/llvm/test/ObjectYAML/wasm/import_section.yaml +++ b/llvm/test/ObjectYAML/wasm/import_section.yaml @@ -6,9 +6,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: foo @@ -42,7 +43,7 @@ # CHECK: Version: 0x00000001 # CHECK: Sections: # CHECK: - Type: IMPORT -# CHECK: Imports: +# CHECK: Imports: # CHECK: - Module: foo # CHECK: Field: imported_function # CHECK: Kind: FUNCTION diff --git a/llvm/test/ObjectYAML/wasm/invalid_section_order.yaml b/llvm/test/ObjectYAML/wasm/invalid_section_order.yaml --- a/llvm/test/ObjectYAML/wasm/invalid_section_order.yaml +++ b/llvm/test/ObjectYAML/wasm/invalid_section_order.yaml @@ -7,8 +7,8 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: NORESULT ParamTypes: [] + ReturnTypes: [] - Type: CODE Functions: - Index: 0 diff --git a/llvm/test/ObjectYAML/wasm/linking_section.yaml b/llvm/test/ObjectYAML/wasm/linking_section.yaml --- a/llvm/test/ObjectYAML/wasm/linking_section.yaml +++ b/llvm/test/ObjectYAML/wasm/linking_section.yaml @@ -6,9 +6,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: foo diff --git a/llvm/test/ObjectYAML/wasm/name_section.yaml b/llvm/test/ObjectYAML/wasm/name_section.yaml --- a/llvm/test/ObjectYAML/wasm/name_section.yaml +++ b/llvm/test/ObjectYAML/wasm/name_section.yaml @@ -6,9 +6,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: foo diff --git a/llvm/test/ObjectYAML/wasm/start_section.yaml b/llvm/test/ObjectYAML/wasm/start_section.yaml --- a/llvm/test/ObjectYAML/wasm/start_section.yaml +++ b/llvm/test/ObjectYAML/wasm/start_section.yaml @@ -7,8 +7,8 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: NORESULT - ParamTypes: + ParamTypes: [] + ReturnTypes: [] - Type: FUNCTION FunctionTypes: [ 0, 0, 0 ] - Type: START diff --git a/llvm/test/ObjectYAML/wasm/type_section.yaml b/llvm/test/ObjectYAML/wasm/type_section.yaml --- a/llvm/test/ObjectYAML/wasm/type_section.yaml +++ b/llvm/test/ObjectYAML/wasm/type_section.yaml @@ -6,15 +6,17 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - F32 - F32 + ReturnTypes: + - I32 - Index: 1 - ReturnType: I64 ParamTypes: - F64 - F64 + ReturnTypes: + - I64 ... # CHECK: --- !WASM # CHECK: FileHeader: @@ -23,13 +25,15 @@ # CHECK: - Type: TYPE # CHECK: Signatures: # CHECK: - Index: 0 -# CHECK: ReturnType: I32 # CHECK: ParamTypes: # CHECK: - F32 # CHECK: - F32 +# CHECK: ReturnTypes: +# CHECK: - I32 # CHECK: - Index: 1 -# CHECK: ReturnType: I64 # CHECK: ParamTypes: # CHECK: - F64 # CHECK: - F64 +# CHECK: ReturnTypes: +# CHECK: - I64 # CHECK: ... diff --git a/llvm/test/ObjectYAML/wasm/weak_symbols.yaml b/llvm/test/ObjectYAML/wasm/weak_symbols.yaml --- a/llvm/test/ObjectYAML/wasm/weak_symbols.yaml +++ b/llvm/test/ObjectYAML/wasm/weak_symbols.yaml @@ -6,12 +6,13 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 - ParamTypes: + ParamTypes: [] + ReturnTypes: + - I32 - Type: FUNCTION FunctionTypes: [ 0, 0 ] - Type: GLOBAL - Globals: + Globals: - Index: 0 Type: I32 Mutable: false @@ -19,7 +20,7 @@ Opcode: I32_CONST Value: 1 - Type: EXPORT - Exports: + Exports: - Name: function_export Kind: FUNCTION Index: 1 @@ -54,7 +55,7 @@ # CHECK: Version: 0x00000001 # CHECK: Sections: # CHECK: - Type: EXPORT -# CHECK: Exports: +# CHECK: Exports: # CHECK: - Name: function_export # CHECK: Kind: FUNCTION # CHECK: Index: 1 diff --git a/llvm/test/tools/llvm-nm/wasm/exports.yaml b/llvm/test/tools/llvm-nm/wasm/exports.yaml --- a/llvm/test/tools/llvm-nm/wasm/exports.yaml +++ b/llvm/test/tools/llvm-nm/wasm/exports.yaml @@ -9,9 +9,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: FUNCTION FunctionTypes: [ 0 ] - Type: GLOBAL diff --git a/llvm/test/tools/llvm-nm/wasm/imports.yaml b/llvm/test/tools/llvm-nm/wasm/imports.yaml --- a/llvm/test/tools/llvm-nm/wasm/imports.yaml +++ b/llvm/test/tools/llvm-nm/wasm/imports.yaml @@ -9,9 +9,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: env diff --git a/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml b/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml --- a/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml +++ b/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml @@ -9,9 +9,10 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: - I32 + ReturnTypes: + - I32 - Type: IMPORT Imports: - Module: env diff --git a/llvm/test/tools/llvm-readobj/wasm-imports.test b/llvm/test/tools/llvm-readobj/wasm-imports.test --- a/llvm/test/tools/llvm-readobj/wasm-imports.test +++ b/llvm/test/tools/llvm-readobj/wasm-imports.test @@ -9,11 +9,12 @@ - Type: TYPE Signatures: - Index: 0 - ReturnType: I32 ParamTypes: [] + ReturnTypes: + - I32 - Index: 1 - ReturnType: NORESULT ParamTypes: [] + ReturnTypes: [] - Type: IMPORT Imports: - Module: env diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp --- a/llvm/tools/obj2yaml/wasm2yaml.cpp +++ b/llvm/tools/obj2yaml/wasm2yaml.cpp @@ -198,13 +198,10 @@ for (const auto &FunctionSig : Obj.types()) { WasmYAML::Signature Sig; Sig.Index = Index++; - Sig.ReturnType = wasm::WASM_TYPE_NORESULT; - assert(FunctionSig.Returns.size() <= 1 && - "Functions with multiple returns are not supported"); - if (FunctionSig.Returns.size()) - Sig.ReturnType = static_cast(FunctionSig.Returns[0]); for (const auto &ParamType : FunctionSig.Params) Sig.ParamTypes.emplace_back(static_cast(ParamType)); + for (const auto &ReturnType : FunctionSig.Returns) + Sig.ReturnTypes.emplace_back(static_cast(ReturnType)); TypeSec->Signatures.push_back(Sig); } S = std::move(TypeSec);