@@ -232,6 +232,7 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
232232
233233 case ISD::INTRINSIC_VOID: {
234234 unsigned IntNo = Node->getConstantOperandVal (1 );
235+ llvm::errs () << " DEBUG: INTRINSIC_VOID instruction selection for intrinsic " << IntNo << " \n " ;
235236 switch (IntNo) {
236237 case Intrinsic::wasm_throw: {
237238 int Tag = Node->getConstantOperandVal (2 );
@@ -260,10 +261,159 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
260261 ReplaceNode (Node, Rethrow);
261262 return ;
262263 }
264+
265+ // Inference block intrinsics
266+ case Intrinsic::wasm_forall_start: {
267+ llvm::errs () << " DEBUG: Custom instruction selection for wasm_forall_start\n " ;
268+ MachineSDNode *ForallStart = CurDAG->getMachineNode (
269+ WebAssembly::INFERENCE_FORALL, DL,
270+ MVT::Other, // outchain type
271+ Node->getOperand (0 ) // inchain
272+ );
273+ ReplaceNode (Node, ForallStart);
274+ return ;
275+ }
276+ case Intrinsic::wasm_exists_start: {
277+ MachineSDNode *ExistsStart = CurDAG->getMachineNode (
278+ WebAssembly::INFERENCE_EXISTS, DL,
279+ MVT::Other, // outchain type
280+ Node->getOperand (0 ) // inchain
281+ );
282+ ReplaceNode (Node, ExistsStart);
283+ return ;
284+ }
285+ case Intrinsic::wasm_assume_start: {
286+ MachineSDNode *AssumeStart = CurDAG->getMachineNode (
287+ WebAssembly::INFERENCE_ASSUME, DL,
288+ MVT::Other, // outchain type
289+ Node->getOperand (0 ) // inchain
290+ );
291+ ReplaceNode (Node, AssumeStart);
292+ return ;
293+ }
294+ case Intrinsic::wasm_unique_start: {
295+ MachineSDNode *UniqueStart = CurDAG->getMachineNode (
296+ WebAssembly::INFERENCE_UNIQUE, DL,
297+ MVT::Other, // outchain type
298+ Node->getOperand (0 ) // inchain
299+ );
300+ ReplaceNode (Node, UniqueStart);
301+ return ;
302+ }
303+ case Intrinsic::wasm_forall_end: {
304+ MachineSDNode *ForallEnd = CurDAG->getMachineNode (
305+ WebAssembly::INFERENCE_FORALL_END, DL,
306+ MVT::Other, // outchain type
307+ Node->getOperand (0 ) // inchain
308+ );
309+ ReplaceNode (Node, ForallEnd);
310+ return ;
311+ }
312+ case Intrinsic::wasm_exists_end: {
313+ MachineSDNode *ExistsEnd = CurDAG->getMachineNode (
314+ WebAssembly::INFERENCE_EXISTS_END, DL,
315+ MVT::Other, // outchain type
316+ Node->getOperand (0 ) // inchain
317+ );
318+ ReplaceNode (Node, ExistsEnd);
319+ return ;
320+ }
321+ case Intrinsic::wasm_assume_end: {
322+ MachineSDNode *AssumeEnd = CurDAG->getMachineNode (
323+ WebAssembly::INFERENCE_ASSUME_END, DL,
324+ MVT::Other, // outchain type
325+ Node->getOperand (0 ) // inchain
326+ );
327+ ReplaceNode (Node, AssumeEnd);
328+ return ;
329+ }
330+ case Intrinsic::wasm_unique_end: {
331+ MachineSDNode *UniqueEnd = CurDAG->getMachineNode (
332+ WebAssembly::INFERENCE_UNIQUE_END, DL,
333+ MVT::Other, // outchain type
334+ Node->getOperand (0 ) // inchain
335+ );
336+ ReplaceNode (Node, UniqueEnd);
337+ return ;
338+ }
263339 }
264340 break ;
265341 }
266342
343+
344+ // Inference block instructions
345+ case WebAssemblyISD::BLOCK_FORALL: {
346+ MachineSDNode *ForallStart = CurDAG->getMachineNode (
347+ WebAssembly::INFERENCE_FORALL, DL,
348+ MVT::Other, // outchain type
349+ Node->getOperand (0 ) // inchain
350+ );
351+ ReplaceNode (Node, ForallStart);
352+ return ;
353+ }
354+ case WebAssemblyISD::BLOCK_EXISTS: {
355+ MachineSDNode *ExistsStart = CurDAG->getMachineNode (
356+ WebAssembly::INFERENCE_EXISTS, DL,
357+ MVT::Other, // outchain type
358+ Node->getOperand (0 ) // inchain
359+ );
360+ ReplaceNode (Node, ExistsStart);
361+ return ;
362+ }
363+ case WebAssemblyISD::BLOCK_ASSUME: {
364+ MachineSDNode *AssumeStart = CurDAG->getMachineNode (
365+ WebAssembly::INFERENCE_ASSUME, DL,
366+ MVT::Other, // outchain type
367+ Node->getOperand (0 ) // inchain
368+ );
369+ ReplaceNode (Node, AssumeStart);
370+ return ;
371+ }
372+ case WebAssemblyISD::BLOCK_UNIQUE: {
373+ MachineSDNode *UniqueStart = CurDAG->getMachineNode (
374+ WebAssembly::INFERENCE_UNIQUE, DL,
375+ MVT::Other, // outchain type
376+ Node->getOperand (0 ) // inchain
377+ );
378+ ReplaceNode (Node, UniqueStart);
379+ return ;
380+ }
381+ case WebAssemblyISD::BLOCK_FORALL_END: {
382+ MachineSDNode *ForallEnd = CurDAG->getMachineNode (
383+ WebAssembly::INFERENCE_FORALL_END, DL,
384+ MVT::Other, // outchain type
385+ Node->getOperand (0 ) // inchain
386+ );
387+ ReplaceNode (Node, ForallEnd);
388+ return ;
389+ }
390+ case WebAssemblyISD::BLOCK_EXISTS_END: {
391+ MachineSDNode *ExistsEnd = CurDAG->getMachineNode (
392+ WebAssembly::INFERENCE_EXISTS_END, DL,
393+ MVT::Other, // outchain type
394+ Node->getOperand (0 ) // inchain
395+ );
396+ ReplaceNode (Node, ExistsEnd);
397+ return ;
398+ }
399+ case WebAssemblyISD::BLOCK_ASSUME_END: {
400+ MachineSDNode *AssumeEnd = CurDAG->getMachineNode (
401+ WebAssembly::INFERENCE_ASSUME_END, DL,
402+ MVT::Other, // outchain type
403+ Node->getOperand (0 ) // inchain
404+ );
405+ ReplaceNode (Node, AssumeEnd);
406+ return ;
407+ }
408+ case WebAssemblyISD::BLOCK_UNIQUE_END: {
409+ MachineSDNode *UniqueEnd = CurDAG->getMachineNode (
410+ WebAssembly::INFERENCE_UNIQUE_END, DL,
411+ MVT::Other, // outchain type
412+ Node->getOperand (0 ) // inchain
413+ );
414+ ReplaceNode (Node, UniqueEnd);
415+ return ;
416+ }
267417 case WebAssemblyISD::CALL:
268418 case WebAssemblyISD::RET_CALL: {
269419 // CALL has both variable operands and variable results, but ISel only
0 commit comments