CIRCT  19.0.0git
MSFTPasses.h
Go to the documentation of this file.
1 //===- MSFTPasses.h - Common code for passes --------------------*- C++ -*-===//
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 
9 #ifndef CIRCT_DIALECT_MSFT_MSFTPASSES_H
10 #define CIRCT_DIALECT_MSFT_MSFTPASSES_H
11 
12 #include "circt/Dialect/HW/HWOps.h"
14 
15 #include "mlir/Pass/Pass.h"
16 #include "mlir/Pass/PassRegistry.h"
17 
18 namespace mlir {
19 class Pass;
20 } // namespace mlir
21 
22 namespace circt {
23 namespace msft {
24 
25 std::unique_ptr<mlir::Pass> createLowerInstancesPass();
26 std::unique_ptr<mlir::Pass> createLowerConstructsPass();
27 std::unique_ptr<mlir::Pass> createExportTclPass();
28 
29 /// A set of methods which are broadly useful in a number of dialects.
30 struct PassCommon {
31 protected:
33  DenseMap<Operation *, SmallVector<igraph::InstanceOpInterface, 1>>
35 
36  // Find all the modules and use the partial order of the instantiation DAG
37  // to sort them. If we use this order when "bubbling" up operations, we
38  // guarantee one-pass completeness. As a side-effect, populate the module to
39  // instantiation sites mapping.
40  //
41  // Assumption (unchecked): there is not a cycle in the instantiation graph.
42  void getAndSortModules(ModuleOp topMod,
43  SmallVectorImpl<hw::HWModuleLike> &mods);
44  void getAndSortModulesVisitor(hw::HWModuleLike mod,
45  SmallVectorImpl<hw::HWModuleLike> &mods,
46  DenseSet<Operation *> &modsSeen);
47 };
48 
49 /// Generate the code for registering passes.
50 #define GEN_PASS_REGISTRATION
51 #include "circt/Dialect/MSFT/MSFTPasses.h.inc"
52 
53 } // namespace msft
54 } // namespace circt
55 
56 #endif // CIRCT_DIALECT_MSFT_MSFTPASSES_H
Default symbol cache implementation; stores associations between names (StringAttr's) to mlir::Operat...
Definition: SymCache.h:85
std::unique_ptr< mlir::Pass > createExportTclPass()
std::unique_ptr< mlir::Pass > createLowerConstructsPass()
std::unique_ptr< mlir::Pass > createLowerInstancesPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: msft.py:1
A set of methods which are broadly useful in a number of dialects.
Definition: MSFTPasses.h:30
SymbolCache topLevelSyms
Definition: MSFTPasses.h:32
void getAndSortModules(ModuleOp topMod, SmallVectorImpl< hw::HWModuleLike > &mods)
Definition: PassCommon.cpp:57
void getAndSortModulesVisitor(hw::HWModuleLike mod, SmallVectorImpl< hw::HWModuleLike > &mods, DenseSet< Operation * > &modsSeen)
Definition: PassCommon.cpp:69
DenseMap< Operation *, SmallVector< igraph::InstanceOpInterface, 1 > > moduleInstantiations
Definition: MSFTPasses.h:34