Internals: Some V3LinkCells debug improvements. No functional change.

This commit is contained in:
Wilson Snyder 2024-11-30 20:09:05 -05:00
parent 5021989cb6
commit a51e26e62d
2 changed files with 11 additions and 9 deletions

View File

@ -56,7 +56,7 @@ public:
, m_modp{modp} {}
~LinkCellsVertex() override = default;
AstNodeModule* modp() const VL_MT_STABLE { return m_modp; }
string name() const override VL_MT_STABLE { return modp()->name(); }
string name() const override VL_MT_STABLE { return cvtToHex(modp()) + ' ' + modp()->name(); }
FileLine* fileline() const override { return modp()->fileline(); }
// Recursive modules get space for maximum recursion
uint32_t rankAdder() const override {
@ -124,6 +124,10 @@ class LinkCellsVisitor final : public VNVisitor {
if (!nodep->user1p()) nodep->user1p(new LinkCellsVertex{&m_graph, nodep});
return nodep->user1u().toGraphVertex();
}
void newEdge(V3GraphVertex* fromp, V3GraphVertex* top, int weight, bool cuttable) {
UINFO(9, "newEdge " << fromp->name() << " -> " << top->name() << endl);
new V3GraphEdge{&m_graph, fromp, top, weight, cuttable};
}
AstNodeModule* findModuleSym(const string& modName) {
const VSymEnt* const foundp = m_mods.rootp()->findIdFallback(modName);
@ -184,7 +188,7 @@ class LinkCellsVisitor final : public VNVisitor {
VL_RESTORER(m_modp);
{
// For nested modules/classes, child below parent
if (m_modp) new V3GraphEdge{&m_graph, vertex(m_modp), vertex(nodep), 1};
if (m_modp) newEdge(vertex(m_modp), vertex(nodep), 1, false);
//
m_modp = nodep;
UINFO(4, "Link Module: " << nodep << endl);
@ -216,7 +220,7 @@ class LinkCellsVisitor final : public VNVisitor {
// Put under a fake vertex so that the graph ranking won't indicate
// this is a top level module
if (!m_libVertexp) m_libVertexp = new LibraryVertex{&m_graph};
new V3GraphEdge{&m_graph, m_libVertexp, vertex(nodep), 1, false};
newEdge(m_libVertexp, vertex(nodep), 1, false);
}
// Note AstBind also has iteration on cells
iterateChildren(nodep);
@ -233,7 +237,7 @@ class LinkCellsVisitor final : public VNVisitor {
if (modp) {
if (VN_IS(modp, Iface)) {
// Track module depths, so can sort list from parent down to children
new V3GraphEdge{&m_graph, vertex(m_modp), vertex(modp), 1, false};
newEdge(vertex(m_modp), vertex(modp), 1, false);
if (!nodep->cellp()) nodep->ifacep(VN_AS(modp, Iface));
} else if (VN_IS(modp, NotFoundModule)) { // Will error out later
} else {
@ -279,7 +283,7 @@ class LinkCellsVisitor final : public VNVisitor {
return;
}
}
new V3GraphEdge{&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false};
newEdge(vertex(m_modp), vertex(nodep->packagep()), 1, false);
}
void visit(AstBind* nodep) override {
@ -349,8 +353,7 @@ class LinkCellsVisitor final : public VNVisitor {
// user1 etc will retain its pre-clone value
cellmodp->user2p(otherModp);
v3Global.rootp()->addModulesp(otherModp);
new V3GraphEdge{&m_graph, vertex(cellmodp), vertex(otherModp), 1,
false};
newEdge(vertex(cellmodp), vertex(otherModp), 1, false);
}
cellmodp = otherModp;
nodep->modp(cellmodp);
@ -363,7 +366,7 @@ class LinkCellsVisitor final : public VNVisitor {
} else { // Non-recursive
// Track module depths, so can sort list from parent down to children
nodep->modp(cellmodp);
new V3GraphEdge{&m_graph, vertex(m_modp), vertex(cellmodp), 1, false};
newEdge(vertex(m_modp), vertex(cellmodp), 1, false);
}
}
}

View File

@ -3134,7 +3134,6 @@ class LinkDotResolveVisitor final : public VNVisitor {
if (m_ds.m_dotText != "") m_ds.m_dotText += "." + nodep->name();
ok = m_ds.m_dotPos == DP_SCOPE || m_ds.m_dotPos == DP_FIRST;
} else if (const AstNodeFTask* const ftaskp = VN_CAST(foundp->nodep(), NodeFTask)) {
if (!ftaskp->isFunction() || ftaskp->classMethod()) {
ok = m_ds.m_dotPos == DP_NONE;
if (ok) {