My Project
PassDetail.h
Go to the documentation of this file.
1 //===- PassDetail.h - MLIR Pass details -------------------------*- C++ -*-===//
2 //
3 // Part of the MLIR 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 #ifndef MLIR_PASS_PASSDETAIL_H_
9 #define MLIR_PASS_PASSDETAIL_H_
10 
11 #include "mlir/Pass/Pass.h"
12 #include "mlir/Pass/PassManager.h"
13 
14 namespace mlir {
15 namespace detail {
16 
17 //===----------------------------------------------------------------------===//
18 // Verifier Pass
19 //===----------------------------------------------------------------------===//
20 
22 class VerifierPass : public OperationPass<VerifierPass> {
23  void runOnOperation() override;
24 };
25 
26 //===----------------------------------------------------------------------===//
27 // OpToOpPassAdaptor
28 //===----------------------------------------------------------------------===//
29 
32 public:
34  OpToOpPassAdaptorBase(const OpToOpPassAdaptorBase &rhs) = default;
35 
37  void mergeInto(OpToOpPassAdaptorBase &rhs);
38 
41 
43  std::string getName();
44 
45 protected:
46  // A set of adaptors to run.
48 };
49 
52 class OpToOpPassAdaptor : public OperationPass<OpToOpPassAdaptor>,
53  public OpToOpPassAdaptorBase {
54 public:
56 
58  void runOnOperation() override;
59 };
60 
64  : public OperationPass<OpToOpPassAdaptorParallel>,
65  public OpToOpPassAdaptorBase {
66 public:
68 
70  void runOnOperation() override;
71 
74  return asyncExecutors;
75  }
76 
77 private:
78  // A set of executors, cloned from the main executor, that run asynchronously
79  // on different threads.
81 };
82 
86 
89 inline bool isAdaptorPass(Pass *pass) {
90  return isa<OpToOpPassAdaptorParallel>(pass) || isa<OpToOpPassAdaptor>(pass);
91 }
92 
93 } // end namespace detail
94 } // end namespace mlir
95 #endif // MLIR_PASS_PASSDETAIL_H_
Definition: InferTypeOpInterface.cpp:20
OpToOpPassAdaptorBase * getAdaptorPassBase(Pass *pass)
Definition: Pass.cpp:490
MutableArrayRef< OpPassManager > getPassManagers()
Returns the pass managers held by this adaptor.
Definition: PassDetail.h:40
MutableArrayRef< SmallVector< OpPassManager, 1 > > getParallelPassManagers()
Return the async pass managers held by this parallel adaptor.
Definition: PassDetail.h:73
Pass to verify an operation and signal failure if necessary.
Definition: PassDetail.h:22
StringRef getName() override
Returns the derived pass name.
Definition: Pass.h:233
Definition: PassDetail.h:52
Definition: Pass.h:301
SmallVector< OpPassManager, 1 > mgrs
Definition: PassDetail.h:47
Definition: LLVM.h:38
bool isAdaptorPass(Pass *pass)
Definition: PassDetail.h:89
Definition: LLVM.h:35
A base class for Op-to-Op adaptor passes.
Definition: PassDetail.h:31
Definition: Pass.h:41
Definition: PassDetail.h:63
Definition: PassManager.h:44