1 //===- Target.td - Define GlobalISel rules -----------------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
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.
18 //===----------------------------------------------------------------------===//
20 // Definitions that inherit from LLT define types that will be used in the
21 // GlobalISel matcher.
27 // Defines a matcher for complex operands. This is analogous to ComplexPattern
30 // Definitions that inherit from this may also inherit from
31 // GIComplexPatternEquiv to enable the import of SelectionDAG patterns involving
32 // those ComplexPatterns.
33 class GIComplexOperandMatcher<LLT type, dag operands, string matcherfn> {
34 // The expected type of the root of the match.
36 // TODO: We should probably support, any-type, any-scalar, and multiple types
40 // The operands that result from a successful match
41 // Should be of the form '(ops ty1, ty2, ...)' where ty1/ty2 are definitions
42 // that inherit from Operand.
44 // FIXME: Which definition is used for ty1/ty2 doesn't actually matter at the
45 // moment. Only the number of operands is used.
46 dag Operands = operands;
48 // The function that determines whether the operand matches. It should be of
50 // bool select(const MatchOperand &Root, MatchOperand &Result1)
51 // and should have the same number of ResultX arguments as the number of
52 // result operands. It must return true on successful match and false
53 // otherwise. If it returns true, then all the ResultX arguments must be
55 string MatcherFn = matcherfn;