aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/obj2yaml/wasm2yaml.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-10-18 20:27:30 +0000
committerThomas Lively <tlively@google.com>2019-10-18 20:27:30 +0000
commit393d0f799f8828e9d8002766a9e9db21797451df (patch)
tree3d8ab2119713681752d60d57ab898349973380f2 /llvm/tools/obj2yaml/wasm2yaml.cpp
parentc6921379f55ee566fb62ba5aa47b217cf7c5d960 (diff)
downloadllvm-393d0f799f8828e9d8002766a9e9db21797451df.zip
llvm-393d0f799f8828e9d8002766a9e9db21797451df.tar.gz
llvm-393d0f799f8828e9d8002766a9e9db21797451df.tar.bz2
[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/tools/obj2yaml/wasm2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/wasm2yaml.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index 7a54097..ea7a1e98 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -198,13 +198,10 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
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);