CIRCT  20.0.0git
Private Member Functions | List of all members
circt::scftocalyx::BuildControl Class Reference

Builds a control schedule by traversing the CFG of the function and associating this with the previously created groups. More...

Inheritance diagram for circt::scftocalyx::BuildControl:
Inheritance graph
[legend]
Collaboration diagram for circt::scftocalyx::BuildControl:
Collaboration graph
[legend]

Private Member Functions

LogicalResult partiallyLowerFuncToComp (FuncOp funcOp, PatternRewriter &rewriter) const override
 
LogicalResult scheduleBasicBlock (PatternRewriter &rewriter, const DenseSet< Block * > &path, mlir::Block *parentCtrlBlock, mlir::Block *block) const
 Sequentially schedules the groups that registered themselves with 'block'. More...
 
LogicalResult schedulePath (PatternRewriter &rewriter, const DenseSet< Block * > &path, Location loc, Block *from, Block *to, Block *parentCtrlBlock) const
 Schedules a block by inserting a branch argument assignment block (if any) before recursing into the scheduling of the block innards. More...
 
LogicalResult buildCFGControl (DenseSet< Block * > path, PatternRewriter &rewriter, mlir::Block *parentCtrlBlock, mlir::Block *preBlock, mlir::Block *block) const
 
void insertParInitGroups (PatternRewriter &rewriter, Location loc, const SmallVector< calyx::GroupOp > &initGroups) const
 
calyx::WhileOp buildWhileCtrlOp (ScfWhileOp whileOp, SmallVector< calyx::GroupOp > initGroups, PatternRewriter &rewriter) const
 
calyx::RepeatOp buildForCtrlOp (ScfForOp forOp, SmallVector< calyx::GroupOp > const &initGroups, uint64_t bound, PatternRewriter &rewriter) const
 

Additional Inherited Members

- Public Member Functions inherited from circt::calyx::FuncOpPartialLoweringPattern
 FuncOpPartialLoweringPattern (MLIRContext *context, LogicalResult &resRef, PatternApplicationState &patternState, DenseMap< mlir::func::FuncOp, calyx::ComponentOp > &map, calyx::CalyxLoweringState &state)
 
LogicalResult partiallyLower (mlir::func::FuncOp funcOp, PatternRewriter &rewriter) const override final
 Entry point to initialize the state of this class and conduct the partial lowering. More...
 
calyx::ComponentOp getComponent () const
 Returns the component operation associated with the currently executing partial lowering. More...
 
template<typename T = ComponentLoweringStateInterface>
T & getState () const
 
CalyxLoweringStateloweringState () const
 Return the calyx lowering state for this pattern. More...
 
virtual LogicalResult partiallyLowerFuncToComp (mlir::func::FuncOp funcOp, PatternRewriter &rewriter) const =0
 
- Public Member Functions inherited from circt::calyx::PartialLoweringPattern< mlir::func::FuncOp >
 PartialLoweringPattern (MLIRContext *ctx, LogicalResult &resRef, PatternApplicationState &patternState)
 
LogicalResult matchAndRewrite (mlir::func::FuncOp op, PatternRewriter &rewriter) const override
 
- Protected Attributes inherited from circt::calyx::FuncOpPartialLoweringPattern
DenseMap< mlir::func::FuncOp, calyx::ComponentOp > & functionMapping
 

Detailed Description

Builds a control schedule by traversing the CFG of the function and associating this with the previously created groups.

For simplicity, the generated control flow is expanded for all possible paths in the input DAG. This elaborated control flow is later reduced in the runControlFlowSimplification passes.

Definition at line 1489 of file SCFToCalyx.cpp.

Member Function Documentation

◆ buildCFGControl()

LogicalResult circt::scftocalyx::BuildControl::buildCFGControl ( DenseSet< Block * >  path,
PatternRewriter &  rewriter,
mlir::Block *  parentCtrlBlock,
mlir::Block *  preBlock,
mlir::Block *  block 
) const
inlineprivate

TODO(mortbopet): we could choose to support ie. std.switch, but it would probably be easier to just require it to be lowered beforehand.

Wrap each branch inside an if/else.

Schedule sequentially within the current parent control block.

Definition at line 1715 of file SCFToCalyx.cpp.

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

◆ buildForCtrlOp()

calyx::RepeatOp circt::scftocalyx::BuildControl::buildForCtrlOp ( ScfForOp  forOp,
SmallVector< calyx::GroupOp > const &  initGroups,
uint64_t  bound,
PatternRewriter &  rewriter 
) const
inlineprivate

Definition at line 1808 of file SCFToCalyx.cpp.

References circt::calyx::RepeatOpInterface< T >::getLoc().

◆ buildWhileCtrlOp()

calyx::WhileOp circt::scftocalyx::BuildControl::buildWhileCtrlOp ( ScfWhileOp  whileOp,
SmallVector< calyx::GroupOp >  initGroups,
PatternRewriter &  rewriter 
) const
inlineprivate

Insert while iter arg initialization group(s). Emit a parallel group to assign one or more registers all at once.

Insert the while op itself.

Definition at line 1791 of file SCFToCalyx.cpp.

References circt::calyx::direction::get(), circt::scftocalyx::ScfWhileOp::getConditionValue(), and circt::calyx::WhileOpInterface< T >::getLoc().

◆ insertParInitGroups()

void circt::scftocalyx::BuildControl::insertParInitGroups ( PatternRewriter &  rewriter,
Location  loc,
const SmallVector< calyx::GroupOp > &  initGroups 
) const
inlineprivate

Definition at line 1782 of file SCFToCalyx.cpp.

◆ partiallyLowerFuncToComp()

LogicalResult circt::scftocalyx::BuildControl::partiallyLowerFuncToComp ( FuncOp  funcOp,
PatternRewriter &  rewriter 
) const
inlineoverrideprivate

Definition at line 1493 of file SCFToCalyx.cpp.

References getBodyBlock().

◆ scheduleBasicBlock()

LogicalResult circt::scftocalyx::BuildControl::scheduleBasicBlock ( PatternRewriter &  rewriter,
const DenseSet< Block * > &  path,
mlir::Block *  parentCtrlBlock,
mlir::Block *  block 
) const
inlineprivate

Sequentially schedules the groups that registered themselves with 'block'.

Only schedule the 'after' block. The 'before' block is implicitly scheduled when evaluating the while condition.

Definition at line 1507 of file SCFToCalyx.cpp.

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

◆ schedulePath()

LogicalResult circt::scftocalyx::BuildControl::schedulePath ( PatternRewriter &  rewriter,
const DenseSet< Block * > &  path,
Location  loc,
Block *  from,
Block *  to,
Block *  parentCtrlBlock 
) const
inlineprivate

Schedules a block by inserting a branch argument assignment block (if any) before recursing into the scheduling of the block innards.

Blocks 'from' and 'to' refer to blocks in the source program. parentCtrlBlock refers to the control block wherein control operations are to be inserted.

Schedule any registered block arguments to be executed before the body of the branch.

Definition at line 1699 of file SCFToCalyx.cpp.


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