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 /// A set of methods which are broadly useful in a number of dialects.
26 struct PassCommon {
27 protected:
29  DenseMap<Operation *, SmallVector<igraph::InstanceOpInterface, 1>>
31 
32  // Find all the modules and use the partial order of the instantiation DAG
33  // to sort them. If we use this order when "bubbling" up operations, we
34  // guarantee one-pass completeness. As a side-effect, populate the module to
35  // instantiation sites mapping.
36  //
37  // Assumption (unchecked): there is not a cycle in the instantiation graph.
38  void getAndSortModules(ModuleOp topMod,
39  SmallVectorImpl<hw::HWModuleLike> &mods);
40  void getAndSortModulesVisitor(hw::HWModuleLike mod,
41  SmallVectorImpl<hw::HWModuleLike> &mods,
42  DenseSet<Operation *> &modsSeen);
43 };
44 
45 #define GEN_PASS_DECL
46 #include "circt/Dialect/MSFT/MSFTPasses.h.inc"
47 
48 std::unique_ptr<mlir::Pass> createLowerInstancesPass();
49 std::unique_ptr<mlir::Pass> createLowerConstructsPass();
50 std::unique_ptr<mlir::Pass> createExportTclPass();
51 
52 /// Generate the code for registering passes.
53 #define GEN_PASS_REGISTRATION
54 #include "circt/Dialect/MSFT/MSFTPasses.h.inc"
55 
56 } // namespace msft
57 } // namespace circt
58 
59 #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:26
SymbolCache topLevelSyms
Definition: MSFTPasses.h:28
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:30