18
18
namespace llvm {
19
19
namespace SCEVPatternMatch {
20
20
21
- template <typename Val, typename Pattern>
22
- bool match (const SCEV *S, const Pattern &P) {
21
+ template <typename Pattern> bool match (const SCEV *S, const Pattern &P) {
23
22
return P.match (S);
24
23
}
25
24
26
25
template <typename Predicate> struct cst_pred_ty : public Predicate {
27
- bool match (const SCEV *S) {
26
+ bool match (const SCEV *S) const {
28
27
assert ((isa<SCEVCouldNotCompute>(S) || !S->getType ()->isVectorTy ()) &&
29
28
" no vector types expected from SCEVs" );
30
29
auto *C = dyn_cast<SCEVConstant>(S);
@@ -33,20 +32,23 @@ template <typename Predicate> struct cst_pred_ty : public Predicate {
33
32
};
34
33
35
34
struct is_zero {
36
- bool isValue (const APInt &C) { return C.isZero (); }
35
+ bool isValue (const APInt &C) const { return C.isZero (); }
37
36
};
37
+
38
38
// / Match an integer 0.
39
39
inline cst_pred_ty<is_zero> m_scev_Zero () { return cst_pred_ty<is_zero>(); }
40
40
41
41
struct is_one {
42
- bool isValue (const APInt &C) { return C.isOne (); }
42
+ bool isValue (const APInt &C) const { return C.isOne (); }
43
43
};
44
+
44
45
// / Match an integer 1.
45
46
inline cst_pred_ty<is_one> m_scev_One () { return cst_pred_ty<is_one>(); }
46
47
47
48
struct is_all_ones {
48
- bool isValue (const APInt &C) { return C.isAllOnes (); }
49
+ bool isValue (const APInt &C) const { return C.isAllOnes (); }
49
50
};
51
+
50
52
// / Match an integer with all bits set.
51
53
inline cst_pred_ty<is_all_ones> m_scev_AllOnes () {
52
54
return cst_pred_ty<is_all_ones>();
@@ -85,7 +87,7 @@ struct specificscev_ty {
85
87
86
88
specificscev_ty (const SCEV *Expr) : Expr(Expr) {}
87
89
88
- template <typename ITy> bool match (ITy *S) { return S == Expr; }
90
+ template <typename ITy> bool match (ITy *S) const { return S == Expr; }
89
91
};
90
92
91
93
// / Match if we have a specific specified SCEV.
@@ -97,7 +99,7 @@ template <typename SCEVTy, typename Op0_t> struct SCEVUnaryExpr_match {
97
99
98
100
SCEVUnaryExpr_match (Op0_t Op0) : Op0(Op0) {}
99
101
100
- bool match (const SCEV *S) {
102
+ bool match (const SCEV *S) const {
101
103
auto *E = dyn_cast<SCEVTy>(S);
102
104
return E && E->getNumOperands () == 1 && Op0.match (E->getOperand (0 ));
103
105
}
@@ -128,7 +130,7 @@ struct SCEVBinaryExpr_match {
128
130
129
131
SCEVBinaryExpr_match (Op0_t Op0, Op1_t Op1) : Op0(Op0), Op1(Op1) {}
130
132
131
- bool match (const SCEV *S) {
133
+ bool match (const SCEV *S) const {
132
134
auto *E = dyn_cast<SCEVTy>(S);
133
135
return E && E->getNumOperands () == 2 && Op0.match (E->getOperand (0 )) &&
134
136
Op1.match (E->getOperand (1 ));
0 commit comments