CIRCT  20.0.0git
Private Member Functions | Private Attributes | List of all members
LowerLayersPass Class Reference
Inheritance diagram for LowerLayersPass:
Inheritance graph
[legend]
Collaboration diagram for LowerLayersPass:
Collaboration graph
[legend]

Private Member Functions

hw::OutputFileAttr getOutputFile (SymbolRefAttr layerName)
 
hw::OutputFileAttr outputFileForLayer (StringRef circuitName, SymbolRefAttr layerName)
 
FModuleOp buildNewModule (OpBuilder &builder, LayerBlockOp layerBlock, SmallVectorImpl< PortInfo > &ports)
 Safely build a new module with a given namehint. More...
 
FailureOr< InnerRefMaprunOnModuleLike (FModuleLike moduleLike)
 Strip layer colors from the module's interface. More...
 
LogicalResult runOnModuleBody (FModuleOp moduleOp, InnerRefMap &innerRefMap)
 Extract layerblocks and strip probe colors from all ops under the module. More...
 
void removeLayersFromPorts (FModuleLike moduleLike)
 Update the module's port types to remove any explicit layer requirements from any probe types. More...
 
void removeLayersFromValue (Value value)
 Update the value's type to remove any layers from any probe types. More...
 
void removeLayersFromRefCast (RefCastOp cast)
 Remove any layers from the result of the cast. More...
 
void lowerInlineLayerBlock (LayerOp layer, LayerBlockOp layerBlock)
 Lower an inline layerblock to an ifdef block. More...
 
void preprocessLayers (CircuitNamespace &ns, OpBuilder &b, LayerOp layer, SmallVector< FlatSymbolRefAttr > &stack)
 Preprocess layers to build macro declarations and cache information about the layers so that this can be quired later. More...
 
void preprocessLayers (CircuitNamespace &ns, LayerOp layer)
 
void runOnOperation () override
 Entry point for the function. More...
 

Private Attributes

llvm::sys::SmartMutex< true > * circuitMutex
 Indicates exclusive access to modify the circuitNamespace and the circuit. More...
 
DenseMap< LayerBlockOp, StringRef > moduleNames
 A map of layer blocks to module name that should be created for it. More...
 
DenseMap< LayerOp, FlatSymbolRefAttr > macroNames
 A map from inline layers to their macro names. More...
 
DenseMap< SymbolRefAttr, LayerOp > symbolToLayer
 A mapping of symbol name to layer operation. More...
 

Detailed Description

Definition at line 130 of file LowerLayers.cpp.

Member Function Documentation

◆ buildNewModule()

FModuleOp LowerLayersPass::buildNewModule ( OpBuilder &  builder,
LayerBlockOp  layerBlock,
SmallVectorImpl< PortInfo > &  ports 
)
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 202 of file LowerLayers.cpp.

References assert(), circt::calyx::direction::get(), and getOutputFile().

◆ getOutputFile()

hw::OutputFileAttr LowerLayersPass::getOutputFile ( SymbolRefAttr  layerName)
inlineprivate

Definition at line 132 of file LowerLayers.cpp.

◆ lowerInlineLayerBlock()

void LowerLayersPass::lowerInlineLayerBlock ( LayerOp  layer,
LayerBlockOp  layerBlock 
)
private

Lower an inline layerblock to an ifdef block.

Definition at line 302 of file LowerLayers.cpp.

◆ outputFileForLayer()

hw::OutputFileAttr LowerLayersPass::outputFileForLayer ( StringRef  circuitName,
SymbolRefAttr  layerName 
)
inlineprivate

Definition at line 139 of file LowerLayers.cpp.

References fileNameForLayer(), and getOutputFile().

◆ preprocessLayers() [1/2]

void LowerLayersPass::preprocessLayers ( CircuitNamespace ns,
LayerOp  layer 
)
private

Definition at line 749 of file LowerLayers.cpp.

◆ preprocessLayers() [2/2]

void LowerLayersPass::preprocessLayers ( CircuitNamespace ns,
OpBuilder &  b,
LayerOp  layer,
SmallVector< FlatSymbolRefAttr > &  stack 
)
private

Preprocess layers to build macro declarations and cache information about the layers so that this can be quired later.

Definition at line 722 of file LowerLayers.cpp.

References circt::calyx::direction::get(), macroNameForLayer(), and circt::Namespace::newName().

◆ removeLayersFromPorts()

void LowerLayersPass::removeLayersFromPorts ( FModuleLike  moduleLike)
private

Update the module's port types to remove any explicit layer requirements from any probe types.

Definition at line 243 of file LowerLayers.cpp.

References circt::calyx::direction::get().

◆ removeLayersFromRefCast()

void LowerLayersPass::removeLayersFromRefCast ( RefCastOp  cast)
private

Remove any layers from the result of the cast.

If the cast becomes a nop, remove the cast itself from the IR.

Definition at line 227 of file LowerLayers.cpp.

◆ removeLayersFromValue()

void LowerLayersPass::removeLayersFromValue ( Value  value)
private

Update the value's type to remove any layers from any probe types.

Definition at line 220 of file LowerLayers.cpp.

◆ runOnModuleBody()

LogicalResult LowerLayersPass::runOnModuleBody ( FModuleOp  moduleOp,
InnerRefMap innerRefMap 
)
private

◆ runOnModuleLike()

FailureOr< InnerRefMap > LowerLayersPass::runOnModuleLike ( FModuleLike  moduleLike)
private

Strip layer colors from the module's interface.

Definition at line 272 of file LowerLayers.cpp.

◆ runOnOperation()

void LowerLayersPass::runOnOperation ( )
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 757 of file LowerLayers.cpp.

References empty, circt::calyx::direction::get(), moduleNameForLayer(), circt::Namespace::newName(), and circt::firrtl::transformReduce().

Member Data Documentation

◆ circuitMutex

llvm::sys::SmartMutex<true>* LowerLayersPass::circuitMutex
private

Indicates exclusive access to modify the circuitNamespace and the circuit.

Definition at line 186 of file LowerLayers.cpp.

◆ macroNames

DenseMap<LayerOp, FlatSymbolRefAttr> LowerLayersPass::macroNames
private

A map from inline layers to their macro names.

Definition at line 192 of file LowerLayers.cpp.

◆ moduleNames

DenseMap<LayerBlockOp, StringRef> LowerLayersPass::moduleNames
private

A map of layer blocks to module name that should be created for it.

Definition at line 189 of file LowerLayers.cpp.

◆ symbolToLayer

DenseMap<SymbolRefAttr, LayerOp> LowerLayersPass::symbolToLayer
private

A mapping of symbol name to layer operation.

Definition at line 195 of file LowerLayers.cpp.


The documentation for this class was generated from the following file: