]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / Target / GlobalISel / SelectionDAGCompat.td
1 //===- TargetGlobalISel.td - Common code for GlobalISel ----*- tablegen -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the target-independent interfaces used to support
11 // SelectionDAG instruction selection patterns (specified in
12 // TargetSelectionDAG.td) when generating GlobalISel instruction selectors.
13 //
14 // This is intended as a compatibility layer, to enable reuse of target
15 // descriptions written for SelectionDAG without requiring explicit GlobalISel
16 // support.  It will eventually supersede SelectionDAG patterns.
17 //
18 //===----------------------------------------------------------------------===//
19
20 // Declare that a generic Instruction is 'equivalent' to an SDNode, that is,
21 // SelectionDAG patterns involving the SDNode can be transformed to match the
22 // Instruction instead.
23 class GINodeEquiv<Instruction i, SDNode node> {
24   Instruction I = i;
25   SDNode Node = node;
26 }
27
28 // These are defined in the same order as the G_* instructions.
29 def : GINodeEquiv<G_ANYEXT, anyext>;
30 def : GINodeEquiv<G_SEXT, sext>;
31 def : GINodeEquiv<G_ZEXT, zext>;
32 def : GINodeEquiv<G_TRUNC, trunc>;
33 def : GINodeEquiv<G_BITCAST, bitconvert>;
34 // G_INTTOPTR - SelectionDAG has no equivalent.
35 // G_PTRTOINT - SelectionDAG has no equivalent.
36 // G_CONSTANT - Not needed since constants aren't operators.
37 // G_FCONSTANT - Not needed since constants aren't operators.
38 def : GINodeEquiv<G_ADD, add>;
39 def : GINodeEquiv<G_SUB, sub>;
40 def : GINodeEquiv<G_MUL, mul>;
41 def : GINodeEquiv<G_SDIV, sdiv>;
42 def : GINodeEquiv<G_UDIV, udiv>;
43 def : GINodeEquiv<G_SREM, srem>;
44 def : GINodeEquiv<G_UREM, urem>;
45 def : GINodeEquiv<G_AND, and>;
46 def : GINodeEquiv<G_OR, or>;
47 def : GINodeEquiv<G_XOR, xor>;
48 def : GINodeEquiv<G_SHL, shl>;
49 def : GINodeEquiv<G_LSHR, srl>;
50 def : GINodeEquiv<G_ASHR, sra>;
51 def : GINodeEquiv<G_SELECT, select>;
52 def : GINodeEquiv<G_FNEG, fneg>;
53 def : GINodeEquiv<G_FPEXT, fpextend>;
54 def : GINodeEquiv<G_FPTRUNC, ftrunc>;
55 def : GINodeEquiv<G_FPTOSI, fp_to_sint>;
56 def : GINodeEquiv<G_FPTOUI, fp_to_uint>;
57 def : GINodeEquiv<G_SITOFP, sint_to_fp>;
58 def : GINodeEquiv<G_UITOFP, uint_to_fp>;
59 def : GINodeEquiv<G_FADD, fadd>;
60 def : GINodeEquiv<G_FSUB, fsub>;
61 def : GINodeEquiv<G_FMA, fma>;
62 def : GINodeEquiv<G_FMUL, fmul>;
63 def : GINodeEquiv<G_FDIV, fdiv>;
64 def : GINodeEquiv<G_FREM, frem>;
65 def : GINodeEquiv<G_FPOW, fpow>;
66 def : GINodeEquiv<G_FEXP2, fexp2>;
67 def : GINodeEquiv<G_FLOG2, flog2>;
68 def : GINodeEquiv<G_INTRINSIC, intrinsic_wo_chain>;
69 def : GINodeEquiv<G_BR, br>;
70
71 // Specifies the GlobalISel equivalents for SelectionDAG's ComplexPattern.
72 // Should be used on defs that subclass GIComplexOperandMatcher<>.
73 class GIComplexPatternEquiv<ComplexPattern seldag> {
74   ComplexPattern SelDAGEquivalent = seldag;
75 }