aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/obj2yaml/wasm2yaml.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2018-10-03 22:22:48 +0000
committerDerek Schuff <dschuff@google.com>2018-10-03 22:22:48 +0000
commit77a7a38006eed3dda8f63b1a352f3f60398bda41 (patch)
treefeb6080c3570ffc594004af3e1514a1bfa55fd12 /llvm/tools/obj2yaml/wasm2yaml.cpp
parent3ed33eade06d583f2a93fe253975bc07a39fbd9e (diff)
downloadllvm-77a7a38006eed3dda8f63b1a352f3f60398bda41.zip
llvm-77a7a38006eed3dda8f63b1a352f3f60398bda41.tar.gz
llvm-77a7a38006eed3dda8f63b1a352f3f60398bda41.tar.bz2
[WebAssembly] Refactor WasmSignature and use it for MCSymbolWasm
MCContext does not destroy MCSymbols on shutdown. So, rather than putting SmallVectors (which may heap-allocate) inside MCSymbolWasm, use unowned pointer to a WasmSignature instead. The signatures are now owned by the AsmPrinter. Also uses WasmSignature instead of param and result vectors in TargetStreamer, and leaves some TODOs for further simplification. Differential Revision: https://reviews.llvm.org/D52580 llvm-svn: 343733
Diffstat (limited to 'llvm/tools/obj2yaml/wasm2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/wasm2yaml.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index ad91aca..a1120a9 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -155,9 +155,13 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
for (const auto &FunctionSig : Obj.types()) {
WasmYAML::Signature Sig;
Sig.Index = Index++;
- Sig.ReturnType = FunctionSig.ReturnType;
- for (const auto &ParamType : FunctionSig.ParamTypes)
- Sig.ParamTypes.push_back(ParamType);
+ 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.push_back(static_cast<uint32_t>(ParamType));
TypeSec->Signatures.push_back(Sig);
}
S = std::move(TypeSec);