[PATCH] D111227: [WebAssembly] Implementation of table.grow/size and ref.null intrinsics

Paulo Matos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 06:28:49 PDT 2021


pmatos added a comment.

@tlively This is early days of the intrinsics implementation, so it's not ready for review.
However, I wanted to share to ensure that the progress of the implementation is public and to avoid going into a design dead end.

At the moment, I am fighting tablegen, which doesn't like the `table.grow` pattern due to:

  Type set is empty for each HW mode:
  possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records).

I am still investigating, but the overall implementation will allow us to use `table.grow` and `table.size` at the IR level through the intrinsics. A few notes:

- As far as I understand intrinsics cannot be polymorphic, therefore `table.grow` and `ref.null` intrinsics come in two versions: one for `externref` and one for `funcref`.
- An intrinsic for `ref.null` is required so that we can create a constant to pass to `table.grow` to initialize the new slots on a table but also for other general uses.
- In order to specify the types (params and return) in the intrinsics definition, I needed to add a bunch of definitions for `llvm_externref_ty` and `llvm_funcref_ty` and plug them the correct types in other enumerations.

Hoping I can make peace with TableGen and sort the current problem. I feel like this should be relatively straightforward once I pass the TableGen hurdle.

P.S.: Pay no attention to the test `llvm/test/CodeGen/WebAssembly/table-grow.ll` whose contents are not there yet, and was committed by mistake.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111227



More information about the llvm-commits mailing list