diff options
author | Thomas Lively <tlively@google.com> | 2019-10-18 20:27:30 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-10-18 20:27:30 +0000 |
commit | 393d0f799f8828e9d8002766a9e9db21797451df (patch) | |
tree | 3d8ab2119713681752d60d57ab898349973380f2 /llvm/lib/Object/WasmObjectFile.cpp | |
parent | c6921379f55ee566fb62ba5aa47b217cf7c5d960 (diff) | |
download | bcm5719-llvm-393d0f799f8828e9d8002766a9e9db21797451df.tar.gz bcm5719-llvm-393d0f799f8828e9d8002766a9e9db21797451df.zip |
[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
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
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<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)); } |