#include "circt/Dialect/FIRRTL/FIRRTLAnnotationHelper.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotations.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLTypes.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include <iterator>
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Go to the source code of this file.
|
| namespace | circt |
| | The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
|
| |
| namespace | circt::firrtl |
| |
|
| template<typename CallableT > |
| static DictionaryAttr | transformAnnotationTarget (DictionaryAttr anno, CallableT transformTokensFn) |
| |
| static LogicalResult | mangleCircuitSymbols (CircuitOp circuit) |
| |
| static FailureOr< bool > | handleCollidingOps (SymbolOpInterface collidingOp, SymbolOpInterface incomingOp) |
| | Handles colliding symbols when merging circuits.
|
| |
◆ GEN_PASS_DEF_LINKCIRCUITS
| #define GEN_PASS_DEF_LINKCIRCUITS |
◆ handleCollidingOps()
| static FailureOr< bool > handleCollidingOps |
( |
SymbolOpInterface |
collidingOp, |
|
|
SymbolOpInterface |
incomingOp |
|
) |
| |
|
static |
Handles colliding symbols when merging circuits.
This function resolves symbol collisions between operations in different circuits during the linking process. It handles three specific cases:
- Identical extmodules: When two extmodules have identical attributes, the incoming one is removed as they are duplicates.
- Extmodule declaration + module definition: When an extmodule (declaration) collides with a module (definition), the declaration is removed in favor of the definition if their attributes match.
- Extmodule with empty parameters (Zaozi workaround): When two extmodules collide and one has empty parameters, the one without parameters (placeholder declaration) is removed. This handles a limitation in Zaozi's module generation where placeholder extmodule declarations are created from instance ops without knowing the actual parameters or defname.
- Parameters
-
| collidingOp | The operation already present in the merged circuit |
| incomingOp | The operation being added from another circuit |
- Returns
- FailureOr<bool> Returns success with true if incomingOp was erased, success with false if collidingOp was erased, or failure if the collision cannot be resolved
- Note
- This workaround for empty parameters should ultimately be removed once ODS is updated to properly support placeholder declarations.
Definition at line 186 of file LinkCircuits.cpp.
◆ mangleCircuitSymbols()
| static LogicalResult mangleCircuitSymbols |
( |
CircuitOp |
circuit | ) |
|
|
static |
◆ transformAnnotationTarget()
template<typename CallableT >
| static DictionaryAttr transformAnnotationTarget |
( |
DictionaryAttr |
anno, |
|
|
CallableT |
transformTokensFn |
|
) |
| |
|
static |