1 //===- TargetSelectionDAG.td - Common code for DAG isels ---*- 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 by SelectionDAG
11 // instruction selection generators.
13 //===----------------------------------------------------------------------===//
15 //===----------------------------------------------------------------------===//
16 // Selection DAG Type Constraint definitions.
18 // Note that the semantics of these constraints are hard coded into tblgen. To
19 // modify or add constraints, you have to hack tblgen.
22 class SDTypeConstraint<int opnum> {
23 int OperandNum = opnum;
26 // SDTCisVT - The specified operand has exactly this VT.
27 class SDTCisVT<int OpNum, ValueType vt> : SDTypeConstraint<OpNum> {
31 class SDTCisPtrTy<int OpNum> : SDTypeConstraint<OpNum>;
33 // SDTCisInt - The specified operand has integer type.
34 class SDTCisInt<int OpNum> : SDTypeConstraint<OpNum>;
36 // SDTCisFP - The specified operand has floating-point type.
37 class SDTCisFP<int OpNum> : SDTypeConstraint<OpNum>;
39 // SDTCisVec - The specified operand has a vector type.
40 class SDTCisVec<int OpNum> : SDTypeConstraint<OpNum>;
42 // SDTCisSameAs - The two specified operands have identical types.
43 class SDTCisSameAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
44 int OtherOperandNum = OtherOp;
47 // SDTCisVTSmallerThanOp - The specified operand is a VT SDNode, and its type is
48 // smaller than the 'Other' operand.
49 class SDTCisVTSmallerThanOp<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
50 int OtherOperandNum = OtherOp;
53 class SDTCisOpSmallerThanOp<int SmallOp, int BigOp> : SDTypeConstraint<SmallOp>{
54 int BigOperandNum = BigOp;
57 /// SDTCisEltOfVec - This indicates that ThisOp is a scalar type of the same
58 /// type as the element type of OtherOp, which is a vector type.
59 class SDTCisEltOfVec<int ThisOp, int OtherOp>
60 : SDTypeConstraint<ThisOp> {
61 int OtherOpNum = OtherOp;
64 /// SDTCisSubVecOfVec - This indicates that ThisOp is a vector type
65 /// with length less that of OtherOp, which is a vector type.
66 class SDTCisSubVecOfVec<int ThisOp, int OtherOp>
67 : SDTypeConstraint<ThisOp> {
68 int OtherOpNum = OtherOp;
71 //===----------------------------------------------------------------------===//
72 // Selection DAG Type Profile definitions.
74 // These use the constraints defined above to describe the type requirements of
75 // the various nodes. These are not hard coded into tblgen, allowing targets to
76 // add their own if needed.
79 // SDTypeProfile - This profile describes the type requirements of a Selection
81 class SDTypeProfile<int numresults, int numoperands,
82 list<SDTypeConstraint> constraints> {
83 int NumResults = numresults;
84 int NumOperands = numoperands;
85 list<SDTypeConstraint> Constraints = constraints;
89 def SDTIntLeaf: SDTypeProfile<1, 0, [SDTCisInt<0>]>; // for 'imm'.
90 def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'.
91 def SDTPtrLeaf: SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; // for '&g'.
92 def SDTOther : SDTypeProfile<1, 0, [SDTCisVT<0, OtherVT>]>; // for 'vt'.
93 def SDTUNDEF : SDTypeProfile<1, 0, []>; // for 'undef'.
94 def SDTUnaryOp : SDTypeProfile<1, 1, []>; // for bitconvert.
96 def SDTIntBinOp : SDTypeProfile<1, 2, [ // add, and, or, xor, udiv, etc.
97 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>
99 def SDTIntShiftOp : SDTypeProfile<1, 2, [ // shl, sra, srl
100 SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisInt<2>
102 def SDTIntBinHiLoOp : SDTypeProfile<2, 2, [ // mulhi, mullo, sdivrem, udivrem
103 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>,SDTCisInt<0>
106 def SDTFPBinOp : SDTypeProfile<1, 2, [ // fadd, fmul, etc.
107 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0>
109 def SDTFPSignOp : SDTypeProfile<1, 2, [ // fcopysign.
110 SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisFP<2>
112 def SDTFPTernaryOp : SDTypeProfile<1, 3, [ // fmadd, fnmsub, etc.
113 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisFP<0>
115 def SDTIntUnaryOp : SDTypeProfile<1, 1, [ // ctlz
116 SDTCisSameAs<0, 1>, SDTCisInt<0>
118 def SDTIntExtendOp : SDTypeProfile<1, 1, [ // sext, zext, anyext
119 SDTCisInt<0>, SDTCisInt<1>, SDTCisOpSmallerThanOp<1, 0>
121 def SDTIntTruncOp : SDTypeProfile<1, 1, [ // trunc
122 SDTCisInt<0>, SDTCisInt<1>, SDTCisOpSmallerThanOp<0, 1>
124 def SDTFPUnaryOp : SDTypeProfile<1, 1, [ // fneg, fsqrt, etc
125 SDTCisSameAs<0, 1>, SDTCisFP<0>
127 def SDTFPRoundOp : SDTypeProfile<1, 1, [ // fround
128 SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<0, 1>
130 def SDTFPExtendOp : SDTypeProfile<1, 1, [ // fextend
131 SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<1, 0>
133 def SDTIntToFPOp : SDTypeProfile<1, 1, [ // [su]int_to_fp
134 SDTCisFP<0>, SDTCisInt<1>
136 def SDTFPToIntOp : SDTypeProfile<1, 1, [ // fp_to_[su]int
137 SDTCisInt<0>, SDTCisFP<1>
139 def SDTExtInreg : SDTypeProfile<1, 2, [ // sext_inreg
140 SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisVT<2, OtherVT>,
141 SDTCisVTSmallerThanOp<2, 1>
144 def SDTSetCC : SDTypeProfile<1, 3, [ // setcc
145 SDTCisInt<0>, SDTCisSameAs<1, 2>, SDTCisVT<3, OtherVT>
148 def SDTSelect : SDTypeProfile<1, 3, [ // select
149 SDTCisInt<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>
152 def SDTSelectCC : SDTypeProfile<1, 5, [ // select_cc
153 SDTCisSameAs<1, 2>, SDTCisSameAs<3, 4>, SDTCisSameAs<0, 3>,
157 def SDTBr : SDTypeProfile<0, 1, [ // br
161 def SDTBrcond : SDTypeProfile<0, 2, [ // brcond
162 SDTCisInt<0>, SDTCisVT<1, OtherVT>
165 def SDTBrind : SDTypeProfile<0, 1, [ // brind
169 def SDTNone : SDTypeProfile<0, 0, []>; // ret, trap
171 def SDTLoad : SDTypeProfile<1, 1, [ // load
175 def SDTStore : SDTypeProfile<0, 2, [ // store
179 def SDTIStore : SDTypeProfile<1, 3, [ // indexed store
180 SDTCisSameAs<0, 2>, SDTCisPtrTy<0>, SDTCisPtrTy<3>
183 def SDTVecShuffle : SDTypeProfile<1, 2, [
184 SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>
186 def SDTVecExtract : SDTypeProfile<1, 2, [ // vector extract
187 SDTCisEltOfVec<0, 1>, SDTCisPtrTy<2>
189 def SDTVecInsert : SDTypeProfile<1, 3, [ // vector insert
190 SDTCisEltOfVec<2, 1>, SDTCisSameAs<0, 1>, SDTCisPtrTy<3>
193 def SDTSubVecExtract : SDTypeProfile<1, 2, [// subvector extract
194 SDTCisSubVecOfVec<0,1>
196 def SDTSubVecInsert : SDTypeProfile<1, 3, [ // subvector insert
197 SDTCisSubVecOfVec<2, 1>, SDTCisSameAs<0,1>
200 def SDTPrefetch : SDTypeProfile<0, 3, [ // prefetch
201 SDTCisPtrTy<0>, SDTCisSameAs<1, 2>, SDTCisInt<1>
204 def SDTMemBarrier : SDTypeProfile<0, 5, [ // memory barier
205 SDTCisSameAs<0,1>, SDTCisSameAs<0,2>, SDTCisSameAs<0,3>, SDTCisSameAs<0,4>,
208 def SDTAtomic3 : SDTypeProfile<1, 3, [
209 SDTCisSameAs<0,2>, SDTCisSameAs<0,3>, SDTCisInt<0>, SDTCisPtrTy<1>
211 def SDTAtomic2 : SDTypeProfile<1, 2, [
212 SDTCisSameAs<0,2>, SDTCisInt<0>, SDTCisPtrTy<1>
215 def SDTConvertOp : SDTypeProfile<1, 5, [ //cvtss, su, us, uu, ff, fs, fu, sf, su
216 SDTCisVT<2, OtherVT>, SDTCisVT<3, OtherVT>, SDTCisPtrTy<4>, SDTCisPtrTy<5>
219 class SDCallSeqStart<list<SDTypeConstraint> constraints> :
220 SDTypeProfile<0, 1, constraints>;
221 class SDCallSeqEnd<list<SDTypeConstraint> constraints> :
222 SDTypeProfile<0, 2, constraints>;
224 //===----------------------------------------------------------------------===//
225 // Selection DAG Node Properties.
227 // Note: These are hard coded into tblgen.
229 class SDNodeProperty;
230 def SDNPCommutative : SDNodeProperty; // X op Y == Y op X
231 def SDNPAssociative : SDNodeProperty; // (X op Y) op Z == X op (Y op Z)
232 def SDNPHasChain : SDNodeProperty; // R/W chain operand and result
233 def SDNPOutGlue : SDNodeProperty; // Write a flag result
234 def SDNPInGlue : SDNodeProperty; // Read a flag operand
235 def SDNPOptInGlue : SDNodeProperty; // Optionally read a flag operand
236 def SDNPMayStore : SDNodeProperty; // May write to memory, sets 'mayStore'.
237 def SDNPMayLoad : SDNodeProperty; // May read memory, sets 'mayLoad'.
238 def SDNPSideEffect : SDNodeProperty; // Sets 'HasUnmodelledSideEffects'.
239 def SDNPMemOperand : SDNodeProperty; // Touches memory, has assoc MemOperand
240 def SDNPVariadic : SDNodeProperty; // Node has variable arguments.
241 def SDNPWantRoot : SDNodeProperty; // ComplexPattern gets the root of match
242 def SDNPWantParent : SDNodeProperty; // ComplexPattern gets the parent
244 //===----------------------------------------------------------------------===//
245 // Selection DAG Pattern Operations
246 class SDPatternOperator;
248 //===----------------------------------------------------------------------===//
249 // Selection DAG Node definitions.
251 class SDNode<string opcode, SDTypeProfile typeprof,
252 list<SDNodeProperty> props = [], string sdclass = "SDNode">
253 : SDPatternOperator {
254 string Opcode = opcode;
255 string SDClass = sdclass;
256 list<SDNodeProperty> Properties = props;
257 SDTypeProfile TypeProfile = typeprof;
260 // Special TableGen-recognized dag nodes
266 def imm : SDNode<"ISD::Constant" , SDTIntLeaf , [], "ConstantSDNode">;
267 def timm : SDNode<"ISD::TargetConstant",SDTIntLeaf, [], "ConstantSDNode">;
268 def fpimm : SDNode<"ISD::ConstantFP", SDTFPLeaf , [], "ConstantFPSDNode">;
269 def vt : SDNode<"ISD::VALUETYPE" , SDTOther , [], "VTSDNode">;
270 def bb : SDNode<"ISD::BasicBlock", SDTOther , [], "BasicBlockSDNode">;
271 def cond : SDNode<"ISD::CONDCODE" , SDTOther , [], "CondCodeSDNode">;
272 def undef : SDNode<"ISD::UNDEF" , SDTUNDEF , []>;
273 def globaladdr : SDNode<"ISD::GlobalAddress", SDTPtrLeaf, [],
274 "GlobalAddressSDNode">;
275 def tglobaladdr : SDNode<"ISD::TargetGlobalAddress", SDTPtrLeaf, [],
276 "GlobalAddressSDNode">;
277 def globaltlsaddr : SDNode<"ISD::GlobalTLSAddress", SDTPtrLeaf, [],
278 "GlobalAddressSDNode">;
279 def tglobaltlsaddr : SDNode<"ISD::TargetGlobalTLSAddress", SDTPtrLeaf, [],
280 "GlobalAddressSDNode">;
281 def constpool : SDNode<"ISD::ConstantPool", SDTPtrLeaf, [],
282 "ConstantPoolSDNode">;
283 def tconstpool : SDNode<"ISD::TargetConstantPool", SDTPtrLeaf, [],
284 "ConstantPoolSDNode">;
285 def jumptable : SDNode<"ISD::JumpTable", SDTPtrLeaf, [],
287 def tjumptable : SDNode<"ISD::TargetJumpTable", SDTPtrLeaf, [],
289 def frameindex : SDNode<"ISD::FrameIndex", SDTPtrLeaf, [],
291 def tframeindex : SDNode<"ISD::TargetFrameIndex", SDTPtrLeaf, [],
293 def externalsym : SDNode<"ISD::ExternalSymbol", SDTPtrLeaf, [],
294 "ExternalSymbolSDNode">;
295 def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
296 "ExternalSymbolSDNode">;
297 def blockaddress : SDNode<"ISD::BlockAddress", SDTPtrLeaf, [],
298 "BlockAddressSDNode">;
299 def tblockaddress: SDNode<"ISD::TargetBlockAddress", SDTPtrLeaf, [],
300 "BlockAddressSDNode">;
302 def add : SDNode<"ISD::ADD" , SDTIntBinOp ,
303 [SDNPCommutative, SDNPAssociative]>;
304 def sub : SDNode<"ISD::SUB" , SDTIntBinOp>;
305 def mul : SDNode<"ISD::MUL" , SDTIntBinOp,
306 [SDNPCommutative, SDNPAssociative]>;
307 def mulhs : SDNode<"ISD::MULHS" , SDTIntBinOp, [SDNPCommutative]>;
308 def mulhu : SDNode<"ISD::MULHU" , SDTIntBinOp, [SDNPCommutative]>;
309 def smullohi : SDNode<"ISD::SMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>;
310 def umullohi : SDNode<"ISD::UMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>;
311 def sdiv : SDNode<"ISD::SDIV" , SDTIntBinOp>;
312 def udiv : SDNode<"ISD::UDIV" , SDTIntBinOp>;
313 def srem : SDNode<"ISD::SREM" , SDTIntBinOp>;
314 def urem : SDNode<"ISD::UREM" , SDTIntBinOp>;
315 def sdivrem : SDNode<"ISD::SDIVREM" , SDTIntBinHiLoOp>;
316 def udivrem : SDNode<"ISD::UDIVREM" , SDTIntBinHiLoOp>;
317 def srl : SDNode<"ISD::SRL" , SDTIntShiftOp>;
318 def sra : SDNode<"ISD::SRA" , SDTIntShiftOp>;
319 def shl : SDNode<"ISD::SHL" , SDTIntShiftOp>;
320 def rotl : SDNode<"ISD::ROTL" , SDTIntShiftOp>;
321 def rotr : SDNode<"ISD::ROTR" , SDTIntShiftOp>;
322 def and : SDNode<"ISD::AND" , SDTIntBinOp,
323 [SDNPCommutative, SDNPAssociative]>;
324 def or : SDNode<"ISD::OR" , SDTIntBinOp,
325 [SDNPCommutative, SDNPAssociative]>;
326 def xor : SDNode<"ISD::XOR" , SDTIntBinOp,
327 [SDNPCommutative, SDNPAssociative]>;
328 def addc : SDNode<"ISD::ADDC" , SDTIntBinOp,
329 [SDNPCommutative, SDNPOutGlue]>;
330 def adde : SDNode<"ISD::ADDE" , SDTIntBinOp,
331 [SDNPCommutative, SDNPOutGlue, SDNPInGlue]>;
332 def subc : SDNode<"ISD::SUBC" , SDTIntBinOp,
334 def sube : SDNode<"ISD::SUBE" , SDTIntBinOp,
335 [SDNPOutGlue, SDNPInGlue]>;
337 def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>;
338 def bswap : SDNode<"ISD::BSWAP" , SDTIntUnaryOp>;
339 def ctlz : SDNode<"ISD::CTLZ" , SDTIntUnaryOp>;
340 def cttz : SDNode<"ISD::CTTZ" , SDTIntUnaryOp>;
341 def ctpop : SDNode<"ISD::CTPOP" , SDTIntUnaryOp>;
342 def sext : SDNode<"ISD::SIGN_EXTEND", SDTIntExtendOp>;
343 def zext : SDNode<"ISD::ZERO_EXTEND", SDTIntExtendOp>;
344 def anyext : SDNode<"ISD::ANY_EXTEND" , SDTIntExtendOp>;
345 def trunc : SDNode<"ISD::TRUNCATE" , SDTIntTruncOp>;
346 def bitconvert : SDNode<"ISD::BITCAST" , SDTUnaryOp>;
347 def extractelt : SDNode<"ISD::EXTRACT_VECTOR_ELT", SDTVecExtract>;
348 def insertelt : SDNode<"ISD::INSERT_VECTOR_ELT", SDTVecInsert>;
351 def fadd : SDNode<"ISD::FADD" , SDTFPBinOp, [SDNPCommutative]>;
352 def fsub : SDNode<"ISD::FSUB" , SDTFPBinOp>;
353 def fmul : SDNode<"ISD::FMUL" , SDTFPBinOp, [SDNPCommutative]>;
354 def fdiv : SDNode<"ISD::FDIV" , SDTFPBinOp>;
355 def frem : SDNode<"ISD::FREM" , SDTFPBinOp>;
356 def fabs : SDNode<"ISD::FABS" , SDTFPUnaryOp>;
357 def fneg : SDNode<"ISD::FNEG" , SDTFPUnaryOp>;
358 def fsqrt : SDNode<"ISD::FSQRT" , SDTFPUnaryOp>;
359 def fsin : SDNode<"ISD::FSIN" , SDTFPUnaryOp>;
360 def fcos : SDNode<"ISD::FCOS" , SDTFPUnaryOp>;
361 def fexp2 : SDNode<"ISD::FEXP2" , SDTFPUnaryOp>;
362 def flog2 : SDNode<"ISD::FLOG2" , SDTFPUnaryOp>;
363 def frint : SDNode<"ISD::FRINT" , SDTFPUnaryOp>;
364 def ftrunc : SDNode<"ISD::FTRUNC" , SDTFPUnaryOp>;
365 def fceil : SDNode<"ISD::FCEIL" , SDTFPUnaryOp>;
366 def ffloor : SDNode<"ISD::FFLOOR" , SDTFPUnaryOp>;
367 def fnearbyint : SDNode<"ISD::FNEARBYINT" , SDTFPUnaryOp>;
369 def fround : SDNode<"ISD::FP_ROUND" , SDTFPRoundOp>;
370 def fextend : SDNode<"ISD::FP_EXTEND" , SDTFPExtendOp>;
371 def fcopysign : SDNode<"ISD::FCOPYSIGN" , SDTFPSignOp>;
373 def sint_to_fp : SDNode<"ISD::SINT_TO_FP" , SDTIntToFPOp>;
374 def uint_to_fp : SDNode<"ISD::UINT_TO_FP" , SDTIntToFPOp>;
375 def fp_to_sint : SDNode<"ISD::FP_TO_SINT" , SDTFPToIntOp>;
376 def fp_to_uint : SDNode<"ISD::FP_TO_UINT" , SDTFPToIntOp>;
377 def f16_to_f32 : SDNode<"ISD::FP16_TO_FP32", SDTIntToFPOp>;
378 def f32_to_f16 : SDNode<"ISD::FP32_TO_FP16", SDTFPToIntOp>;
380 def setcc : SDNode<"ISD::SETCC" , SDTSetCC>;
381 def select : SDNode<"ISD::SELECT" , SDTSelect>;
382 def selectcc : SDNode<"ISD::SELECT_CC" , SDTSelectCC>;
383 def vsetcc : SDNode<"ISD::VSETCC" , SDTSetCC>;
385 def brcond : SDNode<"ISD::BRCOND" , SDTBrcond, [SDNPHasChain]>;
386 def brind : SDNode<"ISD::BRIND" , SDTBrind, [SDNPHasChain]>;
387 def br : SDNode<"ISD::BR" , SDTBr, [SDNPHasChain]>;
388 def trap : SDNode<"ISD::TRAP" , SDTNone,
389 [SDNPHasChain, SDNPSideEffect]>;
391 def prefetch : SDNode<"ISD::PREFETCH" , SDTPrefetch,
392 [SDNPHasChain, SDNPMayLoad, SDNPMayStore,
395 def membarrier : SDNode<"ISD::MEMBARRIER" , SDTMemBarrier,
396 [SDNPHasChain, SDNPSideEffect]>;
398 def atomic_cmp_swap : SDNode<"ISD::ATOMIC_CMP_SWAP" , SDTAtomic3,
399 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
400 def atomic_load_add : SDNode<"ISD::ATOMIC_LOAD_ADD" , SDTAtomic2,
401 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
402 def atomic_swap : SDNode<"ISD::ATOMIC_SWAP", SDTAtomic2,
403 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
404 def atomic_load_sub : SDNode<"ISD::ATOMIC_LOAD_SUB" , SDTAtomic2,
405 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
406 def atomic_load_and : SDNode<"ISD::ATOMIC_LOAD_AND" , SDTAtomic2,
407 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
408 def atomic_load_or : SDNode<"ISD::ATOMIC_LOAD_OR" , SDTAtomic2,
409 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
410 def atomic_load_xor : SDNode<"ISD::ATOMIC_LOAD_XOR" , SDTAtomic2,
411 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
412 def atomic_load_nand: SDNode<"ISD::ATOMIC_LOAD_NAND", SDTAtomic2,
413 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
414 def atomic_load_min : SDNode<"ISD::ATOMIC_LOAD_MIN", SDTAtomic2,
415 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
416 def atomic_load_max : SDNode<"ISD::ATOMIC_LOAD_MAX", SDTAtomic2,
417 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
418 def atomic_load_umin : SDNode<"ISD::ATOMIC_LOAD_UMIN", SDTAtomic2,
419 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
420 def atomic_load_umax : SDNode<"ISD::ATOMIC_LOAD_UMAX", SDTAtomic2,
421 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
423 // Do not use ld, st directly. Use load, extload, sextload, zextload, store,
424 // and truncst (see below).
425 def ld : SDNode<"ISD::LOAD" , SDTLoad,
426 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
427 def st : SDNode<"ISD::STORE" , SDTStore,
428 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
429 def ist : SDNode<"ISD::STORE" , SDTIStore,
430 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
432 def vector_shuffle : SDNode<"ISD::VECTOR_SHUFFLE", SDTVecShuffle, []>;
433 def build_vector : SDNode<"ISD::BUILD_VECTOR", SDTypeProfile<1, -1, []>, []>;
434 def scalar_to_vector : SDNode<"ISD::SCALAR_TO_VECTOR", SDTypeProfile<1, 1, []>,
436 def vector_extract : SDNode<"ISD::EXTRACT_VECTOR_ELT",
437 SDTypeProfile<1, 2, [SDTCisPtrTy<2>]>, []>;
438 def vector_extract_subvec : SDNode<"ISD::EXTRACT_SUBVECTOR",
439 SDTypeProfile<1, 2, [SDTCisInt<2>, SDTCisVec<1>, SDTCisVec<0>]>,
441 def vector_insert : SDNode<"ISD::INSERT_VECTOR_ELT",
442 SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisPtrTy<3>]>, []>;
444 // Nodes for intrinsics, you should use the intrinsic itself and let tblgen use
445 // these internally. Don't reference these directly.
446 def intrinsic_void : SDNode<"ISD::INTRINSIC_VOID",
447 SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>,
449 def intrinsic_w_chain : SDNode<"ISD::INTRINSIC_W_CHAIN",
450 SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>,
452 def intrinsic_wo_chain : SDNode<"ISD::INTRINSIC_WO_CHAIN",
453 SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>, []>;
455 // Do not use cvt directly. Use cvt forms below
456 def cvt : SDNode<"ISD::CONVERT_RNDSAT", SDTConvertOp>;
458 //===----------------------------------------------------------------------===//
459 // Selection DAG Condition Codes
461 class CondCode; // ISD::CondCode enums
462 def SETOEQ : CondCode; def SETOGT : CondCode;
463 def SETOGE : CondCode; def SETOLT : CondCode; def SETOLE : CondCode;
464 def SETONE : CondCode; def SETO : CondCode; def SETUO : CondCode;
465 def SETUEQ : CondCode; def SETUGT : CondCode; def SETUGE : CondCode;
466 def SETULT : CondCode; def SETULE : CondCode; def SETUNE : CondCode;
468 def SETEQ : CondCode; def SETGT : CondCode; def SETGE : CondCode;
469 def SETLT : CondCode; def SETLE : CondCode; def SETNE : CondCode;
472 //===----------------------------------------------------------------------===//
473 // Selection DAG Node Transformation Functions.
475 // This mechanism allows targets to manipulate nodes in the output DAG once a
476 // match has been formed. This is typically used to manipulate immediate
479 class SDNodeXForm<SDNode opc, code xformFunction> {
481 code XFormFunction = xformFunction;
484 def NOOP_SDNodeXForm : SDNodeXForm<imm, [{}]>;
487 //===----------------------------------------------------------------------===//
488 // Selection DAG Pattern Fragments.
490 // Pattern fragments are reusable chunks of dags that match specific things.
491 // They can take arguments and have C++ predicates that control whether they
492 // match. They are intended to make the patterns for common instructions more
493 // compact and readable.
496 /// PatFrag - Represents a pattern fragment. This can match something on the
497 /// DAG, from a single node to multiple nested other fragments.
499 class PatFrag<dag ops, dag frag, code pred = [{}],
500 SDNodeXForm xform = NOOP_SDNodeXForm> : SDPatternOperator {
503 code Predicate = pred;
504 SDNodeXForm OperandTransform = xform;
507 // PatLeaf's are pattern fragments that have no operands. This is just a helper
508 // to define immediates and other common things concisely.
509 class PatLeaf<dag frag, code pred = [{}], SDNodeXForm xform = NOOP_SDNodeXForm>
510 : PatFrag<(ops), frag, pred, xform>;
514 def vtInt : PatLeaf<(vt), [{ return N->getVT().isInteger(); }]>;
515 def vtFP : PatLeaf<(vt), [{ return N->getVT().isFloatingPoint(); }]>;
517 def immAllOnesV: PatLeaf<(build_vector), [{
518 return ISD::isBuildVectorAllOnes(N);
520 def immAllZerosV: PatLeaf<(build_vector), [{
521 return ISD::isBuildVectorAllZeros(N);
526 // Other helper fragments.
527 def not : PatFrag<(ops node:$in), (xor node:$in, -1)>;
528 def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>;
529 def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>;
532 def unindexedload : PatFrag<(ops node:$ptr), (ld node:$ptr), [{
533 return cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
535 def load : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{
536 return cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
539 // extending load fragments.
540 def extload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{
541 return cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
543 def sextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{
544 return cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
546 def zextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{
547 return cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
550 def extloadi1 : PatFrag<(ops node:$ptr), (extload node:$ptr), [{
551 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i1;
553 def extloadi8 : PatFrag<(ops node:$ptr), (extload node:$ptr), [{
554 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8;
556 def extloadi16 : PatFrag<(ops node:$ptr), (extload node:$ptr), [{
557 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16;
559 def extloadi32 : PatFrag<(ops node:$ptr), (extload node:$ptr), [{
560 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i32;
562 def extloadf32 : PatFrag<(ops node:$ptr), (extload node:$ptr), [{
563 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::f32;
565 def extloadf64 : PatFrag<(ops node:$ptr), (extload node:$ptr), [{
566 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::f64;
569 def sextloadi1 : PatFrag<(ops node:$ptr), (sextload node:$ptr), [{
570 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i1;
572 def sextloadi8 : PatFrag<(ops node:$ptr), (sextload node:$ptr), [{
573 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8;
575 def sextloadi16 : PatFrag<(ops node:$ptr), (sextload node:$ptr), [{
576 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16;
578 def sextloadi32 : PatFrag<(ops node:$ptr), (sextload node:$ptr), [{
579 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i32;
582 def zextloadi1 : PatFrag<(ops node:$ptr), (zextload node:$ptr), [{
583 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i1;
585 def zextloadi8 : PatFrag<(ops node:$ptr), (zextload node:$ptr), [{
586 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8;
588 def zextloadi16 : PatFrag<(ops node:$ptr), (zextload node:$ptr), [{
589 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16;
591 def zextloadi32 : PatFrag<(ops node:$ptr), (zextload node:$ptr), [{
592 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i32;
596 def unindexedstore : PatFrag<(ops node:$val, node:$ptr),
597 (st node:$val, node:$ptr), [{
598 return cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
600 def store : PatFrag<(ops node:$val, node:$ptr),
601 (unindexedstore node:$val, node:$ptr), [{
602 return !cast<StoreSDNode>(N)->isTruncatingStore();
605 // truncstore fragments.
606 def truncstore : PatFrag<(ops node:$val, node:$ptr),
607 (unindexedstore node:$val, node:$ptr), [{
608 return cast<StoreSDNode>(N)->isTruncatingStore();
610 def truncstorei8 : PatFrag<(ops node:$val, node:$ptr),
611 (truncstore node:$val, node:$ptr), [{
612 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i8;
614 def truncstorei16 : PatFrag<(ops node:$val, node:$ptr),
615 (truncstore node:$val, node:$ptr), [{
616 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i16;
618 def truncstorei32 : PatFrag<(ops node:$val, node:$ptr),
619 (truncstore node:$val, node:$ptr), [{
620 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i32;
622 def truncstoref32 : PatFrag<(ops node:$val, node:$ptr),
623 (truncstore node:$val, node:$ptr), [{
624 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::f32;
626 def truncstoref64 : PatFrag<(ops node:$val, node:$ptr),
627 (truncstore node:$val, node:$ptr), [{
628 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::f64;
631 // indexed store fragments.
632 def istore : PatFrag<(ops node:$val, node:$base, node:$offset),
633 (ist node:$val, node:$base, node:$offset), [{
634 return !cast<StoreSDNode>(N)->isTruncatingStore();
637 def pre_store : PatFrag<(ops node:$val, node:$base, node:$offset),
638 (istore node:$val, node:$base, node:$offset), [{
639 ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
640 return AM == ISD::PRE_INC || AM == ISD::PRE_DEC;
643 def itruncstore : PatFrag<(ops node:$val, node:$base, node:$offset),
644 (ist node:$val, node:$base, node:$offset), [{
645 return cast<StoreSDNode>(N)->isTruncatingStore();
647 def pre_truncst : PatFrag<(ops node:$val, node:$base, node:$offset),
648 (itruncstore node:$val, node:$base, node:$offset), [{
649 ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
650 return AM == ISD::PRE_INC || AM == ISD::PRE_DEC;
652 def pre_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset),
653 (pre_truncst node:$val, node:$base, node:$offset), [{
654 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i1;
656 def pre_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset),
657 (pre_truncst node:$val, node:$base, node:$offset), [{
658 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i8;
660 def pre_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset),
661 (pre_truncst node:$val, node:$base, node:$offset), [{
662 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i16;
664 def pre_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset),
665 (pre_truncst node:$val, node:$base, node:$offset), [{
666 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i32;
668 def pre_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset),
669 (pre_truncst node:$val, node:$base, node:$offset), [{
670 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::f32;
673 def post_store : PatFrag<(ops node:$val, node:$ptr, node:$offset),
674 (istore node:$val, node:$ptr, node:$offset), [{
675 ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
676 return AM == ISD::POST_INC || AM == ISD::POST_DEC;
679 def post_truncst : PatFrag<(ops node:$val, node:$base, node:$offset),
680 (itruncstore node:$val, node:$base, node:$offset), [{
681 ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
682 return AM == ISD::POST_INC || AM == ISD::POST_DEC;
684 def post_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset),
685 (post_truncst node:$val, node:$base, node:$offset), [{
686 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i1;
688 def post_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset),
689 (post_truncst node:$val, node:$base, node:$offset), [{
690 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i8;
692 def post_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset),
693 (post_truncst node:$val, node:$base, node:$offset), [{
694 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i16;
696 def post_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset),
697 (post_truncst node:$val, node:$base, node:$offset), [{
698 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i32;
700 def post_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset),
701 (post_truncst node:$val, node:$base, node:$offset), [{
702 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::f32;
705 // setcc convenience fragments.
706 def setoeq : PatFrag<(ops node:$lhs, node:$rhs),
707 (setcc node:$lhs, node:$rhs, SETOEQ)>;
708 def setogt : PatFrag<(ops node:$lhs, node:$rhs),
709 (setcc node:$lhs, node:$rhs, SETOGT)>;
710 def setoge : PatFrag<(ops node:$lhs, node:$rhs),
711 (setcc node:$lhs, node:$rhs, SETOGE)>;
712 def setolt : PatFrag<(ops node:$lhs, node:$rhs),
713 (setcc node:$lhs, node:$rhs, SETOLT)>;
714 def setole : PatFrag<(ops node:$lhs, node:$rhs),
715 (setcc node:$lhs, node:$rhs, SETOLE)>;
716 def setone : PatFrag<(ops node:$lhs, node:$rhs),
717 (setcc node:$lhs, node:$rhs, SETONE)>;
718 def seto : PatFrag<(ops node:$lhs, node:$rhs),
719 (setcc node:$lhs, node:$rhs, SETO)>;
720 def setuo : PatFrag<(ops node:$lhs, node:$rhs),
721 (setcc node:$lhs, node:$rhs, SETUO)>;
722 def setueq : PatFrag<(ops node:$lhs, node:$rhs),
723 (setcc node:$lhs, node:$rhs, SETUEQ)>;
724 def setugt : PatFrag<(ops node:$lhs, node:$rhs),
725 (setcc node:$lhs, node:$rhs, SETUGT)>;
726 def setuge : PatFrag<(ops node:$lhs, node:$rhs),
727 (setcc node:$lhs, node:$rhs, SETUGE)>;
728 def setult : PatFrag<(ops node:$lhs, node:$rhs),
729 (setcc node:$lhs, node:$rhs, SETULT)>;
730 def setule : PatFrag<(ops node:$lhs, node:$rhs),
731 (setcc node:$lhs, node:$rhs, SETULE)>;
732 def setune : PatFrag<(ops node:$lhs, node:$rhs),
733 (setcc node:$lhs, node:$rhs, SETUNE)>;
734 def seteq : PatFrag<(ops node:$lhs, node:$rhs),
735 (setcc node:$lhs, node:$rhs, SETEQ)>;
736 def setgt : PatFrag<(ops node:$lhs, node:$rhs),
737 (setcc node:$lhs, node:$rhs, SETGT)>;
738 def setge : PatFrag<(ops node:$lhs, node:$rhs),
739 (setcc node:$lhs, node:$rhs, SETGE)>;
740 def setlt : PatFrag<(ops node:$lhs, node:$rhs),
741 (setcc node:$lhs, node:$rhs, SETLT)>;
742 def setle : PatFrag<(ops node:$lhs, node:$rhs),
743 (setcc node:$lhs, node:$rhs, SETLE)>;
744 def setne : PatFrag<(ops node:$lhs, node:$rhs),
745 (setcc node:$lhs, node:$rhs, SETNE)>;
747 def atomic_cmp_swap_8 :
748 PatFrag<(ops node:$ptr, node:$cmp, node:$swap),
749 (atomic_cmp_swap node:$ptr, node:$cmp, node:$swap), [{
750 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i8;
752 def atomic_cmp_swap_16 :
753 PatFrag<(ops node:$ptr, node:$cmp, node:$swap),
754 (atomic_cmp_swap node:$ptr, node:$cmp, node:$swap), [{
755 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i16;
757 def atomic_cmp_swap_32 :
758 PatFrag<(ops node:$ptr, node:$cmp, node:$swap),
759 (atomic_cmp_swap node:$ptr, node:$cmp, node:$swap), [{
760 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i32;
762 def atomic_cmp_swap_64 :
763 PatFrag<(ops node:$ptr, node:$cmp, node:$swap),
764 (atomic_cmp_swap node:$ptr, node:$cmp, node:$swap), [{
765 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i64;
768 multiclass binary_atomic_op<SDNode atomic_op> {
769 def _8 : PatFrag<(ops node:$ptr, node:$val),
770 (atomic_op node:$ptr, node:$val), [{
771 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i8;
773 def _16 : PatFrag<(ops node:$ptr, node:$val),
774 (atomic_op node:$ptr, node:$val), [{
775 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i16;
777 def _32 : PatFrag<(ops node:$ptr, node:$val),
778 (atomic_op node:$ptr, node:$val), [{
779 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i32;
781 def _64 : PatFrag<(ops node:$ptr, node:$val),
782 (atomic_op node:$ptr, node:$val), [{
783 return cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i64;
787 defm atomic_load_add : binary_atomic_op<atomic_load_add>;
788 defm atomic_swap : binary_atomic_op<atomic_swap>;
789 defm atomic_load_sub : binary_atomic_op<atomic_load_sub>;
790 defm atomic_load_and : binary_atomic_op<atomic_load_and>;
791 defm atomic_load_or : binary_atomic_op<atomic_load_or>;
792 defm atomic_load_xor : binary_atomic_op<atomic_load_xor>;
793 defm atomic_load_nand : binary_atomic_op<atomic_load_nand>;
794 defm atomic_load_min : binary_atomic_op<atomic_load_min>;
795 defm atomic_load_max : binary_atomic_op<atomic_load_max>;
796 defm atomic_load_umin : binary_atomic_op<atomic_load_umin>;
797 defm atomic_load_umax : binary_atomic_op<atomic_load_umax>;
799 //===----------------------------------------------------------------------===//
800 // Selection DAG CONVERT_RNDSAT patterns
802 def cvtff : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
803 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
804 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_FF;
807 def cvtss : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
808 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
809 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_SS;
812 def cvtsu : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
813 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
814 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_SU;
817 def cvtus : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
818 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
819 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_US;
822 def cvtuu : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
823 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
824 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_UU;
827 def cvtsf : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
828 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
829 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_SF;
832 def cvtuf : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
833 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
834 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_UF;
837 def cvtfs : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
838 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
839 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_FS;
842 def cvtfu : PatFrag<(ops node:$val, node:$dty, node:$sty, node:$rd, node:$sat),
843 (cvt node:$val, node:$dty, node:$sty, node:$rd, node:$sat), [{
844 return cast<CvtRndSatSDNode>(N)->getCvtCode() == ISD::CVT_FU;
847 //===----------------------------------------------------------------------===//
848 // Selection DAG Pattern Support.
850 // Patterns are what are actually matched against by the target-flavored
851 // instruction selection DAG. Instructions defined by the target implicitly
852 // define patterns in most cases, but patterns can also be explicitly added when
853 // an operation is defined by a sequence of instructions (e.g. loading a large
854 // immediate value on RISC targets that do not support immediates as large as
858 class Pattern<dag patternToMatch, list<dag> resultInstrs> {
859 dag PatternToMatch = patternToMatch;
860 list<dag> ResultInstrs = resultInstrs;
861 list<Predicate> Predicates = []; // See class Instruction in Target.td.
862 int AddedComplexity = 0; // See class Instruction in Target.td.
865 // Pat - A simple (but common) form of a pattern, which produces a simple result
866 // not needing a full list.
867 class Pat<dag pattern, dag result> : Pattern<pattern, [result]>;
869 //===----------------------------------------------------------------------===//
870 // Complex pattern definitions.
873 // Complex patterns, e.g. X86 addressing mode, requires pattern matching code
874 // in C++. NumOperands is the number of operands returned by the select function;
875 // SelectFunc is the name of the function used to pattern match the max. pattern;
876 // RootNodes are the list of possible root nodes of the sub-dags to match.
877 // e.g. X86 addressing mode - def addr : ComplexPattern<4, "SelectAddr", [add]>;
879 class ComplexPattern<ValueType ty, int numops, string fn,
880 list<SDNode> roots = [], list<SDNodeProperty> props = []> {
882 int NumOperands = numops;
883 string SelectFunc = fn;
884 list<SDNode> RootNodes = roots;
885 list<SDNodeProperty> Properties = props;