[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
Mon Oct 18 05:44:00 PDT 2021


pmatos added a comment.

In D111227#3069277 <https://reviews.llvm.org/D111227#3069277>, @tlively wrote:

> In D111227#3066115 <https://reviews.llvm.org/D111227#3066115>, @pmatos wrote:
>
>> In D111227#3046551 <https://reviews.llvm.org/D111227#3046551>, @tlively wrote:
>>
>>> In D111227#3045279 <https://reviews.llvm.org/D111227#3045279>, @pmatos wrote:
>>>
>>>> - 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`.
>>>
>>> Intrinsics actually can be polymorphic. For an example, see the definition of `int_wasm_sub_sat_signed`, which is polymorphic over all vector types (although not all vector types are actually supported in the backend). I don't know how much work it would be to support that kind of polymorphism for reference types, though.
>>
>> You mean the polymorphism achieve through `llvm_anyvector_ty`? So I guess the way to go about it would be to try to add a `wasm_anyreftype_ty`... I will take a look.
>
> Yes, exactly. There's also the even more permissive `llvm_any_ty`. It looks like this would involve updating llvm/include/llvm/CodeGen/ValueTypes.td and llvm/include/llvm/Support/MachineValueType.h to add a new `rAny` value type that would be used by tablegen in llvm/utils/TableGen/{CodeGenDAGPatterns,CodeGenTarget,IntrinsicEmitter}.cpp.

That makes sense. Thanks for the pointers. 
I am sort of going the rabbit hole of trying to understand how far I need to go to have `llvm_externref_ty` and `llvm_funcref_ty` in an intrinsic. This seems to require changes in a wide range of files - assuming it would be similar (if not worse) with a polymorphic type. Unfortunately, it is still now compiling as there are further changes required.


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