Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahanxie353 committed Nov 17, 2024
1 parent 3e5e79f commit e8f9e95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/circt/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ def SCFToCalyx : Pass<"lower-scf-to-calyx", "mlir::ModuleOp"> {
"Identifier of top-level function to be the entry-point component"
" of the Calyx program.">,
Option<"ciderSourceLocationMetadata", "cider-source-location-metadata", "bool", "",
"Whether to track source location for the Cider debugger.">
"Whether to track source location for the Cider debugger.">,
Option<"writeJsonOpt", "write-json", "bool", "",
"Whether to write memory contents to the json file.">
];
}

Expand Down
11 changes: 10 additions & 1 deletion lib/Conversion/SCFToCalyx/SCFToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ class ComponentLoweringState : public calyx::ComponentLoweringStateInterface,
/// Iterate through the operations of a source function and instantiate
/// components or primitives based on the type of the operations.
class BuildOpGroups : public calyx::FuncOpPartialLoweringPattern {
public:
BuildOpGroups(MLIRContext *context, LogicalResult &resRef,
calyx::PatternApplicationState &patternState,
DenseMap<mlir::func::FuncOp, calyx::ComponentOp> &map,
calyx::CalyxLoweringState &state,
mlir::Pass::Option<bool> &writeJsonOpt)
: FuncOpPartialLoweringPattern(context, resRef, patternState, map, state),
writeJson(writeJsonOpt) {}
using FuncOpPartialLoweringPattern::FuncOpPartialLoweringPattern;

LogicalResult
Expand Down Expand Up @@ -323,6 +331,7 @@ class BuildOpGroups : public calyx::FuncOpPartialLoweringPattern {
}

private:
mlir::Pass::Option<bool> &writeJson;
/// Op builder specializations.
LogicalResult buildOp(PatternRewriter &rewriter, scf::YieldOp yieldOp) const;
LogicalResult buildOp(PatternRewriter &rewriter,
Expand Down Expand Up @@ -2396,7 +2405,7 @@ void SCFToCalyxPass::runOnOperation() {
/// having a distinct group for each operation, groups are analogous to SSA
/// values in the source program.
addOncePattern<BuildOpGroups>(loweringPatterns, patternState, funcMap,
*loweringState);
*loweringState, writeJsonOpt);

/// This pattern traverses the CFG of the program and generates a control
/// schedule based on the calyx::GroupOp's which were registered for each
Expand Down

0 comments on commit e8f9e95

Please sign in to comment.