CIRCT  19.0.0git
GoInsertion.cpp
Go to the documentation of this file.
1 //===- GoInsertion.cpp - Go Insertion Pass ----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Contains the definitions of the Go Insertion pass.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "PassDetails.h"
17 #include "circt/Support/LLVM.h"
18 #include "mlir/IR/BuiltinTypes.h"
19 #include "mlir/IR/OperationSupport.h"
20 
21 using namespace circt;
22 using namespace calyx;
23 using namespace mlir;
24 
25 namespace {
26 
27 struct GoInsertionPass : public GoInsertionBase<GoInsertionPass> {
28  void runOnOperation() override;
29 };
30 
31 } // end anonymous namespace
32 
33 void GoInsertionPass::runOnOperation() {
34  ComponentOp component = getOperation();
35  auto wiresOp = component.getWiresOp();
36 
37  OpBuilder builder(wiresOp->getRegion(0));
38  auto undefinedOp =
39  builder.create<UndefinedOp>(wiresOp->getLoc(), builder.getI1Type());
40 
41  wiresOp.walk([&](GroupOp group) {
42  OpBuilder builder(group->getRegion(0));
43  // Since the source of a GroupOp's go signal isn't set until the
44  // the Compile Control pass, use an undefined value.
45  auto goOp = builder.create<GroupGoOp>(group->getLoc(), undefinedOp);
46 
48  });
49 }
50 
51 std::unique_ptr<mlir::Pass> circt::calyx::createGoInsertionPass() {
52  return std::make_unique<GoInsertionPass>();
53 }
Builder builder
static void updateGroupAssignmentGuards(OpBuilder &builder, GroupOp &group, Op &op)
Updates the guard of each assignment within a group with op.
Definition: CalyxHelpers.h:67
std::unique_ptr< mlir::Pass > createGoInsertionPass()
Definition: GoInsertion.cpp:51
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21