CIRCT 21.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 | preprocessModule (CircuitNamespace &ns, InstanceGraphNode *node) |
Build the bindfile skeletons for each 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 187 of file LowerLayers.cpp.
|
private |
Build a bindfile skeleton for a particular module and layer.
Definition at line 790 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 275 of file LowerLayers.cpp.
References assert(), circuitMutex, getOutputFile(), and layerBlockGlobals.
Referenced by runOnModuleBody().
|
inlineprivate |
Definition at line 189 of file LowerLayers.cpp.
References symbolToLayer.
Referenced by buildNewModule(), and outputFileForLayer().
|
private |
Lower an inline layerblock to an ifdef block.
Definition at line 358 of file LowerLayers.cpp.
References macroNames.
Referenced by runOnModuleBody().
|
inlineprivate |
Definition at line 196 of file LowerLayers.cpp.
References fileNameForLayer(), and getOutputFile().
Referenced by runOnModuleBody().
|
private |
Definition at line 780 of file LowerLayers.cpp.
References preprocessLayers().
|
private |
Build macro declarations and cache information about the layers.
Definition at line 753 of file LowerLayers.cpp.
References macroNameForLayer(), macroNames, circt::Namespace::newName(), preprocessLayers(), and symbolToLayer.
Referenced by preprocessLayers(), preprocessLayers(), and runOnOperation().
|
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 867 of file LowerLayers.cpp.
References circt::igraph::InstanceGraphNode::getModule(), hierPathNameForLayer(), layerBlockGlobals, moduleNameForLayer(), circt::Namespace::newName(), and symbolToLayer.
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 930 of file LowerLayers.cpp.
References preprocessModule().
Referenced by runOnOperation().
|
private |
Update the module's port types to remove any explicit layer requirements from any probe types.
Definition at line 299 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 292 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 367 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 328 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 940 of file LowerLayers.cpp.
References bindFiles, circuitMutex, getBodyBlock(), hierPathCache, layerBlockGlobals, macroNames, preprocessLayers(), preprocessModules(), symbolToLayer, and circt::firrtl::transformReduce().
|
private |
A mapping from module*layer to bindfile name.
Definition at line 268 of file LowerLayers.cpp.
Referenced by buildBindFile(), runOnModuleBody(), and runOnOperation().
|
private |
Indicates exclusive access to modify the circuitNamespace and the circuit.
Definition at line 249 of file LowerLayers.cpp.
Referenced by buildNewModule(), runOnModuleBody(), and runOnOperation().
|
private |
Utility for creating hw::HierPathOp.
Definition at line 265 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 253 of file LowerLayers.cpp.
Referenced by buildNewModule(), preprocessModule(), runOnModuleBody(), and runOnOperation().
|
private |
A map from inline layers to their macro names.
Definition at line 256 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 262 of file LowerLayers.cpp.
Referenced by getOutputFile(), preprocessLayers(), preprocessModule(), runOnModuleBody(), and runOnOperation().