CIRCT  19.0.0git
Classes | Public Member Functions | Private Attributes | List of all members
circt::scftocalyx::SCFToCalyxPass Class Reference
Inheritance diagram for circt::scftocalyx::SCFToCalyxPass:
Inheritance graph
[legend]
Collaboration diagram for circt::scftocalyx::SCFToCalyxPass:
Collaboration graph
[legend]

Classes

struct  LoweringPattern
 

Public Member Functions

 SCFToCalyxPass ()
 
void runOnOperation () override
 
LogicalResult setTopLevelFunction (mlir::ModuleOp moduleOp, std::string &topLevelFunction)
 
LogicalResult labelEntryPoint (StringRef topLevelFunction)
 Labels the entry point of a Calyx program. More...
 
template<typename TPattern , typename... PatternArgs>
void addOncePattern (SmallVectorImpl< LoweringPattern > &patterns, PatternArgs &&...args)
 'Once' patterns are expected to take an additional LogicalResult& argument, to forward their result state (greedyPatternRewriteDriver results are skipped for Once patterns). More...
 
template<typename TPattern , typename... PatternArgs>
void addGreedyPattern (SmallVectorImpl< LoweringPattern > &patterns, PatternArgs &&...args)
 
LogicalResult runPartialPattern (RewritePatternSet &pattern, bool runOnce)
 

Private Attributes

LogicalResult partialPatternRes
 
std::shared_ptr< calyx::CalyxLoweringStateloweringState = nullptr
 

Detailed Description

Definition at line 1590 of file SCFToCalyx.cpp.

Constructor & Destructor Documentation

◆ SCFToCalyxPass()

circt::scftocalyx::SCFToCalyxPass::SCFToCalyxPass ( )
inline

Definition at line 1592 of file SCFToCalyx.cpp.

Member Function Documentation

◆ addGreedyPattern()

template<typename TPattern , typename... PatternArgs>
void circt::scftocalyx::SCFToCalyxPass::addGreedyPattern ( SmallVectorImpl< LoweringPattern > &  patterns,
PatternArgs &&...  args 
)
inline

Definition at line 1683 of file SCFToCalyx.cpp.

◆ addOncePattern()

template<typename TPattern , typename... PatternArgs>
void circt::scftocalyx::SCFToCalyxPass::addOncePattern ( SmallVectorImpl< LoweringPattern > &  patterns,
PatternArgs &&...  args 
)
inline

'Once' patterns are expected to take an additional LogicalResult& argument, to forward their result state (greedyPatternRewriteDriver results are skipped for Once patterns).

Definition at line 1674 of file SCFToCalyx.cpp.

◆ labelEntryPoint()

LogicalResult circt::scftocalyx::SCFToCalyxPass::labelEntryPoint ( StringRef  topLevelFunction)
inline

Labels the entry point of a Calyx program.

Furthermore, this function performs validation on the input function, to ensure that we've implemented the capabilities necessary to convert it.

Definition at line 1632 of file SCFToCalyx.cpp.

References circt::calyx::applyModuleOpConversion().

◆ runOnOperation()

void circt::scftocalyx::SCFToCalyxPass::runOnOperation ( )
override

Start conversion


If you are a developer, it may be helpful to add a 'getOperation()->dump()' call after the execution of each stage to

view the transformations that's going on.

A mapping is maintained between a function operation and its corresponding Calyx component.

Creates a new Calyx component for each FuncOp in the inpurt module.

This pass inlines scf.ExecuteRegionOp's by adding control-flow.

This pattern converts all index typed values to an i32 integer.

This pattern creates registers for all basic-block arguments.

This pattern creates registers for the function return values.

This pattern creates registers for iteration arguments of scf.while operations. Additionally, creates a group for assigning the initial value of the iteration argument registers.

This pattern creates registers for iteration arguments of scf.for operations. Additionally, creates a group for assigning the initial value of the iteration argument registers.

This pattern converts operations within basic blocks to Calyx library operators. Combinational operations are assigned inside a calyx::CombGroupOp, and sequential inside calyx::GroupOps. Sequential groups are registered with the Block* of which the operation originated from. This is used during control schedule generation. By having a distinct group for each operation, groups are analogous to SSA values in the source program.

This pattern traverses the CFG of the program and generates a control schedule based on the calyx::GroupOp's which were registered for each basic block in the source function.

This pass recursively inlines use-def chains of combinational logic (from non-stateful groups) into groups referenced in the control schedule.

This pattern performs various SSA replacements that must be done after control generation.

Eliminate any unused combinational groups. This is done before calyx::RewriteMemoryAccesses to avoid inferring slice components for groups that will be removed.

This pattern rewrites accesses to memories which are too wide due to index types being converted to a fixed-width integer type.

This pattern removes the source FuncOp which has now been converted into a Calyx component.

Sequentially apply each lowering pattern.

Definition at line 1717 of file SCFToCalyx.cpp.

References circt::calyx::direction::get(), and circt::calyx::getCiderSourceLocationMetadata().

◆ runPartialPattern()

LogicalResult circt::scftocalyx::SCFToCalyxPass::runPartialPattern ( RewritePatternSet &  pattern,
bool  runOnce 
)
inline

Can't return applyPatternsAndFoldGreedily. Root isn't necessarily erased so it will always return failed(). Instead, forward the 'succeeded' value from PartialLoweringPatternBase.

Definition at line 1691 of file SCFToCalyx.cpp.

References assert().

◆ setTopLevelFunction()

LogicalResult circt::scftocalyx::SCFToCalyxPass::setTopLevelFunction ( mlir::ModuleOp  moduleOp,
std::string &  topLevelFunction 
)
inline

No top level function set; infer top level if the module only contains a single function, else, throw error.

Definition at line 1596 of file SCFToCalyx.cpp.

Member Data Documentation

◆ loweringState

std::shared_ptr<calyx::CalyxLoweringState> circt::scftocalyx::SCFToCalyxPass::loweringState = nullptr
private

Definition at line 1714 of file SCFToCalyx.cpp.

◆ partialPatternRes

LogicalResult circt::scftocalyx::SCFToCalyxPass::partialPatternRes
private

Definition at line 1713 of file SCFToCalyx.cpp.


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