Warning, /include/llvm/Target/GlobalISel/Target.td is written in an unsupported language. File is not indexed.
0001 //===- Target.td - Define GlobalISel rules -----------------*- tablegen -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the target-independent interfaces used to support
0010 // SelectionDAG instruction selection patterns (specified in
0011 // TargetSelectionDAG.td) when generating GlobalISel instruction selectors.
0012 //
0013 // This is intended as a compatibility layer, to enable reuse of target
0014 // descriptions written for SelectionDAG without requiring explicit GlobalISel
0015 // support. It will eventually supersede SelectionDAG patterns.
0016 //
0017 //===----------------------------------------------------------------------===//
0018
0019 // Definitions that inherit from LLT define types that will be used in the
0020 // GlobalISel matcher.
0021 class LLT;
0022
0023 def s32 : LLT;
0024 def s64 : LLT;
0025 def v2s32 : LLT;
0026 def v4s16 : LLT;
0027 def v8s8 : LLT;
0028
0029 // Defines a matcher for complex operands. This is analogous to ComplexPattern
0030 // from SelectionDAG.
0031 //
0032 // Definitions that inherit from this may also inherit from
0033 // GIComplexPatternEquiv to enable the import of SelectionDAG patterns involving
0034 // those ComplexPatterns.
0035 class GIComplexOperandMatcher<LLT type, string matcherfn> {
0036 // The expected type of the root of the match.
0037 //
0038 // TODO: We should probably support, any-type, any-scalar, and multiple types
0039 // in the future.
0040 LLT Type = type;
0041
0042 // The function that determines whether the operand matches. It should be of
0043 // the form:
0044 // ComplexRendererFn select(MachineOperand &Root) const;
0045 // where Root is the root of the match. The function should return nullptr
0046 // on match failure, or a ComplexRendererFn that renders the operand in case
0047 // of a successful match.
0048 string MatcherFn = matcherfn;
0049 }
0050
0051 // Defines a custom renderer. This is analogous to SDNodeXForm from
0052 // SelectionDAG. Unlike SDNodeXForm, this matches a MachineInstr and
0053 // renders directly to the result instruction without an intermediate node.
0054 //
0055 // Definitions that inherit from this may also inherit from GISDNodeXFormEquiv
0056 // to enable the import of SelectionDAG patterns involving those SDNodeXForms.
0057 class GICustomOperandRenderer<string rendererfn> {
0058 // The function renders the operand(s) of the matched instruction to
0059 // the specified instruction. It should be of the form:
0060 // void render(MachineInstrBuilder &MIB, const MachineInstr &MI,
0061 // int OpIdx = -1)
0062 //
0063 // If OpIdx is specified (i.e. not invalid/negative), this
0064 // references the source operand MI.getOperand(OpIdx). Otherwise,
0065 // this is the value defined by MI. This is to support the case
0066 // where there is no corresponding instruction to match.
0067 string RendererFn = rendererfn;
0068 }