blob: 21524f05a446af241fe01ff32f215da5d0319a6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
//===--- MatchersInternal.cpp----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Query/Matcher/MatchersInternal.h"
namespace mlir::query::matcher {
namespace internal {
bool allOfVariadicOperator(Operation *op, SetVector<Operation *> *matchedOps,
ArrayRef<DynMatcher> innerMatchers) {
return llvm::all_of(innerMatchers, [&](const DynMatcher &matcher) {
if (matchedOps)
return matcher.match(op, *matchedOps);
return matcher.match(op);
});
}
bool anyOfVariadicOperator(Operation *op, SetVector<Operation *> *matchedOps,
ArrayRef<DynMatcher> innerMatchers) {
return llvm::any_of(innerMatchers, [&](const DynMatcher &matcher) {
if (matchedOps)
return matcher.match(op, *matchedOps);
return matcher.match(op);
});
}
} // namespace internal
} // namespace mlir::query::matcher
|