diff options
author | Derek Schuff <dschuff@google.com> | 2018-10-03 22:22:48 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2018-10-03 22:22:48 +0000 |
commit | 77a7a38006eed3dda8f63b1a352f3f60398bda41 (patch) | |
tree | feb6080c3570ffc594004af3e1514a1bfa55fd12 /llvm/lib/MC/WasmObjectWriter.cpp | |
parent | 3ed33eade06d583f2a93fe253975bc07a39fbd9e (diff) | |
download | bcm5719-llvm-77a7a38006eed3dda8f63b1a352f3f60398bda41.tar.gz bcm5719-llvm-77a7a38006eed3dda8f63b1a352f3f60398bda41.zip |
[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/lib/MC/WasmObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/WasmObjectWriter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index 2c28f01958f..cbbe161ae82 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -58,6 +58,7 @@ struct SectionBookkeeping { // The signature of a wasm function, in a struct capable of being used as a // DenseMap key. +// TODO: Consider using WasmSignature directly instead. struct WasmFunctionType { // Support empty and tombstone instances, needed by DenseMap. enum { Plain, Empty, Tombstone } State; @@ -1049,8 +1050,10 @@ uint32_t WasmObjectWriter::registerFunctionType(const MCSymbolWasm &Symbol) { WasmFunctionType F; const MCSymbolWasm *ResolvedSym = ResolveSymbol(Symbol); - F.Returns = ResolvedSym->getReturns(); - F.Params = ResolvedSym->getParams(); + if (auto *Sig = ResolvedSym->getSignature()) { + F.Returns = Sig->Returns; + F.Params = Sig->Params; + } auto Pair = FunctionTypeIndices.insert(std::make_pair(F, FunctionTypes.size())); |