[llvm] r375283 - [WebAssembly] Allow multivalue signatures in object files
Thomas Lively via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 13:27:31 PDT 2019
Author: tlively
Date: Fri Oct 18 13:27:30 2019
New Revision: 375283
URL: http://llvm.org/viewvc/llvm-project?rev=375283&view=rev
Log:
[WebAssembly] Allow multivalue signatures in object files
Summary:
Also changes the wasm YAML format to reflect the possibility of having
multiple return types and to put the returns after the params for
consistency with the binary encoding.
Reviewers: aheejin, sbc100
Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, arphaman, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69156
Modified:
llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h
llvm/trunk/lib/Object/WasmObjectFile.cpp
llvm/trunk/lib/ObjectYAML/WasmEmitter.cpp
llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
llvm/trunk/test/CodeGen/WebAssembly/multivalue.ll
llvm/trunk/test/CodeGen/WebAssembly/tailcall.ll
llvm/trunk/test/MC/WebAssembly/assembler-binary.ll
llvm/trunk/test/MC/WebAssembly/comdat.ll
llvm/trunk/test/MC/WebAssembly/data-section.s
llvm/trunk/test/MC/WebAssembly/event-section.ll
llvm/trunk/test/MC/WebAssembly/external-func-address.ll
llvm/trunk/test/MC/WebAssembly/libcall.ll
llvm/trunk/test/MC/WebAssembly/reloc-pic.s
llvm/trunk/test/MC/WebAssembly/type-index.s
llvm/trunk/test/MC/WebAssembly/types.ll
llvm/trunk/test/MC/WebAssembly/weak-alias.ll
llvm/trunk/test/Object/wasm-duplicate-name.test
llvm/trunk/test/Object/wasm-relocs-and-producers.yaml
llvm/trunk/test/ObjectYAML/wasm/code_section.yaml
llvm/trunk/test/ObjectYAML/wasm/event_section.yaml
llvm/trunk/test/ObjectYAML/wasm/export_section.yaml
llvm/trunk/test/ObjectYAML/wasm/function_section.yaml
llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml
llvm/trunk/test/ObjectYAML/wasm/import_section.yaml
llvm/trunk/test/ObjectYAML/wasm/invalid_section_order.yaml
llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml
llvm/trunk/test/ObjectYAML/wasm/name_section.yaml
llvm/trunk/test/ObjectYAML/wasm/start_section.yaml
llvm/trunk/test/ObjectYAML/wasm/type_section.yaml
llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml
llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml
llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml
llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml
llvm/trunk/test/tools/llvm-readobj/wasm-imports.test
llvm/trunk/tools/obj2yaml/wasm2yaml.cpp
Modified: llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h Fri Oct 18 13:27:30 2019
@@ -145,7 +145,7 @@ struct Signature {
uint32_t Index;
SignatureForm Form = wasm::WASM_TYPE_FUNC;
std::vector<ValueType> ParamTypes;
- ValueType ReturnType;
+ std::vector<ValueType> ReturnTypes;
};
struct SymbolInfo {
Modified: llvm/trunk/lib/Object/WasmObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WasmObjectFile.cpp?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WasmObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/WasmObjectFile.cpp Fri Oct 18 13:27:30 2019
@@ -881,12 +881,9 @@ Error WasmObjectFile::parseTypeSection(R
Sig.Params.push_back(wasm::ValType(ParamType));
}
uint32_t ReturnCount = readVaruint32(Ctx);
- if (ReturnCount) {
- if (ReturnCount != 1) {
- return make_error<GenericBinaryError>(
- "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));
}
Modified: llvm/trunk/lib/ObjectYAML/WasmEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/WasmEmitter.cpp?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/WasmEmitter.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/WasmEmitter.cpp Fri Oct 18 13:27:30 2019
@@ -334,12 +334,9 @@ void WasmWriter::writeSectionContent(raw
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);
}
}
Modified: llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/WasmYAML.cpp?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/WasmYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/WasmYAML.cpp Fri Oct 18 13:27:30 2019
@@ -295,8 +295,8 @@ void ScalarEnumerationTraits<WasmYAML::S
void MappingTraits<WasmYAML::Signature>::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<WasmYAML::Table>::mapping(IO &IO, WasmYAML::Table &Table) {
@@ -560,7 +560,6 @@ void ScalarEnumerationTraits<WasmYAML::V
ECase(V128);
ECase(FUNCREF);
ECase(FUNC);
- ECase(NORESULT);
#undef ECase
}
Modified: llvm/trunk/test/CodeGen/WebAssembly/multivalue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/multivalue.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/multivalue.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/multivalue.ll Fri Oct 18 13:27:30 2019
@@ -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 @@ loop:
; 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
Modified: llvm/trunk/test/CodeGen/WebAssembly/tailcall.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/tailcall.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/tailcall.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/tailcall.ll Fri Oct 18 13:27:30 2019
@@ -215,12 +215,13 @@ define i1 @mismatched_return_trunc() {
; 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.)
Modified: llvm/trunk/test/MC/WebAssembly/assembler-binary.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/assembler-binary.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/assembler-binary.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/assembler-binary.ll Fri Oct 18 13:27:30 2019
@@ -38,12 +38,12 @@ entry:
; 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
Modified: llvm/trunk/test/MC/WebAssembly/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/comdat.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/comdat.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/comdat.ll Fri Oct 18 13:27:30 2019
@@ -28,8 +28,9 @@ define linkonce_odr i32 @sharedFn() #1 c
; 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
Modified: llvm/trunk/test/MC/WebAssembly/data-section.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/data-section.s?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/data-section.s (original)
+++ llvm/trunk/test/MC/WebAssembly/data-section.s Fri Oct 18 13:27:30 2019
@@ -35,8 +35,9 @@ test0:
# 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
Modified: llvm/trunk/test/MC/WebAssembly/event-section.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/event-section.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/event-section.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/event-section.ll Fri Oct 18 13:27:30 2019
@@ -19,13 +19,14 @@ define i32 @test_throw1(i8* %p) {
; 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:
Modified: llvm/trunk/test/MC/WebAssembly/external-func-address.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/external-func-address.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/external-func-address.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/external-func-address.ll Fri Oct 18 13:27:30 2019
@@ -27,15 +27,16 @@ define void @call(i32) {
; 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
Modified: llvm/trunk/test/MC/WebAssembly/libcall.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/libcall.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/libcall.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/libcall.ll Fri Oct 18 13:27:30 2019
@@ -17,14 +17,15 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(
; 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
Modified: llvm/trunk/test/MC/WebAssembly/reloc-pic.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/reloc-pic.s?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/reloc-pic.s (original)
+++ llvm/trunk/test/MC/WebAssembly/reloc-pic.s Fri Oct 18 13:27:30 2019
@@ -52,8 +52,9 @@ hidden_func:
# 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
Modified: llvm/trunk/test/MC/WebAssembly/type-index.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/type-index.s?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/type-index.s (original)
+++ llvm/trunk/test/MC/WebAssembly/type-index.s Fri Oct 18 13:27:30 2019
@@ -22,13 +22,15 @@ test0:
# 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 @@ test0:
# BIN-NEXT: Flags: [ BINDING_LOCAL ]
# BIN-NEXT: Function: 0
# BIN-NEXT: ...
-
Modified: llvm/trunk/test/MC/WebAssembly/types.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/types.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/types.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/types.ll Fri Oct 18 13:27:30 2019
@@ -37,32 +37,37 @@ define void @vararg(i32, i32, ...) {
; 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
Modified: llvm/trunk/test/MC/WebAssembly/weak-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/weak-alias.ll?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/weak-alias.ll (original)
+++ llvm/trunk/test/MC/WebAssembly/weak-alias.ll Fri Oct 18 13:27:30 2019
@@ -49,8 +49,9 @@ entry:
; 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
Modified: llvm/trunk/test/Object/wasm-duplicate-name.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/wasm-duplicate-name.test?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/Object/wasm-duplicate-name.test (original)
+++ llvm/trunk/test/Object/wasm-duplicate-name.test Fri Oct 18 13:27:30 2019
@@ -7,9 +7,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: foo
Modified: llvm/trunk/test/Object/wasm-relocs-and-producers.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/wasm-relocs-and-producers.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/Object/wasm-relocs-and-producers.yaml (original)
+++ llvm/trunk/test/Object/wasm-relocs-and-producers.yaml Fri Oct 18 13:27:30 2019
@@ -16,8 +16,8 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: NORESULT
ParamTypes: []
+ ReturnTypes: []
- Type: IMPORT
Imports:
- Module: env
Modified: llvm/trunk/test/ObjectYAML/wasm/code_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/code_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/code_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/code_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,14 +6,15 @@ Sections:
- 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 @@ Sections:
# 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
Modified: llvm/trunk/test/ObjectYAML/wasm/event_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/event_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/event_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/event_section.yaml Fri Oct 18 13:27:30 2019
@@ -7,13 +7,14 @@ Sections:
- 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 @@ Sections:
# 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
Modified: llvm/trunk/test/ObjectYAML/wasm/export_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/export_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/export_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/export_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,8 +6,8 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: NORESULT
ParamTypes:
+ ReturnTypes: []
- Type: FUNCTION
FunctionTypes: [ 0, 0 ]
- Type: GLOBAL
@@ -25,7 +25,7 @@ Sections:
Opcode: I64_CONST
Value: 64
- Type: EXPORT
- Exports:
+ Exports:
- Name: function_export
Kind: FUNCTION
Index: 1
@@ -52,7 +52,7 @@ Sections:
# CHECK: Version: 0x00000001
# CHECK: Sections:
# CHECK: - Type: EXPORT
-# CHECK: Exports:
+# CHECK: Exports:
# CHECK: - Name: function_export
# CHECK: Kind: FUNCTION
# CHECK: Index: 1
Modified: llvm/trunk/test/ObjectYAML/wasm/function_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/function_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/function_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/function_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,12 +6,12 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: NORESULT
ParamTypes:
+ ReturnTypes: []
- Index: 1
- ReturnType: NORESULT
ParamTypes:
- I32
+ ReturnTypes: []
- Type: FUNCTION
FunctionTypes: [ 1, 0 ]
- Type: CODE
Modified: llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml Fri Oct 18 13:27:30 2019
@@ -6,9 +6,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: foo
@@ -25,7 +26,7 @@ Sections:
# CHECK: Version: 0x00000001
# CHECK: Sections:
# CHECK: - Type: IMPORT
-# CHECK: Imports:
+# CHECK: Imports:
# CHECK: - Module: foo
# CHECK: Field: imported_memory
# CHECK: Kind: MEMORY
Modified: llvm/trunk/test/ObjectYAML/wasm/import_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/import_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/import_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/import_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,9 +6,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: foo
@@ -42,7 +43,7 @@ Sections:
# CHECK: Version: 0x00000001
# CHECK: Sections:
# CHECK: - Type: IMPORT
-# CHECK: Imports:
+# CHECK: Imports:
# CHECK: - Module: foo
# CHECK: Field: imported_function
# CHECK: Kind: FUNCTION
Modified: llvm/trunk/test/ObjectYAML/wasm/invalid_section_order.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/invalid_section_order.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/invalid_section_order.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/invalid_section_order.yaml Fri Oct 18 13:27:30 2019
@@ -7,8 +7,8 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: NORESULT
ParamTypes: []
+ ReturnTypes: []
- Type: CODE
Functions:
- Index: 0
Modified: llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,9 +6,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: foo
Modified: llvm/trunk/test/ObjectYAML/wasm/name_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/name_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/name_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/name_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,9 +6,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: foo
Modified: llvm/trunk/test/ObjectYAML/wasm/start_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/start_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/start_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/start_section.yaml Fri Oct 18 13:27:30 2019
@@ -7,8 +7,8 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: NORESULT
- ParamTypes:
+ ParamTypes: []
+ ReturnTypes: []
- Type: FUNCTION
FunctionTypes: [ 0, 0, 0 ]
- Type: START
Modified: llvm/trunk/test/ObjectYAML/wasm/type_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/type_section.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/type_section.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/type_section.yaml Fri Oct 18 13:27:30 2019
@@ -6,15 +6,17 @@ Sections:
- 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 @@ Sections:
# 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: ...
Modified: llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml (original)
+++ llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml Fri Oct 18 13:27:30 2019
@@ -6,12 +6,13 @@ Sections:
- 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 @@ Sections:
Opcode: I32_CONST
Value: 1
- Type: EXPORT
- Exports:
+ Exports:
- Name: function_export
Kind: FUNCTION
Index: 1
@@ -54,7 +55,7 @@ Sections:
# CHECK: Version: 0x00000001
# CHECK: Sections:
# CHECK: - Type: EXPORT
-# CHECK: Exports:
+# CHECK: Exports:
# CHECK: - Name: function_export
# CHECK: Kind: FUNCTION
# CHECK: Index: 1
Modified: llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml (original)
+++ llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml Fri Oct 18 13:27:30 2019
@@ -9,9 +9,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: FUNCTION
FunctionTypes: [ 0 ]
- Type: GLOBAL
Modified: llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml (original)
+++ llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml Fri Oct 18 13:27:30 2019
@@ -9,9 +9,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: env
Modified: llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml (original)
+++ llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml Fri Oct 18 13:27:30 2019
@@ -9,9 +9,10 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes:
- I32
+ ReturnTypes:
+ - I32
- Type: IMPORT
Imports:
- Module: env
Modified: llvm/trunk/test/tools/llvm-readobj/wasm-imports.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/wasm-imports.test?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/wasm-imports.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/wasm-imports.test Fri Oct 18 13:27:30 2019
@@ -9,11 +9,12 @@ Sections:
- Type: TYPE
Signatures:
- Index: 0
- ReturnType: I32
ParamTypes: []
+ ReturnTypes:
+ - I32
- Index: 1
- ReturnType: NORESULT
ParamTypes: []
+ ReturnTypes: []
- Type: IMPORT
Imports:
- Module: env
Modified: llvm/trunk/tools/obj2yaml/wasm2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/wasm2yaml.cpp?rev=375283&r1=375282&r2=375283&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/wasm2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/wasm2yaml.cpp Fri Oct 18 13:27:30 2019
@@ -198,13 +198,10 @@ ErrorOr<WasmYAML::Object *> WasmDumper::
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<uint32_t>(FunctionSig.Returns[0]);
for (const auto &ParamType : FunctionSig.Params)
Sig.ParamTypes.emplace_back(static_cast<uint32_t>(ParamType));
+ for (const auto &ReturnType : FunctionSig.Returns)
+ Sig.ReturnTypes.emplace_back(static_cast<uint32_t>(ReturnType));
TypeSec->Signatures.push_back(Sig);
}
S = std::move(TypeSec);
More information about the llvm-commits
mailing list