MLIR  21.0.0git
MatchersInternal.cpp
Go to the documentation of this file.
1 //===--- MatchersInternal.cpp----------------------------------------------===//
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 
10 #include "llvm/ADT/SetVector.h"
11 
12 namespace mlir::query::matcher {
13 
14 namespace internal {
15 
17  ArrayRef<DynMatcher> innerMatchers) {
18  return llvm::all_of(innerMatchers, [&](const DynMatcher &matcher) {
19  if (matchedOps)
20  return matcher.match(op, *matchedOps);
21  return matcher.match(op);
22  });
23 }
25  ArrayRef<DynMatcher> innerMatchers) {
26  return llvm::any_of(innerMatchers, [&](const DynMatcher &matcher) {
27  if (matchedOps)
28  return matcher.match(op, *matchedOps);
29  return matcher.match(op);
30  });
31 }
32 } // namespace internal
33 } // namespace mlir::query::matcher
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
bool match(Operation *op) const
bool anyOfVariadicOperator(Operation *op, SetVector< Operation * > *matchedOps, ArrayRef< DynMatcher > innerMatchers)
bool allOfVariadicOperator(Operation *op, SetVector< Operation * > *matchedOps, ArrayRef< DynMatcher > innerMatchers)
Computes the backward-slice of all transitive defs reachable from rootOp, if innerMatcher matches.
Definition: ErrorBuilder.h:20