17 #include "mlir/IR/BuiltinTypes.h"
18 #include "mlir/IR/OperationSupport.h"
19 #include "mlir/Transforms/DialectConversion.h"
20 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
24 #define GEN_PASS_DEF_GROUPINVARIANTCODEMOTION
25 #include "circt/Dialect/Calyx/CalyxPasses.h.inc"
29 using namespace circt;
30 using namespace calyx;
35 struct GroupInvariantCodeMotionPass
36 :
public circt::calyx::impl::GroupInvariantCodeMotionBase<
37 GroupInvariantCodeMotionPass> {
38 void runOnOperation()
override {
39 auto wires = getOperation().getWiresOp();
40 for (
auto groupOp : wires.getOps<GroupOp>()) {
41 for (
auto &op : llvm::make_early_inc_range(groupOp.getOps())) {
42 if (isa<GroupDoneOp, AssignOp, GroupGoOp>(op))
44 op.moveBefore(wires.getBodyBlock(), wires.getBodyBlock()->begin());
53 return std::make_unique<GroupInvariantCodeMotionPass>();
std::unique_ptr< mlir::Pass > createGroupInvariantCodeMotionPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.