13#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONPATTERNMATCH_H
14#define LLVM_ANALYSIS_SCALAREVOLUTIONPATTERNMATCH_H
19namespace SCEVPatternMatch {
21template <
typename Val,
typename Pattern>
26template <
typename Predicate>
struct cst_pred_ty :
public Predicate {
29 "no vector types expected from SCEVs");
30 auto *
C = dyn_cast<SCEVConstant>(S);
31 return C && this->isValue(
C->getAPInt());
56 template <
typename ITy>
bool match(ITy *V)
const {
return isa<Class>(V); }
64 template <
typename ITy>
bool match(ITy *V)
const {
65 if (
auto *CV = dyn_cast<Class>(V)) {
88 template <
typename ITy>
bool match(ITy *S) {
return S ==
Expr; }
101 auto *
E = dyn_cast<SCEVTy>(S);
102 return E &&
E->getNumOperands() == 1 &&
Op0.match(
E->getOperand(0));
106template <
typename SCEVTy,
typename Op0_t>
111template <
typename Op0_t>
112inline SCEVUnaryExpr_match<SCEVSignExtendExpr, Op0_t>
114 return m_scev_Unary<SCEVSignExtendExpr>(Op0);
117template <
typename Op0_t>
118inline SCEVUnaryExpr_match<SCEVZeroExtendExpr, Op0_t>
120 return m_scev_Unary<SCEVZeroExtendExpr>(Op0);
124template <
typename SCEVTy,
typename Op0_t,
typename Op1_t>
132 auto *
E = dyn_cast<SCEVTy>(S);
133 return E &&
E->getNumOperands() == 2 &&
Op0.match(
E->getOperand(0)) &&
134 Op1.match(
E->getOperand(1));
138template <
typename SCEVTy,
typename Op0_t,
typename Op1_t>
139inline SCEVBinaryExpr_match<SCEVTy, Op0_t, Op1_t>
144template <
typename Op0_t,
typename Op1_t>
145inline SCEVBinaryExpr_match<SCEVAddExpr, Op0_t, Op1_t>
147 return m_scev_Binary<SCEVAddExpr>(Op0, Op1);
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
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.
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.
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)
cst_pred_ty< is_one > m_scev_One()
Match an integer 1.
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< SCEVTy, Op0_t, Op1_t > m_scev_Binary(const Op0_t &Op0, const Op1_t &Op1)
bind_ty< const SCEVConstant > m_SCEVConstant(const SCEVConstant *&V)
bind_ty< const SCEV > m_SCEV(const SCEV *&V)
Match a SCEV, capturing it if we match.
SCEVBinaryExpr_match< SCEVAddExpr, Op0_t, Op1_t > m_scev_Add(const Op0_t &Op0, const Op1_t &Op1)
bool match(const SCEV *S, const Pattern &P)
bind_ty< const SCEVUnknown > m_SCEVUnknown(const SCEVUnknown *&V)
specificscev_ty m_Specific(const SCEV *S)
Match if we have a specific specified SCEV.
This is an optimization pass for GlobalISel generic memory operations.
SCEVBinaryExpr_match(Op0_t Op0, Op1_t Op1)
bool match(const SCEV *S)
bool match(const SCEV *S)
SCEVUnaryExpr_match(Op0_t Op0)
bool match(const SCEV *S)
bool isValue(const APInt &C)
bool isValue(const APInt &C)
bool isValue(const APInt &C)
Match a specified const SCEV *.
specificscev_ty(const SCEV *Expr)