LLVM  16.0.0git
MIPatternMatch.h
Go to the documentation of this file.
1 //==------ llvm/CodeGen/GlobalISel/MIPatternMatch.h -------------*- C++ -*-===//
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 /// \file
9 /// Contains matchers for matching SSA Machine Instructions.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CODEGEN_GLOBALISEL_MIPATTERNMATCH_H
14 #define LLVM_CODEGEN_GLOBALISEL_MIPATTERNMATCH_H
15 
16 #include "llvm/ADT/APInt.h"
19 #include "llvm/IR/InstrTypes.h"
20 
21 namespace llvm {
22 namespace MIPatternMatch {
23 
24 template <typename Reg, typename Pattern>
25 [[nodiscard]] bool mi_match(Reg R, const MachineRegisterInfo &MRI,
26  Pattern &&P) {
27  return P.match(MRI, R);
28 }
29 
30 template <typename Pattern>
31 [[nodiscard]] bool mi_match(MachineInstr &MI, const MachineRegisterInfo &MRI,
32  Pattern &&P) {
33  return P.match(MRI, &MI);
34 }
35 
36 // TODO: Extend for N use.
37 template <typename SubPatternT> struct OneUse_match {
38  SubPatternT SubPat;
39  OneUse_match(const SubPatternT &SP) : SubPat(SP) {}
40 
42  return MRI.hasOneUse(Reg) && SubPat.match(MRI, Reg);
43  }
44 };
45 
46 template <typename SubPat>
47 inline OneUse_match<SubPat> m_OneUse(const SubPat &SP) {
48  return SP;
49 }
50 
51 template <typename SubPatternT> struct OneNonDBGUse_match {
52  SubPatternT SubPat;
53  OneNonDBGUse_match(const SubPatternT &SP) : SubPat(SP) {}
54 
56  return MRI.hasOneNonDBGUse(Reg) && SubPat.match(MRI, Reg);
57  }
58 };
59 
60 template <typename SubPat>
61 inline OneNonDBGUse_match<SubPat> m_OneNonDBGUse(const SubPat &SP) {
62  return SP;
63 }
64 
65 template <typename ConstT>
67 
68 template <>
70  const MachineRegisterInfo &MRI) {
71  return getIConstantVRegVal(Reg, MRI);
72 }
73 
74 template <>
76  const MachineRegisterInfo &MRI) {
78 }
79 
80 template <typename ConstT> struct ConstantMatch {
81  ConstT &CR;
82  ConstantMatch(ConstT &C) : CR(C) {}
84  if (auto MaybeCst = matchConstant<ConstT>(Reg, MRI)) {
85  CR = *MaybeCst;
86  return true;
87  }
88  return false;
89  }
90 };
91 
93  return ConstantMatch<APInt>(Cst);
94 }
95 inline ConstantMatch<int64_t> m_ICst(int64_t &Cst) {
96  return ConstantMatch<int64_t>(Cst);
97 }
98 
99 template <typename ConstT>
101  const MachineRegisterInfo &);
102 
103 template <>
105  const MachineRegisterInfo &MRI) {
106  return getIConstantSplatVal(Reg, MRI);
107 }
108 
109 template <>
111  const MachineRegisterInfo &MRI) {
113 }
114 
115 template <typename ConstT> struct ICstOrSplatMatch {
116  ConstT &CR;
117  ICstOrSplatMatch(ConstT &C) : CR(C) {}
119  if (auto MaybeCst = matchConstant<ConstT>(Reg, MRI)) {
120  CR = *MaybeCst;
121  return true;
122  }
123 
124  if (auto MaybeCstSplat = matchConstantSplat<ConstT>(Reg, MRI)) {
125  CR = *MaybeCstSplat;
126  return true;
127  }
128 
129  return false;
130  };
131 };
132 
134  return ICstOrSplatMatch<APInt>(Cst);
135 }
136 
138  return ICstOrSplatMatch<int64_t>(Cst);
139 }
140 
146  return ValReg ? true : false;
147  }
148 };
149 
151  return GCstAndRegMatch(ValReg);
152 }
153 
159  return FPValReg ? true : false;
160  }
161 };
162 
164  return GFCstAndRegMatch(FPValReg);
165 }
166 
170  : FPValReg(FPValReg) {}
172  return (FPValReg = getFConstantSplat(Reg, MRI)) ||
174  };
175 };
176 
177 inline GFCstOrSplatGFCstMatch
179  return GFCstOrSplatGFCstMatch(FPValReg);
180 }
181 
182 /// Matcher for a specific constant value.
184  int64_t RequestedVal;
187  int64_t MatchedVal;
188  return mi_match(Reg, MRI, m_ICst(MatchedVal)) && MatchedVal == RequestedVal;
189  }
190 };
191 
192 /// Matches a constant equal to \p RequestedValue.
193 inline SpecificConstantMatch m_SpecificICst(int64_t RequestedValue) {
194  return SpecificConstantMatch(RequestedValue);
195 }
196 
197 /// Matcher for a specific constant splat.
199  int64_t RequestedVal;
204  /* AllowUndef */ false);
205  }
206 };
207 
208 /// Matches a constant splat of \p RequestedValue.
209 inline SpecificConstantSplatMatch m_SpecificICstSplat(int64_t RequestedValue) {
210  return SpecificConstantSplatMatch(RequestedValue);
211 }
212 
213 /// Matcher for a specific constant or constant splat.
215  int64_t RequestedVal;
219  int64_t MatchedVal;
220  if (mi_match(Reg, MRI, m_ICst(MatchedVal)) && MatchedVal == RequestedVal)
221  return true;
223  /* AllowUndef */ false);
224  }
225 };
226 
227 /// Matches a \p RequestedValue constant or a constant splat of \p
228 /// RequestedValue.
229 inline SpecificConstantOrSplatMatch
230 m_SpecificICstOrSplat(int64_t RequestedValue) {
231  return SpecificConstantOrSplatMatch(RequestedValue);
232 }
233 
234 ///{
235 /// Convenience matchers for specific integer values.
238  return SpecificConstantMatch(-1);
239 }
240 ///}
241 
242 /// Matcher for a specific register.
247  return Reg == RequestedReg;
248  }
249 };
250 
251 /// Matches a register only if it is equal to \p RequestedReg.
253  return SpecificRegisterMatch(RequestedReg);
254 }
255 
256 // TODO: Rework this for different kinds of MachineOperand.
257 // Currently assumes the Src for a match is a register.
258 // We might want to support taking in some MachineOperands and call getReg on
259 // that.
260 
262  bool match(const MachineRegisterInfo &MRI, Register Reg) { return true; }
264  return MO->isReg();
265  }
266 };
267 
269 
270 /// Matching combinators.
271 template <typename... Preds> struct And {
272  template <typename MatchSrc>
273  bool match(const MachineRegisterInfo &MRI, MatchSrc &&src) {
274  return true;
275  }
276 };
277 
278 template <typename Pred, typename... Preds>
279 struct And<Pred, Preds...> : And<Preds...> {
280  Pred P;
281  And(Pred &&p, Preds &&... preds)
282  : And<Preds...>(std::forward<Preds>(preds)...), P(std::forward<Pred>(p)) {
283  }
284  template <typename MatchSrc>
285  bool match(const MachineRegisterInfo &MRI, MatchSrc &&src) {
286  return P.match(MRI, src) && And<Preds...>::match(MRI, src);
287  }
288 };
289 
290 template <typename... Preds> struct Or {
291  template <typename MatchSrc>
292  bool match(const MachineRegisterInfo &MRI, MatchSrc &&src) {
293  return false;
294  }
295 };
296 
297 template <typename Pred, typename... Preds>
298 struct Or<Pred, Preds...> : Or<Preds...> {
299  Pred P;
300  Or(Pred &&p, Preds &&... preds)
301  : Or<Preds...>(std::forward<Preds>(preds)...), P(std::forward<Pred>(p)) {}
302  template <typename MatchSrc>
303  bool match(const MachineRegisterInfo &MRI, MatchSrc &&src) {
304  return P.match(MRI, src) || Or<Preds...>::match(MRI, src);
305  }
306 };
307 
308 template <typename... Preds> And<Preds...> m_all_of(Preds &&... preds) {
309  return And<Preds...>(std::forward<Preds>(preds)...);
310 }
311 
312 template <typename... Preds> Or<Preds...> m_any_of(Preds &&... preds) {
313  return Or<Preds...>(std::forward<Preds>(preds)...);
314 }
315 
316 template <typename BindTy> struct bind_helper {
317  static bool bind(const MachineRegisterInfo &MRI, BindTy &VR, BindTy &V) {
318  VR = V;
319  return true;
320  }
321 };
322 
323 template <> struct bind_helper<MachineInstr *> {
324  static bool bind(const MachineRegisterInfo &MRI, MachineInstr *&MI,
325  Register Reg) {
326  MI = MRI.getVRegDef(Reg);
327  if (MI)
328  return true;
329  return false;
330  }
331  static bool bind(const MachineRegisterInfo &MRI, MachineInstr *&MI,
332  MachineInstr *Inst) {
333  MI = Inst;
334  return MI;
335  }
336 };
337 
338 template <> struct bind_helper<LLT> {
339  static bool bind(const MachineRegisterInfo &MRI, LLT Ty, Register Reg) {
340  Ty = MRI.getType(Reg);
341  if (Ty.isValid())
342  return true;
343  return false;
344  }
345 };
346 
347 template <> struct bind_helper<const ConstantFP *> {
348  static bool bind(const MachineRegisterInfo &MRI, const ConstantFP *&F,
349  Register Reg) {
351  if (F)
352  return true;
353  return false;
354  }
355 };
356 
357 template <typename Class> struct bind_ty {
358  Class &VR;
359 
360  bind_ty(Class &V) : VR(V) {}
361 
362  template <typename ITy> bool match(const MachineRegisterInfo &MRI, ITy &&V) {
363  return bind_helper<Class>::bind(MRI, VR, V);
364  }
365 };
366 
367 inline bind_ty<Register> m_Reg(Register &R) { return R; }
369 inline bind_ty<LLT> m_Type(LLT Ty) { return Ty; }
372 
375  MachineInstr *TmpMI;
376  if (mi_match(Reg, MRI, m_MInstr(TmpMI)))
377  return TmpMI->getOpcode() == TargetOpcode::G_IMPLICIT_DEF;
378  return false;
379  }
380 };
381 
383 
384 // Helper for matching G_FCONSTANT
385 inline bind_ty<const ConstantFP *> m_GFCst(const ConstantFP *&C) { return C; }
386 
387 // General helper for all the binary generic MI such as G_ADD/G_SUB etc
388 template <typename LHS_P, typename RHS_P, unsigned Opcode,
389  bool Commutable = false>
391  LHS_P L;
392  RHS_P R;
393 
394  BinaryOp_match(const LHS_P &LHS, const RHS_P &RHS) : L(LHS), R(RHS) {}
395  template <typename OpTy>
396  bool match(const MachineRegisterInfo &MRI, OpTy &&Op) {
397  MachineInstr *TmpMI;
398  if (mi_match(Op, MRI, m_MInstr(TmpMI))) {
399  if (TmpMI->getOpcode() == Opcode && TmpMI->getNumOperands() == 3) {
400  return (L.match(MRI, TmpMI->getOperand(1).getReg()) &&
401  R.match(MRI, TmpMI->getOperand(2).getReg())) ||
402  (Commutable && (R.match(MRI, TmpMI->getOperand(1).getReg()) &&
403  L.match(MRI, TmpMI->getOperand(2).getReg())));
404  }
405  }
406  return false;
407  }
408 };
409 
410 // Helper for (commutative) binary generic MI that checks Opcode.
411 template <typename LHS_P, typename RHS_P, bool Commutable = false>
413  unsigned Opc;
414  LHS_P L;
415  RHS_P R;
416 
417  BinaryOpc_match(unsigned Opcode, const LHS_P &LHS, const RHS_P &RHS)
418  : Opc(Opcode), L(LHS), R(RHS) {}
419  template <typename OpTy>
420  bool match(const MachineRegisterInfo &MRI, OpTy &&Op) {
421  MachineInstr *TmpMI;
422  if (mi_match(Op, MRI, m_MInstr(TmpMI))) {
423  if (TmpMI->getOpcode() == Opc && TmpMI->getNumDefs() == 1 &&
424  TmpMI->getNumOperands() == 3) {
425  return (L.match(MRI, TmpMI->getOperand(1).getReg()) &&
426  R.match(MRI, TmpMI->getOperand(2).getReg())) ||
427  (Commutable && (R.match(MRI, TmpMI->getOperand(1).getReg()) &&
428  L.match(MRI, TmpMI->getOperand(2).getReg())));
429  }
430  }
431  return false;
432  }
433 };
434 
435 template <typename LHS, typename RHS>
436 inline BinaryOpc_match<LHS, RHS, false> m_BinOp(unsigned Opcode, const LHS &L,
437  const RHS &R) {
438  return BinaryOpc_match<LHS, RHS, false>(Opcode, L, R);
439 }
440 
441 template <typename LHS, typename RHS>
442 inline BinaryOpc_match<LHS, RHS, true>
443 m_CommutativeBinOp(unsigned Opcode, const LHS &L, const RHS &R) {
444  return BinaryOpc_match<LHS, RHS, true>(Opcode, L, R);
445 }
446 
447 template <typename LHS, typename RHS>
449 m_GAdd(const LHS &L, const RHS &R) {
451 }
452 
453 template <typename LHS, typename RHS>
455 m_GBuildVector(const LHS &L, const RHS &R) {
457 }
458 
459 template <typename LHS, typename RHS>
461 m_GBuildVectorTrunc(const LHS &L, const RHS &R) {
463  R);
464 }
465 
466 template <typename LHS, typename RHS>
468 m_GPtrAdd(const LHS &L, const RHS &R) {
470 }
471 
472 template <typename LHS, typename RHS>
474  const RHS &R) {
476 }
477 
478 template <typename LHS, typename RHS>
480 m_GMul(const LHS &L, const RHS &R) {
482 }
483 
484 template <typename LHS, typename RHS>
486 m_GFAdd(const LHS &L, const RHS &R) {
488 }
489 
490 template <typename LHS, typename RHS>
492 m_GFMul(const LHS &L, const RHS &R) {
494 }
495 
496 template <typename LHS, typename RHS>
498 m_GFSub(const LHS &L, const RHS &R) {
500 }
501 
502 template <typename LHS, typename RHS>
504 m_GAnd(const LHS &L, const RHS &R) {
506 }
507 
508 template <typename LHS, typename RHS>
510 m_GXor(const LHS &L, const RHS &R) {
512 }
513 
514 template <typename LHS, typename RHS>
516  const RHS &R) {
518 }
519 
520 template <typename LHS, typename RHS>
522 m_GShl(const LHS &L, const RHS &R) {
524 }
525 
526 template <typename LHS, typename RHS>
528 m_GLShr(const LHS &L, const RHS &R) {
530 }
531 
532 template <typename LHS, typename RHS>
534 m_GAShr(const LHS &L, const RHS &R) {
536 }
537 
538 template <typename LHS, typename RHS>
540 m_GSMax(const LHS &L, const RHS &R) {
542 }
543 
544 template <typename LHS, typename RHS>
546 m_GSMin(const LHS &L, const RHS &R) {
548 }
549 
550 // Helper for unary instructions (G_[ZSA]EXT/G_TRUNC) etc
551 template <typename SrcTy, unsigned Opcode> struct UnaryOp_match {
552  SrcTy L;
553 
554  UnaryOp_match(const SrcTy &LHS) : L(LHS) {}
555  template <typename OpTy>
556  bool match(const MachineRegisterInfo &MRI, OpTy &&Op) {
557  MachineInstr *TmpMI;
558  if (mi_match(Op, MRI, m_MInstr(TmpMI))) {
559  if (TmpMI->getOpcode() == Opcode && TmpMI->getNumOperands() == 2) {
560  return L.match(MRI, TmpMI->getOperand(1).getReg());
561  }
562  }
563  return false;
564  }
565 };
566 
567 template <typename SrcTy>
568 inline UnaryOp_match<SrcTy, TargetOpcode::G_ANYEXT>
569 m_GAnyExt(const SrcTy &Src) {
571 }
572 
573 template <typename SrcTy>
576 }
577 
578 template <typename SrcTy>
581 }
582 
583 template <typename SrcTy>
586 }
587 
588 template <typename SrcTy>
591 }
592 
593 template <typename SrcTy>
594 inline UnaryOp_match<SrcTy, TargetOpcode::G_BITCAST>
595 m_GBitcast(const SrcTy &Src) {
597 }
598 
599 template <typename SrcTy>
600 inline UnaryOp_match<SrcTy, TargetOpcode::G_PTRTOINT>
601 m_GPtrToInt(const SrcTy &Src) {
603 }
604 
605 template <typename SrcTy>
606 inline UnaryOp_match<SrcTy, TargetOpcode::G_INTTOPTR>
607 m_GIntToPtr(const SrcTy &Src) {
609 }
610 
611 template <typename SrcTy>
612 inline UnaryOp_match<SrcTy, TargetOpcode::G_FPTRUNC>
613 m_GFPTrunc(const SrcTy &Src) {
615 }
616 
617 template <typename SrcTy>
620 }
621 
622 template <typename SrcTy>
625 }
626 
627 template <typename SrcTy>
629  return UnaryOp_match<SrcTy, TargetOpcode::COPY>(std::forward<SrcTy>(Src));
630 }
631 
632 template <typename SrcTy>
635 }
636 
637 // General helper for generic MI compares, i.e. G_ICMP and G_FCMP
638 // TODO: Allow checking a specific predicate.
639 template <typename Pred_P, typename LHS_P, typename RHS_P, unsigned Opcode,
640  bool Commutable = false>
642  Pred_P P;
643  LHS_P L;
644  RHS_P R;
645 
646  CompareOp_match(const Pred_P &Pred, const LHS_P &LHS, const RHS_P &RHS)
647  : P(Pred), L(LHS), R(RHS) {}
648 
649  template <typename OpTy>
650  bool match(const MachineRegisterInfo &MRI, OpTy &&Op) {
651  MachineInstr *TmpMI;
652  if (!mi_match(Op, MRI, m_MInstr(TmpMI)) || TmpMI->getOpcode() != Opcode)
653  return false;
654 
655  auto TmpPred =
656  static_cast<CmpInst::Predicate>(TmpMI->getOperand(1).getPredicate());
657  if (!P.match(MRI, TmpPred))
658  return false;
659  Register LHS = TmpMI->getOperand(2).getReg();
660  Register RHS = TmpMI->getOperand(3).getReg();
661  if (L.match(MRI, LHS) && R.match(MRI, RHS))
662  return true;
663  if (Commutable && L.match(MRI, RHS) && R.match(MRI, LHS) &&
664  P.match(MRI, CmpInst::getSwappedPredicate(TmpPred)))
665  return true;
666  return false;
667  }
668 };
669 
670 template <typename Pred, typename LHS, typename RHS>
671 inline CompareOp_match<Pred, LHS, RHS, TargetOpcode::G_ICMP>
672 m_GICmp(const Pred &P, const LHS &L, const RHS &R) {
674 }
675 
676 template <typename Pred, typename LHS, typename RHS>
677 inline CompareOp_match<Pred, LHS, RHS, TargetOpcode::G_FCMP>
678 m_GFCmp(const Pred &P, const LHS &L, const RHS &R) {
680 }
681 
682 /// G_ICMP matcher that also matches commuted compares.
683 /// E.g.
684 ///
685 /// m_c_GICmp(m_Pred(...), m_GAdd(...), m_GSub(...))
686 ///
687 /// Could match both of:
688 ///
689 /// icmp ugt (add x, y) (sub a, b)
690 /// icmp ult (sub a, b) (add x, y)
691 template <typename Pred, typename LHS, typename RHS>
692 inline CompareOp_match<Pred, LHS, RHS, TargetOpcode::G_ICMP, true>
693 m_c_GICmp(const Pred &P, const LHS &L, const RHS &R) {
695 }
696 
697 /// G_FCMP matcher that also matches commuted compares.
698 /// E.g.
699 ///
700 /// m_c_GFCmp(m_Pred(...), m_FAdd(...), m_GFMul(...))
701 ///
702 /// Could match both of:
703 ///
704 /// fcmp ogt (fadd x, y) (fmul a, b)
705 /// fcmp olt (fmul a, b) (fadd x, y)
706 template <typename Pred, typename LHS, typename RHS>
707 inline CompareOp_match<Pred, LHS, RHS, TargetOpcode::G_FCMP, true>
708 m_c_GFCmp(const Pred &P, const LHS &L, const RHS &R) {
710 }
711 
712 // Helper for checking if a Reg is of specific type.
713 struct CheckType {
715  CheckType(const LLT Ty) : Ty(Ty) {}
716 
718  return MRI.getType(Reg) == Ty;
719  }
720 };
721 
722 inline CheckType m_SpecificType(LLT Ty) { return Ty; }
723 
724 template <typename Src0Ty, typename Src1Ty, typename Src2Ty, unsigned Opcode>
726  Src0Ty Src0;
727  Src1Ty Src1;
728  Src2Ty Src2;
729 
730  TernaryOp_match(const Src0Ty &Src0, const Src1Ty &Src1, const Src2Ty &Src2)
731  : Src0(Src0), Src1(Src1), Src2(Src2) {}
732  template <typename OpTy>
733  bool match(const MachineRegisterInfo &MRI, OpTy &&Op) {
734  MachineInstr *TmpMI;
735  if (mi_match(Op, MRI, m_MInstr(TmpMI))) {
736  if (TmpMI->getOpcode() == Opcode && TmpMI->getNumOperands() == 4) {
737  return (Src0.match(MRI, TmpMI->getOperand(1).getReg()) &&
738  Src1.match(MRI, TmpMI->getOperand(2).getReg()) &&
739  Src2.match(MRI, TmpMI->getOperand(3).getReg()));
740  }
741  }
742  return false;
743  }
744 };
745 template <typename Src0Ty, typename Src1Ty, typename Src2Ty>
746 inline TernaryOp_match<Src0Ty, Src1Ty, Src2Ty,
747  TargetOpcode::G_INSERT_VECTOR_ELT>
748 m_GInsertVecElt(const Src0Ty &Src0, const Src1Ty &Src1, const Src2Ty &Src2) {
749  return TernaryOp_match<Src0Ty, Src1Ty, Src2Ty,
750  TargetOpcode::G_INSERT_VECTOR_ELT>(Src0, Src1, Src2);
751 }
752 
753 template <typename Src0Ty, typename Src1Ty, typename Src2Ty>
754 inline TernaryOp_match<Src0Ty, Src1Ty, Src2Ty, TargetOpcode::G_SELECT>
755 m_GISelect(const Src0Ty &Src0, const Src1Ty &Src1, const Src2Ty &Src2) {
757  Src0, Src1, Src2);
758 }
759 
760 /// Matches a register negated by a G_SUB.
761 /// G_SUB 0, %negated_reg
762 template <typename SrcTy>
764 m_Neg(const SrcTy &&Src) {
765  return m_GSub(m_ZeroInt(), Src);
766 }
767 
768 /// Matches a register not-ed by a G_XOR.
769 /// G_XOR %not_reg, -1
770 template <typename SrcTy>
772 m_Not(const SrcTy &&Src) {
773  return m_GXor(Src, m_AllOnesInt());
774 }
775 
776 } // namespace MIPatternMatch
777 } // namespace llvm
778 
779 #endif
llvm::MIPatternMatch::CompareOp_match::L
LHS_P L
Definition: MIPatternMatch.h:643
llvm::MIPatternMatch::m_ICstOrSplat
ICstOrSplatMatch< APInt > m_ICstOrSplat(APInt &Cst)
Definition: MIPatternMatch.h:133
llvm::MIPatternMatch::CheckType
Definition: MIPatternMatch.h:713
llvm::getIConstantVRegSExtVal
Optional< int64_t > getIConstantVRegSExtVal(Register VReg, const MachineRegisterInfo &MRI)
If VReg is defined by a G_CONSTANT fits in int64_t returns it.
Definition: Utils.cpp:301
llvm::MIPatternMatch::operand_type_match::match
bool match(const MachineRegisterInfo &MRI, MachineOperand *MO)
Definition: MIPatternMatch.h:263
llvm::MIPatternMatch::TernaryOp_match::match
bool match(const MachineRegisterInfo &MRI, OpTy &&Op)
Definition: MIPatternMatch.h:733
llvm::MIPatternMatch::m_GBuildVector
BinaryOp_match< LHS, RHS, TargetOpcode::G_BUILD_VECTOR, false > m_GBuildVector(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:455
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
llvm::CmpInst::getSwappedPredicate
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
Definition: InstrTypes.h:850
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::PatternMatch::BinaryOp_match
Definition: PatternMatch.h:952
llvm::MIPatternMatch::bind_helper< LLT >::bind
static bool bind(const MachineRegisterInfo &MRI, LLT Ty, Register Reg)
Definition: MIPatternMatch.h:339
llvm::MIPatternMatch::m_SpecificICstSplat
SpecificConstantSplatMatch m_SpecificICstSplat(int64_t RequestedValue)
Matches a constant splat of RequestedValue.
Definition: MIPatternMatch.h:209
llvm::MIPatternMatch::UnaryOp_match::UnaryOp_match
UnaryOp_match(const SrcTy &LHS)
Definition: MIPatternMatch.h:554
llvm::MIPatternMatch::GFCstAndRegMatch::FPValReg
Optional< FPValueAndVReg > & FPValReg
Definition: MIPatternMatch.h:155
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:720
llvm::MIPatternMatch::m_GFPExt
UnaryOp_match< SrcTy, TargetOpcode::G_FPEXT > m_GFPExt(const SrcTy &Src)
Definition: MIPatternMatch.h:584
llvm::MIPatternMatch::m_GFNeg
UnaryOp_match< SrcTy, TargetOpcode::G_FNEG > m_GFNeg(const SrcTy &Src)
Definition: MIPatternMatch.h:623
llvm::MIPatternMatch::m_Reg
operand_type_match m_Reg()
Definition: MIPatternMatch.h:268
llvm::MIPatternMatch::m_GAnd
BinaryOp_match< LHS, RHS, TargetOpcode::G_AND, true > m_GAnd(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:504
llvm::MIPatternMatch::m_GShl
BinaryOp_match< LHS, RHS, TargetOpcode::G_SHL, false > m_GShl(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:522
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:50
llvm::MIPatternMatch::SpecificConstantSplatMatch::RequestedVal
int64_t RequestedVal
Definition: MIPatternMatch.h:199
llvm::MIPatternMatch::Or< Pred, Preds... >::P
Pred P
Definition: MIPatternMatch.h:299
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::MIPatternMatch::m_GLShr
BinaryOp_match< LHS, RHS, TargetOpcode::G_LSHR, false > m_GLShr(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:528
llvm::MIPatternMatch::SpecificRegisterMatch::RequestedReg
Register RequestedReg
Definition: MIPatternMatch.h:244
llvm::MIPatternMatch::BinaryOpc_match::Opc
unsigned Opc
Definition: MIPatternMatch.h:413
llvm::MIPatternMatch::UnaryOp_match::L
SrcTy L
Definition: MIPatternMatch.h:552
llvm::MCID::Commutable
@ Commutable
Definition: MCInstrDesc.h:173
llvm::MIPatternMatch::m_OneNonDBGUse
OneNonDBGUse_match< SubPat > m_OneNonDBGUse(const SubPat &SP)
Definition: MIPatternMatch.h:61
llvm::MIPatternMatch::GCstAndRegMatch::GCstAndRegMatch
GCstAndRegMatch(Optional< ValueAndVReg > &ValReg)
Definition: MIPatternMatch.h:143
llvm::MIPatternMatch::m_GSub
BinaryOp_match< LHS, RHS, TargetOpcode::G_SUB > m_GSub(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:473
llvm::MIPatternMatch::matchConstantSplat
Optional< ConstT > matchConstantSplat(Register, const MachineRegisterInfo &)
Definition: MIPatternMatch.h:104
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
llvm::MIPatternMatch::BinaryOpc_match::L
LHS_P L
Definition: MIPatternMatch.h:414
llvm::MIPatternMatch::m_c_GICmp
CompareOp_match< Pred, LHS, RHS, TargetOpcode::G_ICMP, true > m_c_GICmp(const Pred &P, const LHS &L, const RHS &R)
G_ICMP matcher that also matches commuted compares.
Definition: MIPatternMatch.h:693
llvm::MIPatternMatch::m_GTrunc
UnaryOp_match< SrcTy, TargetOpcode::G_TRUNC > m_GTrunc(const SrcTy &Src)
Definition: MIPatternMatch.h:589
APInt.h
llvm::MIPatternMatch::BinaryOpc_match::R
RHS_P R
Definition: MIPatternMatch.h:415
llvm::MIPatternMatch::m_GFSub
BinaryOp_match< LHS, RHS, TargetOpcode::G_FSUB, false > m_GFSub(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:498
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1793
llvm::MIPatternMatch::m_GSMax
BinaryOp_match< LHS, RHS, TargetOpcode::G_SMAX, false > m_GSMax(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:540
llvm::MIPatternMatch::CheckType::CheckType
CheckType(const LLT Ty)
Definition: MIPatternMatch.h:715
llvm::MIPatternMatch::m_GICmp
CompareOp_match< Pred, LHS, RHS, TargetOpcode::G_ICMP > m_GICmp(const Pred &P, const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:672
llvm::LLT::isValid
bool isValid() const
Definition: LowLevelTypeImpl.h:116
llvm::MIPatternMatch::m_GFAdd
BinaryOp_match< LHS, RHS, TargetOpcode::G_FADD, true > m_GFAdd(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:486
llvm::Optional
Definition: APInt.h:33
llvm::MIPatternMatch::BinaryOpc_match::match
bool match(const MachineRegisterInfo &MRI, OpTy &&Op)
Definition: MIPatternMatch.h:420
llvm::MIPatternMatch::CompareOp_match::match
bool match(const MachineRegisterInfo &MRI, OpTy &&Op)
Definition: MIPatternMatch.h:650
llvm::MIPatternMatch::m_GSMin
BinaryOp_match< LHS, RHS, TargetOpcode::G_SMIN, false > m_GSMin(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:546
llvm::MIPatternMatch::m_SpecificReg
SpecificRegisterMatch m_SpecificReg(Register RequestedReg)
Matches a register only if it is equal to RequestedReg.
Definition: MIPatternMatch.h:252
llvm::MIPatternMatch::bind_ty::match
bool match(const MachineRegisterInfo &MRI, ITy &&V)
Definition: MIPatternMatch.h:362
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::MIPatternMatch::SpecificConstantMatch::RequestedVal
int64_t RequestedVal
Definition: MIPatternMatch.h:184
llvm::MIPatternMatch::SpecificConstantOrSplatMatch::RequestedVal
int64_t RequestedVal
Definition: MIPatternMatch.h:215
preds
preds
Definition: README.txt:340
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::MIPatternMatch::BinaryOpc_match::BinaryOpc_match
BinaryOpc_match(unsigned Opcode, const LHS_P &LHS, const RHS_P &RHS)
Definition: MIPatternMatch.h:417
llvm::MIPatternMatch::m_GPtrAdd
BinaryOp_match< LHS, RHS, TargetOpcode::G_PTR_ADD, false > m_GPtrAdd(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:468
llvm::MIPatternMatch::BinaryOp_match::R
RHS_P R
Definition: MIPatternMatch.h:392
llvm::MIPatternMatch::BinaryOp_match::L
LHS_P L
Definition: MIPatternMatch.h:391
llvm::MIPatternMatch::m_GPtrToInt
UnaryOp_match< SrcTy, TargetOpcode::G_PTRTOINT > m_GPtrToInt(const SrcTy &Src)
Definition: MIPatternMatch.h:601
llvm::MIPatternMatch::m_GFabs
UnaryOp_match< SrcTy, TargetOpcode::G_FABS > m_GFabs(const SrcTy &Src)
Definition: MIPatternMatch.h:618
F
#define F(x, y, z)
Definition: MD5.cpp:55
MachineRegisterInfo.h
llvm::MachineInstr::getNumDefs
unsigned getNumDefs() const
Returns the total number of definitions.
Definition: MachineInstr.h:594
llvm::MIPatternMatch::operand_type_match::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:262
llvm::MIPatternMatch::OneNonDBGUse_match
Definition: MIPatternMatch.h:51
llvm::MIPatternMatch::m_GFCst
GFCstAndRegMatch m_GFCst(Optional< FPValueAndVReg > &FPValReg)
Definition: MIPatternMatch.h:163
llvm::MIPatternMatch::ImplicitDefMatch
Definition: MIPatternMatch.h:373
llvm::MIPatternMatch::m_GSExt
UnaryOp_match< SrcTy, TargetOpcode::G_SEXT > m_GSExt(const SrcTy &Src)
Definition: MIPatternMatch.h:574
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::MIPatternMatch::m_GMul
BinaryOp_match< LHS, RHS, TargetOpcode::G_MUL, true > m_GMul(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:480
llvm::MIPatternMatch::ConstantMatch
Definition: MIPatternMatch.h:80
llvm::MIPatternMatch::TernaryOp_match::TernaryOp_match
TernaryOp_match(const Src0Ty &Src0, const Src1Ty &Src1, const Src2Ty &Src2)
Definition: MIPatternMatch.h:730
llvm::MIPatternMatch::m_GZExt
UnaryOp_match< SrcTy, TargetOpcode::G_ZEXT > m_GZExt(const SrcTy &Src)
Definition: MIPatternMatch.h:579
llvm::MIPatternMatch::OneNonDBGUse_match::OneNonDBGUse_match
OneNonDBGUse_match(const SubPatternT &SP)
Definition: MIPatternMatch.h:53
llvm::MIPatternMatch::GFCstOrSplatGFCstMatch
Definition: MIPatternMatch.h:167
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::MachineInstr::getOperand
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:526
llvm::MIPatternMatch::Or::match
bool match(const MachineRegisterInfo &MRI, MatchSrc &&src)
Definition: MIPatternMatch.h:292
llvm::MIPatternMatch::GCstAndRegMatch
Definition: MIPatternMatch.h:141
llvm::MIPatternMatch::SpecificConstantMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:186
InstrTypes.h
llvm::MIPatternMatch::SpecificConstantOrSplatMatch
Matcher for a specific constant or constant splat.
Definition: MIPatternMatch.h:214
Utils.h
llvm::MIPatternMatch::bind_ty
Definition: MIPatternMatch.h:357
llvm::MIPatternMatch::m_GIntToPtr
UnaryOp_match< SrcTy, TargetOpcode::G_INTTOPTR > m_GIntToPtr(const SrcTy &Src)
Definition: MIPatternMatch.h:607
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:48
llvm::MIPatternMatch::m_ZeroInt
SpecificConstantMatch m_ZeroInt()
{ Convenience matchers for specific integer values.
Definition: MIPatternMatch.h:236
llvm::MIPatternMatch::Or< Pred, Preds... >::match
bool match(const MachineRegisterInfo &MRI, MatchSrc &&src)
Definition: MIPatternMatch.h:303
llvm::MIPatternMatch::ICstOrSplatMatch
Definition: MIPatternMatch.h:115
llvm::MIPatternMatch::CompareOp_match::P
Pred_P P
Definition: MIPatternMatch.h:642
llvm::MIPatternMatch::m_GFCstOrSplat
GFCstOrSplatGFCstMatch m_GFCstOrSplat(Optional< FPValueAndVReg > &FPValReg)
Definition: MIPatternMatch.h:178
llvm::ConstantFP
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:257
llvm::MIPatternMatch::BinaryOpc_match
Definition: MIPatternMatch.h:412
llvm::MIPatternMatch::Or< Pred, Preds... >::Or
Or(Pred &&p, Preds &&... preds)
Definition: MIPatternMatch.h:300
llvm::MIPatternMatch::bind_helper< MachineInstr * >::bind
static bool bind(const MachineRegisterInfo &MRI, MachineInstr *&MI, Register Reg)
Definition: MIPatternMatch.h:324
llvm::MIPatternMatch::m_SpecificICst
SpecificConstantMatch m_SpecificICst(int64_t RequestedValue)
Matches a constant equal to RequestedValue.
Definition: MIPatternMatch.h:193
llvm::MIPatternMatch::OneUse_match::OneUse_match
OneUse_match(const SubPatternT &SP)
Definition: MIPatternMatch.h:39
llvm::MIPatternMatch::UnaryOp_match::match
bool match(const MachineRegisterInfo &MRI, OpTy &&Op)
Definition: MIPatternMatch.h:556
llvm::MIPatternMatch::ImplicitDefMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:374
llvm::MIPatternMatch::m_MInstr
bind_ty< MachineInstr * > m_MInstr(MachineInstr *&MI)
Definition: MIPatternMatch.h:368
llvm::MIPatternMatch::m_Pred
bind_ty< CmpInst::Predicate > m_Pred(CmpInst::Predicate &P)
Definition: MIPatternMatch.h:370
llvm::MIPatternMatch::m_SpecificType
CheckType m_SpecificType(LLT Ty)
Definition: MIPatternMatch.h:722
llvm::MIPatternMatch::GFCstOrSplatGFCstMatch::FPValReg
Optional< FPValueAndVReg > & FPValReg
Definition: MIPatternMatch.h:168
llvm::MIPatternMatch::UnaryOp_match
Definition: MIPatternMatch.h:551
llvm::MIPatternMatch::m_GAnyExt
UnaryOp_match< SrcTy, TargetOpcode::G_ANYEXT > m_GAnyExt(const SrcTy &Src)
Definition: MIPatternMatch.h:569
llvm::MIPatternMatch::CompareOp_match::R
RHS_P R
Definition: MIPatternMatch.h:644
llvm::MIPatternMatch::SpecificConstantMatch::SpecificConstantMatch
SpecificConstantMatch(int64_t RequestedVal)
Definition: MIPatternMatch.h:185
llvm::MIPatternMatch::m_GOr
BinaryOp_match< LHS, RHS, TargetOpcode::G_OR, true > m_GOr(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:515
llvm::MachineOperand::isReg
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Definition: MachineOperand.h:320
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
llvm::MIPatternMatch::BinaryOp_match
Definition: MIPatternMatch.h:390
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::MIPatternMatch::OneNonDBGUse_match::SubPat
SubPatternT SubPat
Definition: MIPatternMatch.h:52
llvm::MIPatternMatch::And< Pred, Preds... >::match
bool match(const MachineRegisterInfo &MRI, MatchSrc &&src)
Definition: MIPatternMatch.h:285
llvm::MIPatternMatch::bind_ty::VR
Class & VR
Definition: MIPatternMatch.h:358
llvm::MIPatternMatch::Or
Definition: MIPatternMatch.h:290
llvm::MIPatternMatch::m_CommutativeBinOp
BinaryOpc_match< LHS, RHS, true > m_CommutativeBinOp(unsigned Opcode, const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:443
llvm::MIPatternMatch::matchConstant
Optional< ConstT > matchConstant(Register, const MachineRegisterInfo &)
Definition: MIPatternMatch.h:69
llvm::MIPatternMatch::m_AllOnesInt
SpecificConstantMatch m_AllOnesInt()
Definition: MIPatternMatch.h:237
llvm::MIPatternMatch::And
Matching combinators.
Definition: MIPatternMatch.h:271
llvm::MIPatternMatch::CheckType::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:717
llvm::MachineOperand::getPredicate
unsigned getPredicate() const
Definition: MachineOperand.h:597
llvm::MIPatternMatch::GFCstOrSplatGFCstMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:171
llvm::MIPatternMatch::m_Type
bind_ty< LLT > m_Type(LLT Ty)
Definition: MIPatternMatch.h:369
llvm::MIPatternMatch::SpecificConstantSplatMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:202
llvm::getIConstantVRegVal
Optional< APInt > getIConstantVRegVal(Register VReg, const MachineRegisterInfo &MRI)
If VReg is defined by a G_CONSTANT, return the corresponding value.
Definition: Utils.cpp:289
llvm::MIPatternMatch::m_GImplicitDef
ImplicitDefMatch m_GImplicitDef()
Definition: MIPatternMatch.h:382
llvm::MachineOperand::getReg
Register getReg() const
getReg - Returns the register number.
Definition: MachineOperand.h:359
llvm::MIPatternMatch::OneNonDBGUse_match::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:55
llvm::MIPatternMatch::bind_ty::bind_ty
bind_ty(Class &V)
Definition: MIPatternMatch.h:360
llvm::getIConstantSplatSExtVal
Optional< int64_t > getIConstantSplatSExtVal(const Register Reg, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:1101
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::MIPatternMatch::TernaryOp_match::Src2
Src2Ty Src2
Definition: MIPatternMatch.h:728
llvm::MIPatternMatch::BinaryOp_match::match
bool match(const MachineRegisterInfo &MRI, OpTy &&Op)
Definition: MIPatternMatch.h:396
llvm::MIPatternMatch::GCstAndRegMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:144
llvm::MIPatternMatch::SpecificRegisterMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:246
llvm::MIPatternMatch::GFCstAndRegMatch::GFCstAndRegMatch
GFCstAndRegMatch(Optional< FPValueAndVReg > &FPValReg)
Definition: MIPatternMatch.h:156
llvm::getIConstantVRegValWithLookThrough
Optional< ValueAndVReg > getIConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true)
If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT returns its...
Definition: Utils.cpp:410
llvm::MachineInstr::getOpcode
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition: MachineInstr.h:516
llvm::MIPatternMatch::ICstOrSplatMatch::CR
ConstT & CR
Definition: MIPatternMatch.h:116
llvm::MIPatternMatch::m_any_of
Or< Preds... > m_any_of(Preds &&... preds)
Definition: MIPatternMatch.h:312
llvm::MIPatternMatch::m_GXor
BinaryOp_match< LHS, RHS, TargetOpcode::G_XOR, true > m_GXor(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:510
llvm::MIPatternMatch::ConstantMatch::ConstantMatch
ConstantMatch(ConstT &C)
Definition: MIPatternMatch.h:82
llvm::MIPatternMatch::TernaryOp_match::Src1
Src1Ty Src1
Definition: MIPatternMatch.h:727
llvm::MIPatternMatch::bind_helper::bind
static bool bind(const MachineRegisterInfo &MRI, BindTy &VR, BindTy &V)
Definition: MIPatternMatch.h:317
llvm::MIPatternMatch::m_Copy
UnaryOp_match< SrcTy, TargetOpcode::COPY > m_Copy(SrcTy &&Src)
Definition: MIPatternMatch.h:628
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::MIPatternMatch::CompareOp_match::CompareOp_match
CompareOp_match(const Pred_P &Pred, const LHS_P &LHS, const RHS_P &RHS)
Definition: MIPatternMatch.h:646
llvm::MIPatternMatch::m_SpecificICstOrSplat
SpecificConstantOrSplatMatch m_SpecificICstOrSplat(int64_t RequestedValue)
Matches a RequestedValue constant or a constant splat of RequestedValue.
Definition: MIPatternMatch.h:230
llvm::MIPatternMatch::SpecificConstantOrSplatMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:218
llvm::MIPatternMatch::SpecificRegisterMatch::SpecificRegisterMatch
SpecificRegisterMatch(Register RequestedReg)
Definition: MIPatternMatch.h:245
llvm::MIPatternMatch::m_GAShr
BinaryOp_match< LHS, RHS, TargetOpcode::G_ASHR, false > m_GAShr(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:534
llvm::MIPatternMatch::And::match
bool match(const MachineRegisterInfo &MRI, MatchSrc &&src)
Definition: MIPatternMatch.h:273
llvm::MIPatternMatch::m_GBuildVectorTrunc
BinaryOp_match< LHS, RHS, TargetOpcode::G_BUILD_VECTOR_TRUNC, false > m_GBuildVectorTrunc(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:461
std
Definition: BitVector.h:851
llvm::MIPatternMatch::m_ICst
ConstantMatch< APInt > m_ICst(APInt &Cst)
Definition: MIPatternMatch.h:92
llvm::MIPatternMatch::m_GFCmp
CompareOp_match< Pred, LHS, RHS, TargetOpcode::G_FCMP > m_GFCmp(const Pred &P, const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:678
llvm::MIPatternMatch::m_GAdd
BinaryOp_match< LHS, RHS, TargetOpcode::G_ADD, true > m_GAdd(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:449
llvm::MIPatternMatch::m_GFSqrt
UnaryOp_match< SrcTy, TargetOpcode::G_FSQRT > m_GFSqrt(const SrcTy &Src)
Definition: MIPatternMatch.h:633
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::MIPatternMatch::ICstOrSplatMatch::ICstOrSplatMatch
ICstOrSplatMatch(ConstT &C)
Definition: MIPatternMatch.h:117
llvm::MIPatternMatch::m_GCst
GCstAndRegMatch m_GCst(Optional< ValueAndVReg > &ValReg)
Definition: MIPatternMatch.h:150
llvm::MIPatternMatch::CompareOp_match
Definition: MIPatternMatch.h:641
llvm::getIConstantSplatVal
Optional< APInt > getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:1083
llvm::MIPatternMatch::And< Pred, Preds... >::P
Pred P
Definition: MIPatternMatch.h:280
llvm::MIPatternMatch::GFCstAndRegMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:157
llvm::MIPatternMatch::m_GISelect
TernaryOp_match< Src0Ty, Src1Ty, Src2Ty, TargetOpcode::G_SELECT > m_GISelect(const Src0Ty &Src0, const Src1Ty &Src1, const Src2Ty &Src2)
Definition: MIPatternMatch.h:755
llvm::MIPatternMatch::SpecificRegisterMatch
}
Definition: MIPatternMatch.h:243
llvm::getFConstantVRegValWithLookThrough
Optional< FPValueAndVReg > getFConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true)
If VReg is defined by a statically evaluable chain of instructions rooted on a G_FCONSTANT returns it...
Definition: Utils.cpp:424
llvm::MIPatternMatch::ConstantMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:83
llvm::MIPatternMatch::bind_helper
Definition: MIPatternMatch.h:316
llvm::MIPatternMatch::OneUse_match::SubPat
SubPatternT SubPat
Definition: MIPatternMatch.h:38
llvm::MIPatternMatch::SpecificConstantOrSplatMatch::SpecificConstantOrSplatMatch
SpecificConstantOrSplatMatch(int64_t RequestedVal)
Definition: MIPatternMatch.h:216
llvm::Pattern
Definition: FileCheckImpl.h:614
llvm::MIPatternMatch::bind_helper< const ConstantFP * >::bind
static bool bind(const MachineRegisterInfo &MRI, const ConstantFP *&F, Register Reg)
Definition: MIPatternMatch.h:348
llvm::MIPatternMatch::m_GFPTrunc
UnaryOp_match< SrcTy, TargetOpcode::G_FPTRUNC > m_GFPTrunc(const SrcTy &Src)
Definition: MIPatternMatch.h:613
llvm::MIPatternMatch::m_GBitcast
UnaryOp_match< SrcTy, TargetOpcode::G_BITCAST > m_GBitcast(const SrcTy &Src)
Definition: MIPatternMatch.h:595
llvm::MIPatternMatch::operand_type_match
Definition: MIPatternMatch.h:261
llvm::getFConstantSplat
Optional< FPValueAndVReg > getFConstantSplat(Register VReg, const MachineRegisterInfo &MRI, bool AllowUndef=true)
Returns a floating point scalar constant of a build vector splat if it exists.
Definition: Utils.cpp:1115
llvm::MIPatternMatch::SpecificConstantSplatMatch::SpecificConstantSplatMatch
SpecificConstantSplatMatch(int64_t RequestedVal)
Definition: MIPatternMatch.h:200
llvm::MachineInstr::getNumOperands
unsigned getNumOperands() const
Retuns the total number of operands.
Definition: MachineInstr.h:519
llvm::MIPatternMatch::m_GFMul
BinaryOp_match< LHS, RHS, TargetOpcode::G_FMUL, true > m_GFMul(const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:492
llvm::MIPatternMatch::m_Neg
BinaryOp_match< SpecificConstantMatch, SrcTy, TargetOpcode::G_SUB > m_Neg(const SrcTy &&Src)
Matches a register negated by a G_SUB.
Definition: MIPatternMatch.h:764
llvm::MIPatternMatch::OneUse_match
Definition: MIPatternMatch.h:37
llvm::MIPatternMatch::GFCstOrSplatGFCstMatch::GFCstOrSplatGFCstMatch
GFCstOrSplatGFCstMatch(Optional< FPValueAndVReg > &FPValReg)
Definition: MIPatternMatch.h:169
llvm::MIPatternMatch::BinaryOp_match::BinaryOp_match
BinaryOp_match(const LHS_P &LHS, const RHS_P &RHS)
Definition: MIPatternMatch.h:394
llvm::isBuildVectorConstantSplat
bool isBuildVectorConstantSplat(const Register Reg, const MachineRegisterInfo &MRI, int64_t SplatValue, bool AllowUndef)
Return true if the specified register is defined by G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all ...
Definition: Utils.cpp:1068
llvm::MIPatternMatch::bind_helper< MachineInstr * >::bind
static bool bind(const MachineRegisterInfo &MRI, MachineInstr *&MI, MachineInstr *Inst)
Definition: MIPatternMatch.h:331
llvm::getConstantFPVRegVal
const ConstantFP * getConstantFPVRegVal(Register VReg, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:435
llvm::MIPatternMatch::m_c_GFCmp
CompareOp_match< Pred, LHS, RHS, TargetOpcode::G_FCMP, true > m_c_GFCmp(const Pred &P, const LHS &L, const RHS &R)
G_FCMP matcher that also matches commuted compares.
Definition: MIPatternMatch.h:708
llvm::MIPatternMatch::m_all_of
And< Preds... > m_all_of(Preds &&... preds)
Definition: MIPatternMatch.h:308
llvm::MIPatternMatch::CheckType::Ty
LLT Ty
Definition: MIPatternMatch.h:714
llvm::MIPatternMatch::GCstAndRegMatch::ValReg
Optional< ValueAndVReg > & ValReg
Definition: MIPatternMatch.h:142
llvm::MIPatternMatch::m_Not
BinaryOp_match< SrcTy, SpecificConstantMatch, TargetOpcode::G_XOR, true > m_Not(const SrcTy &&Src)
Matches a register not-ed by a G_XOR.
Definition: MIPatternMatch.h:772
llvm::MIPatternMatch::OneUse_match::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:41
llvm::MIPatternMatch::mi_match
bool mi_match(Reg R, const MachineRegisterInfo &MRI, Pattern &&P)
Definition: MIPatternMatch.h:25
llvm::MIPatternMatch::TernaryOp_match
Definition: MIPatternMatch.h:725
llvm::MIPatternMatch::m_BinOp
BinaryOpc_match< LHS, RHS, false > m_BinOp(unsigned Opcode, const LHS &L, const RHS &R)
Definition: MIPatternMatch.h:436
llvm::MIPatternMatch::TernaryOp_match::Src0
Src0Ty Src0
Definition: MIPatternMatch.h:726
llvm::MIPatternMatch::m_GInsertVecElt
TernaryOp_match< Src0Ty, Src1Ty, Src2Ty, TargetOpcode::G_INSERT_VECTOR_ELT > m_GInsertVecElt(const Src0Ty &Src0, const Src1Ty &Src1, const Src2Ty &Src2)
Definition: MIPatternMatch.h:748
llvm::MIPatternMatch::GFCstAndRegMatch
Definition: MIPatternMatch.h:154
llvm::MIPatternMatch::m_OneUse
OneUse_match< SubPat > m_OneUse(const SubPat &SP)
Definition: MIPatternMatch.h:47
llvm::MIPatternMatch::SpecificConstantMatch
Matcher for a specific constant value.
Definition: MIPatternMatch.h:183
llvm::MIPatternMatch::ICstOrSplatMatch::match
bool match(const MachineRegisterInfo &MRI, Register Reg)
Definition: MIPatternMatch.h:118
llvm::MIPatternMatch::ConstantMatch::CR
ConstT & CR
Definition: MIPatternMatch.h:81
llvm::MIPatternMatch::SpecificConstantSplatMatch
Matcher for a specific constant splat.
Definition: MIPatternMatch.h:198
llvm::MIPatternMatch::And< Pred, Preds... >::And
And(Pred &&p, Preds &&... preds)
Definition: MIPatternMatch.h:281
llvm::LLT
Definition: LowLevelTypeImpl.h:39