From 393d0f799f8828e9d8002766a9e9db21797451df Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 18 Oct 2019 20:27:30 +0000 Subject: [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 llvm-svn: 375283 --- llvm/lib/Object/WasmObjectFile.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 470283efb29..014b403556d 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -881,12 +881,9 @@ Error WasmObjectFile::parseTypeSection(ReadContext &Ctx) { 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)); } -- cgit v1.2.3