Internals: Manage DfgVertex user data via a typed map (#6356)

Add DfgUserMap as a handle around the one pointer worth of algorithm
specific 'user' storage in each DfgVertex. This reduces verbosity,
improves type safety and correctness. Also enables us to remove one
pointer from DfgVertex to reduce memory use. No functional change.
This commit is contained in:
Geza Lore
2025-09-02 22:21:24 +01:00
committed by GitHub
parent a6f26b85b3
commit e63ed0a931
9 changed files with 516 additions and 441 deletions
+3 -3
View File
@@ -1822,8 +1822,8 @@ void V3DfgPasses::synthesize(DfgGraph& dfg, V3DfgContext& ctx) {
// Otherwise figure out which vertices are worth synthesizing.
// Find cycles
const auto userDataInUse = dfg.userDataInUse();
V3DfgPasses::colorStronglyConnectedComponents(dfg);
DfgUserMap<uint64_t> scc = dfg.makeUserMap<uint64_t>();
V3DfgPasses::colorStronglyConnectedComponents(dfg, scc);
// First, gather variables, we will then attempt to synthesize all their drivers
std::vector<DfgVertexVar*> varps;
@@ -1832,7 +1832,7 @@ void V3DfgPasses::synthesize(DfgGraph& dfg, V3DfgContext& ctx) {
if (!var.srcp()) continue;
// Circular variable - synthesize
if (var.getUser<uint64_t>()) {
if (scc.at(var)) {
varps.emplace_back(&var);
continue;
}