Debian Codegraph @

suite/synctools/tablegen/include/llvm/Target/GlobalISel/Target.td

raw
1 //===- Target.td - Define GlobalISel rules -----------------*- 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 // This file defines the target-independent interfaces used to support
10 // SelectionDAG instruction selection patterns (specified in
11 // TargetSelectionDAG.td) when generating GlobalISel instruction selectors.
12 //
13 // This is intended as a compatibility layer, to enable reuse of target
14 // descriptions written for SelectionDAG without requiring explicit GlobalISel
15 // support. It will eventually supersede SelectionDAG patterns.
16 //
17 //===----------------------------------------------------------------------===//
18
19 // Definitions that inherit from LLT define types that will be used in the
20 // GlobalISel matcher.
21 class LLT;
22
23 def s32 : LLT;
24 def s64 : LLT;
25
26 // Defines a matcher for complex operands. This is analogous to ComplexPattern
27 // from SelectionDAG.
28 //
29 // Definitions that inherit from this may also inherit from
30 // GIComplexPatternEquiv to enable the import of SelectionDAG patterns involving
31 // those ComplexPatterns.
32 class GIComplexOperandMatcher<LLT type, string matcherfn> {
33 // The expected type of the root of the match.
34 //
35 // TODO: We should probably support, any-type, any-scalar, and multiple types
36 // in the future.
37 LLT Type = type;
38
39 // The function that determines whether the operand matches. It should be of
40 // the form:
41 // ComplexRendererFn select(MachineOperand &Root) const;
42 // where Root is the root of the match. The function should return nullptr
43 // on match failure, or a ComplexRendererFn that renders the operand in case
44 // of a successful match.
45 string MatcherFn = matcherfn;
46 }
47
48 // Defines a custom renderer. This is analogous to SDNodeXForm from
49 // SelectionDAG. Unlike SDNodeXForm, this matches a MachineInstr and
50 // renders directly to the result instruction without an intermediate node.
51 //
52 // Definitions that inherit from this may also inherit from GISDNodeXFormEquiv
53 // to enable the import of SelectionDAG patterns involving those SDNodeXForms.
54 class GICustomOperandRenderer<string rendererfn> {
55 // The function renders the operand(s) of the matched instruction to
56 // the specified instruction. It should be of the form:
57 // void render(MachineInstrBuilder &MIB, const MachineInstr &MI,
58 // int OpIdx = -1)
59 //
60 // If OpIdx is specified (i.e. not invalid/negative), this
61 // references the source operand MI.getOperand(OpIdx). Otherwise,
62 // this is the value defined by MI. This is to support the case
63 // where there is no corresponding instruction to match.
64 string RendererFn = rendererfn;
65 }