26 using namespace circt;
27 using namespace firrtl;
30 FModuleOp mod = cast<FModuleOp>(operation);
32 for (
auto port : mod.getBodyBlock()->getArguments())
35 mod.walk<mlir::WalkOrder::PreOrder>([&](Operation *op) {
visitOp(op); });
39 if (
auto sf = dyn_cast<SubfieldOp>(op))
41 if (
auto sf = dyn_cast<OpenSubfieldOp>(op))
44 if (
auto si = dyn_cast<SubindexOp>(op))
46 if (
auto si = dyn_cast<OpenSubindexOp>(op))
49 if (
auto sa = dyn_cast<SubaccessOp>(op))
52 if (isa<WireOp, RegOp, RegResetOp, InvalidValueOp, chirrtl::MemoryPortOp>(op))
55 if (
auto mem = dyn_cast<MemOp>(op))
57 if (
auto inst = dyn_cast<InstanceOp>(op))
59 if (
auto inst = dyn_cast<InstanceChoiceOp>(op))
63 if (op->getNumResults()) {
64 auto type = op->getResult(0).getType();
65 if (
auto baseType = type_dyn_cast<FIRRTLBaseType>(type);
66 baseType && !baseType.isGround())
73 auto value = sf.getInput();
75 assert(node &&
"node should be in the map");
77 sv.push_back(sf.getFieldIndex());
82 auto value = sf.getInput();
84 assert(node &&
"node should be in the map");
86 sv.push_back(sf.getFieldIndex());
91 auto value = si.getInput();
93 assert(node &&
"node should be in the map");
95 sv.push_back(si.getIndex());
100 auto value = si.getInput();
102 assert(node &&
"node should be in the map");
103 auto sv = node->path;
104 sv.push_back(si.getIndex());
109 auto value = sa.getInput();
111 assert(node &&
"node should be in the map");
112 auto sv = node->path;
118 for (
auto r : mem.getResults())
123 for (
auto r : inst.getResults())
128 for (
auto r : inst.getResults())
133 auto ii =
paths.find(v);
134 if (ii ==
paths.end())
141 auto ii =
paths.try_emplace(dst, src, path, flow);
143 assert(ii.second &&
"Double insert into the map");
assert(baseType &&"element must be base type")
const PathNode * nodeForValue(Value v) const
void visitSubaccess(SubaccessOp sa)
void visitOpenSubfield(OpenSubfieldOp sf)
void visitOp(Operation *op)
DenseMap< Value, PathNode > paths
void visitInstChoice(InstanceChoiceOp inst)
void visitSubfield(SubfieldOp sf)
FieldSource(Operation *operation)
void visitInst(InstanceOp inst)
void visitOpenSubindex(OpenSubindexOp si)
void makeNodeForValue(Value dst, Value src, ArrayRef< int64_t > path, Flow flow)
void visitSubindex(SubindexOp si)
Flow foldFlow(Value val, Flow accumulatedFlow=Flow::Source)
Compute the flow for a Value, val, as determined by the FIRRTL specification.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.