39 auto control = component.getControlOp();
41 auto topLevel = *control.getRegion().getOps<EnableOp>().begin();
42 auto topLevelName = topLevel.getGroupName();
44 auto wires = component.getWiresOp();
45 Value componentGoPort = component.getGoPort();
46 wires.walk([&](GroupOp group) {
47 auto &groupRegion = group->getRegion(0);
48 OpBuilder builder(groupRegion);
52 auto groupDone = group.getDoneOp();
53 if (topLevelName == group.getSymName()) {
57 builder.create<AssignOp>(group->getLoc(), component.getDonePort(),
58 groupDone.getSrc(), groupDone.getGuard());
59 groupDone->replaceAllUsesWith(assignOp);
66 auto groupGo = group.getGoOp();
67 auto groupGoGuard = groupGo.getGuard();
68 groupGo.replaceAllUsesWith(groupGoGuard);
78 auto &wiresRegion = component.getWiresOp().getRegion();
79 auto &wireBlocks = wiresRegion.getBlocks();
80 auto lastBlock = wiresRegion.end();
83 wiresRegion.walk([&](GroupOp group) {
84 wireBlocks.splice(lastBlock, group.getRegion().getBlocks());
89 auto firstBlock = wireBlocks.begin();
90 for (
auto it = firstBlock, e = lastBlock; it != e; ++it) {
93 firstBlock->getOperations().splice(firstBlock->end(), it->getOperations());
97 while (&wiresRegion.front() != &wiresRegion.back())
98 wiresRegion.back().erase();