[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / Target / WebAssembly / WebAssemblyInstrRef.td
blobef9bd35d004a543b2fb7366231f64bec3a5f73ff
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 //===----------------------------------------------------------------------===//
14 multiclass REF_I<WebAssemblyRegClass rc, ValueType vt> {
15   defm REF_NULL_#rc : I<(outs rc:$res), (ins HeapType:$heaptype),
16                         (outs), (ins HeapType:$heaptype),
17                         [],
18                         "ref.null\t$res, $heaptype",
19                         "ref.null\t$heaptype",
20                         0xd0>,
21                       Requires<[HasReferenceTypes]>;
22   defm SELECT_#rc: I<(outs rc:$dst), (ins rc:$lhs, rc:$rhs, I32:$cond),
23                      (outs), (ins),
24                      [(set rc:$dst,
25                        (select I32:$cond, rc:$lhs, rc:$rhs))],
26                      vt#".select\t$dst, $lhs, $rhs, $cond",
27                      vt#".select", 0x1b>,
28                    Requires<[HasReferenceTypes]>;
31 defm "" : REF_I<FUNCREF, funcref>;
32 defm "" : REF_I<EXTERNREF, externref>;
34 foreach rc = [FUNCREF, EXTERNREF] in {
35 def : Pat<(select (i32 (setne I32:$cond, 0)), rc:$lhs, rc:$rhs),
36           (!cast<Instruction>("SELECT_"#rc) rc:$lhs, rc:$rhs, I32:$cond)>;
37 def : Pat<(select (i32 (seteq I32:$cond, 0)), rc:$lhs, rc:$rhs),
38           (!cast<Instruction>("SELECT_"#rc) rc:$rhs, rc:$lhs, I32:$cond)>;