Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/circt/Dialect/Arc/ArcPasses.td
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@ def LowerClocksToFuncs : Pass<"arc-lower-clocks-to-funcs", "mlir::ModuleOp"> {
let dependentDialects = ["mlir::func::FuncDialect", "mlir::scf::SCFDialect"];
}

def LowerCoroutinesPass : Pass<"arc-lower-coroutines", "mlir::ModuleOp"> {
let summary = "Lower coroutines to state machine functions";
let description = [{
Convert each `arc.coroutine.define` into a regular function that takes an
explicit state and program counter as its leading arguments, and that
dispatches to its entry block or one of its resume blocks accordingly.
Values that are live across suspension points are persisted in the
explicit state, which is a union with one struct variant per resume block.
Calls to coroutines become regular function calls, and all uses of the
opaque `!arc.coroutine_state` and `!arc.coroutine_pc` types anywhere in
the IR are replaced with the concrete union and integer types computed for
each coroutine.
}];
let dependentDialects = [
"comb::CombDialect",
"hw::HWDialect",
"mlir::cf::ControlFlowDialect",
"mlir::func::FuncDialect",
"mlir::ub::UBDialect",
];
}

def LowerArrays : Pass<"arc-lower-arrays", "mlir::ModuleOp"> {
let summary = "Lower arrays to use bufferized arrayrefs";
let dependentDialects = ["arc::ArcDialect"];
Expand Down
3 changes: 3 additions & 0 deletions lib/Dialect/Arc/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_circt_dialect_library(CIRCTArcTransforms
LowerArcsToFuncs.cpp
LowerArrays.cpp
LowerClocksToFuncs.cpp
LowerCoroutines.cpp
LowerLUT.cpp
LowerState.cpp
LowerVectorizations.cpp
Expand Down Expand Up @@ -44,11 +45,13 @@ add_circt_dialect_library(CIRCTArcTransforms
CIRCTSupport
CIRCTSV
CIRCTVerif
MLIRControlFlowDialect
MLIRFuncDialect
MLIRIR
MLIRLLVMDialect
MLIRPass
MLIRSCFDialect
MLIRTransformUtils
MLIRUBDialect
MLIRVectorDialect
)
Loading
Loading