13#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONPATTERNMATCH_H
14#define LLVM_ANALYSIS_SCALAREVOLUTIONPATTERNMATCH_H
19namespace SCEVPatternMatch {
30 "no vector types expected from SCEVs");
31 auto *
C = dyn_cast<SCEVConstant>(S);
32 return C && this->isValue(
C->getAPInt());
60 template <
typename ITy>
bool match(ITy *V)
const {
return isa<Class>(V); }
76 template <
typename ITy>
bool match(ITy *V)
const {
77 if (
auto *CV = dyn_cast<Class>(V)) {
104 template <
typename ITy>
bool match(ITy *S)
const {
return S ==
Expr; }
138 "no vector types expected from SCEVs");
139 auto *
C = dyn_cast<SCEVConstant>(S);
157 auto *
E = dyn_cast<SCEVTy>(S);
158 return E &&
E->getNumOperands() == 1 &&
Op0.match(
E->getOperand(0));
162template <
typename SCEVTy,
typename Op0_t>
167template <
typename Op0_t>
168inline SCEVUnaryExpr_match<SCEVSignExtendExpr, Op0_t>
170 return m_scev_Unary<SCEVSignExtendExpr>(Op0);
173template <
typename Op0_t>
174inline SCEVUnaryExpr_match<SCEVZeroExtendExpr, Op0_t>
176 return m_scev_Unary<SCEVZeroExtendExpr>(Op0);
179template <
typename Op0_t>
180inline SCEVUnaryExpr_match<SCEVPtrToIntExpr, Op0_t>
186template <
typename SCEVTy,
typename Op0_t,
typename Op1_t>
194 auto *
E = dyn_cast<SCEVTy>(S);
195 return E &&
E->getNumOperands() == 2 &&
Op0.match(
E->getOperand(0)) &&
196 Op1.match(
E->getOperand(1));
200template <
typename SCEVTy,
typename Op0_t,
typename Op1_t>
201inline SCEVBinaryExpr_match<SCEVTy, Op0_t, Op1_t>
206template <
typename Op0_t,
typename Op1_t>
207inline SCEVBinaryExpr_match<SCEVAddExpr, Op0_t, Op1_t>
209 return m_scev_Binary<SCEVAddExpr>(Op0, Op1);
212template <
typename Op0_t,
typename Op1_t>
213inline SCEVBinaryExpr_match<SCEVMulExpr, Op0_t, Op1_t>
215 return m_scev_Binary<SCEVMulExpr>(Op0, Op1);
218template <
typename Op0_t,
typename Op1_t>
219inline SCEVBinaryExpr_match<SCEVUDivExpr, Op0_t, Op1_t>
221 return m_scev_Binary<SCEVUDivExpr>(Op0, Op1);
227template <
typename Op0_t,
typename Op1_t,
typename Loop_t>
236 return Ops.match(S) &&
Loop.match(cast<SCEVAddRecExpr>(S)->getLoop());
253template <
typename Op0_t,
typename Op1_t>
254inline SCEVAffineAddRec_match<Op0_t, Op1_t, class_match<const Loop>>
260template <
typename Op0_t,
typename Op1_t,
typename Loop_t>
261inline SCEVAffineAddRec_match<Op0_t, Op1_t, Loop_t>
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Class for arbitrary precision integers.
Represents a single loop in the control flow graph.
This node represents an addition of some number of SCEVs.
This class represents a constant integer value.
This means that we are dealing with an entirely unknown SCEV value, and only represent it as its LLVM...
This class represents an analyzed expression in the program.
LLVM_ABI Type * getType() const
Return the LLVM type of this SCEV expression.
bool isVectorTy() const
True if this is an instance of VectorType.
@ C
The default llvm calling convention, compatible with C.
class_match< const SCEVVScale > m_SCEVVScale()
bind_cst_ty m_scev_APInt(const APInt *&C)
Match an SCEV constant and bind it to an APInt.
cst_pred_ty< is_all_ones > m_scev_AllOnes()
Match an integer with all bits set.
SCEVUnaryExpr_match< SCEVZeroExtendExpr, Op0_t > m_scev_ZExt(const Op0_t &Op0)
class_match< const SCEVConstant > m_SCEVConstant()
cst_pred_ty< is_one > m_scev_One()
Match an integer 1.
specificloop_ty m_SpecificLoop(const Loop *L)
cst_pred_ty< is_specific_signed_cst > m_scev_SpecificSInt(int64_t V)
Match an SCEV constant with a plain signed integer (sign-extended value will be matched)
SCEVAffineAddRec_match< Op0_t, Op1_t, class_match< const Loop > > m_scev_AffineAddRec(const Op0_t &Op0, const Op1_t &Op1)
SCEVUnaryExpr_match< SCEVTy, Op0_t > m_scev_Unary(const Op0_t &Op0)
SCEVUnaryExpr_match< SCEVSignExtendExpr, Op0_t > m_scev_SExt(const Op0_t &Op0)
cst_pred_ty< is_zero > m_scev_Zero()
Match an integer 0.
SCEVBinaryExpr_match< SCEVMulExpr, Op0_t, Op1_t > m_scev_Mul(const Op0_t &Op0, const Op1_t &Op1)
SCEVBinaryExpr_match< SCEVTy, Op0_t, Op1_t > m_scev_Binary(const Op0_t &Op0, const Op1_t &Op1)
bool match(const SCEV *S, const Pattern &P)
SCEVBinaryExpr_match< SCEVUDivExpr, Op0_t, Op1_t > m_scev_UDiv(const Op0_t &Op0, const Op1_t &Op1)
specificscev_ty m_scev_Specific(const SCEV *S)
Match if we have a specific specified SCEV.
class_match< const Loop > m_Loop()
bind_ty< const SCEVAddExpr > m_scev_Add(const SCEVAddExpr *&V)
SCEVUnaryExpr_match< SCEVPtrToIntExpr, Op0_t > m_scev_PtrToInt(const Op0_t &Op0)
bind_ty< const SCEVUnknown > m_SCEVUnknown(const SCEVUnknown *&V)
cst_pred_ty< is_specific_cst > m_scev_SpecificInt(uint64_t V)
Match an SCEV constant with a plain unsigned integer.
class_match< const SCEV > m_SCEV()
This is an optimization pass for GlobalISel generic memory operations.
Match an affine SCEVAddRecExpr.
SCEVBinaryExpr_match< SCEVAddRecExpr, Op0_t, Op1_t > Ops
bool match(const SCEV *S) const
SCEVAffineAddRec_match(Op0_t Op0, Op1_t Op1, Loop_t Loop)
SCEVBinaryExpr_match(Op0_t Op0, Op1_t Op1)
bool match(const SCEV *S) const
bool match(const SCEV *S) const
SCEVUnaryExpr_match(Op0_t Op0)
bind_cst_ty(const APInt *&Op0)
bool match(const SCEV *S) const
bool match(const SCEV *S) const
bool isValue(const APInt &C) const
bool isValue(const APInt &C) const
is_specific_cst(uint64_t C)
bool isValue(const APInt &C) const
bool isValue(const APInt &C) const
is_specific_signed_cst(int64_t C)
bool isValue(const APInt &C) const
Match a specified const Loop*.
bool match(const Loop *L) const
specificloop_ty(const Loop *L)
Match a specified const SCEV *.
specificscev_ty(const SCEV *Expr)