CIRCT 22.0.0git
|
Private Member Functions | |
hw::OutputFileAttr | getOutputFile (SymbolRefAttr layerName) |
hw::OutputFileAttr | outputFileForLayer (StringRef moduleName, SymbolRefAttr layerName) |
FModuleOp | buildNewModule (OpBuilder &builder, LayerBlockOp layerBlock) |
Safely build a new module with a given namehint. | |
FailureOr< InnerRefMap > | runOnModuleLike (FModuleLike moduleLike) |
Strip layer colors from the module's interface. | |
LogicalResult | runOnModuleBody (FModuleOp moduleOp, InnerRefMap &innerRefMap) |
Extract layerblocks and strip probe colors from all ops under the module. | |
void | removeLayersFromPorts (FModuleLike moduleLike) |
Update the module's port types to remove any explicit layer requirements from any probe types. | |
void | removeLayersFromValue (Value value) |
Update the value's type to remove any layers from any probe types. | |
void | lowerInlineLayerBlock (LayerOp layer, LayerBlockOp layerBlock) |
Lower an inline layerblock to an ifdef block. | |
void | preprocessLayers (CircuitNamespace &ns, OpBuilder &b, LayerOp layer, StringRef circuitName, SmallVector< FlatSymbolRefAttr > &stack) |
Build macro declarations and cache information about the layers. | |
void | preprocessLayers (CircuitNamespace &ns) |
void | preprocessModules (CircuitNamespace &ns, InstanceGraph &ig) |
For each module, build a bindfile for each bound-layer, if needed. | |
void | preprocessModuleLike (CircuitNamespace &ns, InstanceGraphNode *node) |
Build the bindfile skeletons for each module. | |
void | preprocessModule (CircuitNamespace &ns, InstanceGraphNode *node, FModuleOp module) |
Build the bindfile skeleton for a module. | |
void | preprocessExtModule (CircuitNamespace &ns, InstanceGraphNode *node, FExtModuleOp extModule) |
Record the supposed bindfiles for any known layers of the ext module. | |
void | buildBindFile (CircuitNamespace &ns, InstanceGraphNode *node, OpBuilder &b, SymbolRefAttr layerName, LayerOp layer) |
Build a bindfile skeleton for a particular module and layer. | |
void | runOnOperation () override |
Entry point for the function. | |
Private Attributes | |
llvm::sys::SmartMutex< true > * | circuitMutex |
Indicates exclusive access to modify the circuitNamespace and the circuit. | |
DenseMap< LayerBlockOp, LayerBlockGlobals > | layerBlockGlobals |
A map of layer blocks to "safe" global names which are fine to create in the circuit namespace. | |
DenseMap< LayerOp, FlatSymbolRefAttr > | macroNames |
A map from inline layers to their macro names. | |
llvm::MapVector< SymbolRefAttr, LayerOp > | symbolToLayer |
A mapping of symbol name to layer operation. | |
hw::HierPathCache * | hierPathCache |
Utility for creating hw::HierPathOp. | |
DenseMap< Operation *, DenseMap< LayerOp, BindFileInfo > > | bindFiles |
A mapping from module*layer to bindfile name. | |
Definition at line 200 of file LowerLayers.cpp.
|
private |
Build a bindfile skeleton for a particular module and layer.
Definition at line 855 of file LowerLayers.cpp.
References assert(), bindFiles, fileNameForLayer(), guardMacroNameForLayer(), macroNames, and circt::Namespace::newName().
|
private |
Safely build a new module with a given namehint.
Multi-process safe function to build a module in the circuit and return it.
This handles geting a lock to modify the top-level circuit.
The name provided is only a namehint for the module—a unique name will be generated if there are conflicts with the namehint in the circuit-level namespace.
Definition at line 298 of file LowerLayers.cpp.
References assert(), circuitMutex, getOutputFile(), and layerBlockGlobals.
Referenced by runOnModuleBody().
|
inlineprivate |
Definition at line 204 of file LowerLayers.cpp.
References symbolToLayer.
Referenced by buildNewModule(), and outputFileForLayer().
|
private |
Lower an inline layerblock to an ifdef block.
Definition at line 387 of file LowerLayers.cpp.
References macroNames.
Referenced by runOnModuleBody().
|
inlineprivate |
Definition at line 211 of file LowerLayers.cpp.
References fileNameForLayer(), and getOutputFile().
Referenced by runOnModuleBody().
|
private |
Record the supposed bindfiles for any known layers of the ext module.
Definition at line 1003 of file LowerLayers.cpp.
References bindFiles, fileNameForLayer(), and symbolToLayer.
Referenced by preprocessModuleLike().
|
private |
Definition at line 845 of file LowerLayers.cpp.
References preprocessLayers().
|
private |
Build macro declarations and cache information about the layers.
Definition at line 818 of file LowerLayers.cpp.
References macroNameForLayer(), macroNames, circt::Namespace::newName(), preprocessLayers(), and symbolToLayer.
Referenced by preprocessLayers(), preprocessLayers(), and runOnOperation().
|
private |
Build the bindfile skeleton for a module.
Definition at line 947 of file LowerLayers.cpp.
References hierPathNameForLayer(), layerBlockGlobals, moduleNameForLayer(), circt::Namespace::newName(), and symbolToLayer.
Referenced by preprocessModuleLike().
|
private |
Build the bindfile skeletons for each module.
Set up a table which tells us for each module/layer pair, where to insert the bind operations.
Definition at line 1039 of file LowerLayers.cpp.
References circt::igraph::InstanceGraphNode::getModule(), preprocessExtModule(), and preprocessModule().
Referenced by preprocessModules().
|
private |
For each module, build a bindfile for each bound-layer, if needed.
Create the bind file skeleton for each layer, for each module.
Definition at line 1053 of file LowerLayers.cpp.
References preprocessModuleLike().
Referenced by runOnOperation().
|
private |
Update the module's port types to remove any explicit layer requirements from any probe types.
Definition at line 322 of file LowerLayers.cpp.
References removeLayersFromValue().
Referenced by runOnModuleLike().
|
private |
Update the value's type to remove any layers from any probe types.
Definition at line 315 of file LowerLayers.cpp.
Referenced by removeLayersFromPorts(), and runOnModuleBody().
|
private |
Extract layerblocks and strip probe colors from all ops under the module.
Definition at line 398 of file LowerLayers.cpp.
References assert(), bindFiles, buildNewModule(), circuitMutex, circt::firrtl::getInnerRefTo(), circt::firrtl::getIntZerosAttr(), hierPathCache, instanceNameForLayer(), circt::isAncestorOfValueOwner(), layerBlockGlobals, lowerInlineLayerBlock(), circt::Namespace::newName(), outputFileForLayer(), removeLayersFromValue(), and symbolToLayer.
Referenced by runOnModuleLike().
|
private |
Strip layer colors from the module's interface.
Definition at line 351 of file LowerLayers.cpp.
References removeLayersFromPorts(), and runOnModuleBody().
|
overrideprivate |
Entry point for the function.
Process a circuit to remove all layer blocks in each module and top-level layer definition.
Definition at line 1063 of file LowerLayers.cpp.
References bindFiles, circuitMutex, getBodyBlock(), hierPathCache, layerBlockGlobals, macroNames, preprocessLayers(), preprocessModules(), symbolToLayer, and circt::transformReduce().
|
private |
A mapping from module*layer to bindfile name.
Definition at line 291 of file LowerLayers.cpp.
Referenced by buildBindFile(), preprocessExtModule(), runOnModuleBody(), and runOnOperation().
|
private |
Indicates exclusive access to modify the circuitNamespace and the circuit.
Definition at line 272 of file LowerLayers.cpp.
Referenced by buildNewModule(), runOnModuleBody(), and runOnOperation().
|
private |
Utility for creating hw::HierPathOp.
Definition at line 288 of file LowerLayers.cpp.
Referenced by runOnModuleBody(), and runOnOperation().
|
private |
A map of layer blocks to "safe" global names which are fine to create in the circuit namespace.
Definition at line 276 of file LowerLayers.cpp.
Referenced by buildNewModule(), preprocessModule(), runOnModuleBody(), and runOnOperation().
|
private |
A map from inline layers to their macro names.
Definition at line 279 of file LowerLayers.cpp.
Referenced by buildBindFile(), lowerInlineLayerBlock(), preprocessLayers(), and runOnOperation().
|
private |
A mapping of symbol name to layer operation.
This also serves as an iterable list of all layers declared in a circuit. We use a map vector so that the iteration order matches the order of declaration in the circuit. This order is not required for correctness, it helps with legibility.
Definition at line 285 of file LowerLayers.cpp.
Referenced by getOutputFile(), preprocessExtModule(), preprocessLayers(), preprocessModule(), runOnModuleBody(), and runOnOperation().