[PATCH] D97923: [WebAssembly][yaml2obj][obj2yaml] Elem sections for nonzero tables

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 4 08:03:21 PST 2021


sbc100 accepted this revision.
sbc100 added a comment.
This revision is now accepted and ready to land.

lgtm!



================
Comment at: llvm/include/llvm/BinaryFormat/Wasm.h:316
+  WASM_ELEM_SEGMENT_HAS_INIT_EXPRS = 0x04,
+  WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND = ~WASM_ELEM_SEGMENT_HAS_INIT_EXPRS
+};
----------------
Do you think this should outside the enum perhaps?


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:919
+  assert(WasmIndices.count(IndirectFunctionTable));
+  uint32_t TableNumber = WasmIndices.find(IndirectFunctionTable)->second;
+  uint32_t Flags = 0;
----------------
It looks like we pass IndirectFunctionTable just to get the table nunber.

Would it make sense to instead change the signature of this functions to:

```void WasmObjectWriter::writeElemSection(uint32_t TableNumber, ArrayRef<uint32_t> TableElems)```

And then it can be re-used later once we support different tables?   Or maybe that be part of the followup?  

lgtm which ever way you think makes sense.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97923/new/

https://reviews.llvm.org/D97923



More information about the llvm-commits mailing list