CIRCT 24.0.0git
Loading...
Searching...
No Matches
Passes.h
Go to the documentation of this file.
1//===- Passes.h - FIRRTL pass entry points ----------------------*- 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// This header file defines prototypes that expose pass constructors.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_DIALECT_FIRRTL_PASSES_H
14#define CIRCT_DIALECT_FIRRTL_PASSES_H
15
17#include "mlir/Pass/Pass.h"
18#include "mlir/Pass/PassRegistry.h"
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/STLFunctionalExtras.h"
21
22namespace mlir {
23class MLIRContext;
24class Pass;
25} // namespace mlir
26
27namespace circt {
28namespace firrtl {
29class InstanceGraph;
30class InstanceInfo;
31
32/// Configure which aggregate values will be preserved by the LowerTypes pass.
33namespace PreserveAggregate {
35 /// Don't preserve aggregate at all. This has been default behaivor and
36 /// compatible with SFC.
38
39 /// Preserve only 1d vectors of ground type (e.g. UInt<2>[3]).
41
42 /// Preserve only vectors (e.g. UInt<2>[3][3]).
44
45 /// Preserve all aggregate values.
47};
48}
49
50/// Configure which values will be explicitly preserved by the DropNames pass.
51namespace PreserveValues {
53 /// Strip all names. No name on declaration is preserved.
55 /// Don't explicitly preserve any named values. Every named operation could
56 /// be optimized away by the compiler. Unlike `Strip` names could be preserved
57 /// until the end.
59 // Explicitly preserved values with meaningful names. If a name begins with
60 // an "_" it is not considered meaningful.
62 // Explicitly preserve all values. No named operation should be optimized
63 // away by the compiler.
65};
66} // namespace PreserveValues
67
68enum class CompanionMode {
69 // Lower companions to SystemVerilog binds.
70 Bind,
71 // Lower companions to explicit instances. Used when assertions or other
72 // debugging constructs from the companion are to be included in the design.
74 // Drop companion modules, eliminating them from the design.
75 Drop,
76};
77
78/// The mode for the InferDomains pass.
79enum class InferDomainsMode {
80 /// Check domains without inference.
81 Check,
82 /// Check domains with inference for private modules.
83 Infer,
84 /// Check domains with inference for both public and private modules.
86};
87
88void runCombMemsToRegOfVec(FModuleOp mod, bool ignoreReadEnable,
89 unsigned &numConverted);
90LogicalResult runFullReset(CircuitOp circuit, InstanceGraph &ig,
91 InstanceInfo &instanceInfo,
92 bool convertAsyncDomainMems = false);
93
94/// Strip domains whose names match the predicate from a circuit.
95LogicalResult
96stripDomainsFromCircuit(CircuitOp circuit,
97 llvm::function_ref<bool(StringAttr)> shouldStripDomain);
98
99#define GEN_PASS_DECL
100#include "circt/Dialect/FIRRTL/Passes.h.inc"
101
102/// Generate the code for registering passes.
103#define GEN_PASS_REGISTRATION
104#include "circt/Dialect/FIRRTL/Passes.h.inc"
105
106} // namespace firrtl
107} // namespace circt
108
109#endif // CIRCT_DIALECT_FIRRTL_PASSES_H
HW-specific instance graph with a virtual entry node linking to all publicly visible modules.
@ All
Preserve all aggregate values.
Definition Passes.h:46
@ OneDimVec
Preserve only 1d vectors of ground type (e.g. UInt<2>[3]).
Definition Passes.h:40
@ Vec
Preserve only vectors (e.g. UInt<2>[3][3]).
Definition Passes.h:43
@ None
Don't preserve aggregate at all.
Definition Passes.h:37
@ None
Don't explicitly preserve any named values.
Definition Passes.h:58
@ Strip
Strip all names. No name on declaration is preserved.
Definition Passes.h:54
LogicalResult stripDomainsFromCircuit(CircuitOp circuit, llvm::function_ref< bool(StringAttr)> shouldStripDomain)
Strip domains whose names match the predicate from a circuit.
InferDomainsMode
The mode for the InferDomains pass.
Definition Passes.h:79
@ Check
Check domains without inference.
@ Infer
Check domains with inference for private modules.
@ InferAll
Check domains with inference for both public and private modules.
void runCombMemsToRegOfVec(FModuleOp mod, bool ignoreReadEnable, unsigned &numConverted)
LogicalResult runFullReset(CircuitOp circuit, InstanceGraph &ig, InstanceInfo &instanceInfo, bool convertAsyncDomainMems=false)
std::map< std::string, std::set< std::string > > InstanceGraph
Iterates over the handshake::FuncOp's in the program to build an instance graph.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.