1 //===- Target.td - Define GlobalISel rules -----------------*- 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 // Definitions that inherit from LLT define types that will be used in the 21 // GlobalISel matcher. 22 class LLT; 23 24 def s32 : LLT; 25 def s64 : LLT; 26 27 // Defines a matcher for complex operands. This is analogous to ComplexPattern 28 // from SelectionDAG. 29 // 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, string matcherfn> { 34 // The expected type of the root of the match. 35 // 36 // TODO: We should probably support, any-type, any-scalar, and multiple types 37 // in the future. 38 LLT Type = type; 39 40 // The function that determines whether the operand matches. It should be of 41 // the form: 42 // bool select(const MatchOperand &Root, MatchOperand &Result1) 43 // and should have the same number of ResultX arguments as the number of 44 // result operands. It must return true on successful match and false 45 // otherwise. If it returns true, then all the ResultX arguments must be 46 // overwritten. 47 string MatcherFn = matcherfn; 48 } 49