1// WebAssemblyInstrRef.td - WebAssembly reference type codegen --*- tablegen -*- 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8/// 9/// \file 10/// WebAssembly reference type operand codegen constructs. 11/// 12//===----------------------------------------------------------------------===// 13 14defm SELECT_EXNREF : I<(outs EXNREF:$dst), 15 (ins EXNREF:$lhs, EXNREF:$rhs, I32:$cond), 16 (outs), (ins), 17 [(set EXNREF:$dst, 18 (select I32:$cond, EXNREF:$lhs, EXNREF:$rhs))], 19 "exnref.select\t$dst, $lhs, $rhs, $cond", 20 "exnref.select", 0x1b>; 21 22def : Pat<(select (i32 (setne I32:$cond, 0)), EXNREF:$lhs, EXNREF:$rhs), 23 (SELECT_EXNREF EXNREF:$lhs, EXNREF:$rhs, I32:$cond)>; 24def : Pat<(select (i32 (seteq I32:$cond, 0)), EXNREF:$lhs, EXNREF:$rhs), 25 (SELECT_EXNREF EXNREF:$rhs, EXNREF:$lhs, I32:$cond)>; 26 27multiclass REF<WebAssemblyRegClass rt> { 28 defm REF_NULL_#rt : I<(outs rt:$res), (ins HeapType:$heaptype), 29 (outs), (ins HeapType:$heaptype), 30 [], 31 "ref.null\t$res, $heaptype", 32 "ref.null\t$heaptype", 33 0xd0>; 34} 35 36defm "" : REF<FUNCREF>, Requires<[HasReferenceTypes]>; 37defm "" : REF<EXTERNREF>, Requires<[HasReferenceTypes]>; 38