================
@@ -275,6 +275,27 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
       ReplaceNode(Node, TLSAlign);
       return;
     }
+    case Intrinsic::wasm_ptr_to_funcref: {
+      // Convert a function pointer to a funcref by reading the corresponding
+      // entry from the __indirect_function_table.
+      MachineFunction &MF = CurDAG->getMachineFunction();
+      auto PtrVT = 
MVT::getIntegerVT(MF.getDataLayout().getPointerSizeInBits());
+      MCSymbol *Table = WebAssembly::getOrCreateFunctionTableSymbol(
+          MF.getContext(), Subtarget);
+      SDValue TableSym = CurDAG->getMCSymbol(Table, PtrVT);
+      SDValue FuncPtr = Node->getOperand(1);
+      if (Subtarget->hasAddr64() && FuncPtr.getValueType() == MVT::i64) {
+        // table.get expects an i32 but on 64 bit platforms the function 
pointer
----------------
QuantumSegfault wrote:

That would be #180649

I'll have to see where we left off.

https://github.com/llvm/llvm-project/pull/203165
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to