Skip to content

Commit

Permalink
[FIRRTL] Remove unused allUnder utility
Browse files Browse the repository at this point in the history
Remove an unused utility function.  This was previously used by
GrandCentral, but this is no longer load bearing.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
  • Loading branch information
seldridge committed Sep 16, 2024
1 parent 5aba666 commit 7db6951
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
2 changes: 0 additions & 2 deletions include/circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class InstanceGraph : public igraph::InstanceGraph {
InstanceGraphNode *topLevelNode;
};

bool allUnder(ArrayRef<InstanceRecord *> nodes, InstanceGraphNode *top);

} // namespace firrtl
} // namespace circt

Expand Down
33 changes: 0 additions & 33 deletions lib/Dialect/FIRRTL/FIRRTLInstanceGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,3 @@ InstanceGraph::InstanceGraph(Operation *operation)
: igraph::InstanceGraph(findCircuitOp(operation)) {
topLevelNode = lookup(cast<CircuitOp>(getParent()).getNameAttr());
}

bool circt::firrtl::allUnder(ArrayRef<InstanceRecord *> nodes,
InstanceGraphNode *top) {
DenseSet<InstanceGraphNode *> seen;
SmallVector<InstanceGraphNode *> worklist;
worklist.reserve(nodes.size());
seen.reserve(nodes.size());
seen.insert(top);
for (auto *n : nodes) {
auto *mod = n->getParent();
if (seen.insert(mod).second)
worklist.push_back(mod);
}

while (!worklist.empty()) {
auto *node = worklist.back();
worklist.pop_back();

assert(node != top);

// If reach top-level node we're not covered by 'top', return.
if (node->noUses())
return false;

// Otherwise, walk upwards.
for (auto *use : node->uses()) {
auto *mod = use->getParent();
if (seen.insert(mod).second)
worklist.push_back(mod);
}
}
return true;
}

0 comments on commit 7db6951

Please sign in to comment.