[PATCH] D92323: [WebAssembly][MC] Fix placement of table section
Andy Wingo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 30 07:18:41 PST 2020
wingo created this revision.
wingo added a reviewer: sbc100.
Herald added subscribers: llvm-commits, ecnelises, sunfish, hiraditya, jgravelle-google, dschuff.
Herald added a project: LLVM.
wingo requested review of this revision.
Herald added a subscriber: aheejin.
The table section goes after functions. Also, allow Externref and Funcref as block types.
Depends on D92321 <https://reviews.llvm.org/D92321>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92323
Files:
llvm/lib/MC/WasmObjectWriter.cpp
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
Index: llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
===================================================================
--- llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
+++ llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
@@ -139,6 +139,8 @@
F64 = unsigned(wasm::ValType::F64),
V128 = unsigned(wasm::ValType::V128),
Exnref = unsigned(wasm::ValType::EXNREF),
+ Externref = unsigned(wasm::ValType::EXTERNREF),
+ Funcref = unsigned(wasm::ValType::FUNCREF),
// Multivalue blocks (and other non-void blocks) are only emitted when the
// blocks will never be exited and are at the ends of functions (see
// WebAssemblyCFGStackify::fixEndsAtEndOfFunction). They also are never made
Index: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -340,6 +340,8 @@
.Case("f64", WebAssembly::BlockType::F64)
.Case("v128", WebAssembly::BlockType::V128)
.Case("exnref", WebAssembly::BlockType::Exnref)
+ .Case("externref", WebAssembly::BlockType::Externref)
+ .Case("funcref", WebAssembly::BlockType::Funcref)
.Case("void", WebAssembly::BlockType::Void)
.Default(WebAssembly::BlockType::Invalid);
}
Index: llvm/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/lib/MC/WasmObjectWriter.cpp
+++ llvm/lib/MC/WasmObjectWriter.cpp
@@ -1811,10 +1811,10 @@
writeTypeSection(Signatures);
writeImportSection(Imports, DataSize, TableElems.size());
writeFunctionSection(Functions);
+ writeTableSection(Tables);
// Skip the "memory" section; we import the memory instead.
writeEventSection(Events);
writeGlobalSection(Globals);
- writeTableSection(Tables);
writeExportSection(Exports);
auto &Ctx = Asm.getContext();
auto *IndirectFunctionTable = Ctx.lookupSymbol("__indirect_function_table");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92323.308364.patch
Type: text/x-patch
Size: 2130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201130/54e6fbce/attachment.bin>
More information about the llvm-commits
mailing list