mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Internals: Remove code dead after recent refactoring (#8498)
This commit is contained in:
+7
-46
@@ -798,48 +798,10 @@ class DeadVisitor final : public VNVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress constParameterPointer
|
||||
void preserveTopIfaces(AstNetlist* rootp) {
|
||||
// cppcheck-suppress constVariablePointer
|
||||
for (AstNodeModule* modp = rootp->modulesp(); modp && modp->isTop();
|
||||
modp = VN_AS(modp->nextp(), NodeModule)) {
|
||||
for (AstNode* subnodep = modp->stmtsp(); subnodep; subnodep = subnodep->nextp()) {
|
||||
if (AstVar* const varp = VN_CAST(subnodep, Var)) {
|
||||
if (varp->isIfaceRef()) {
|
||||
const AstNodeDType* const subtypep = varp->subDTypep();
|
||||
const AstIfaceRefDType* ifacerefp = nullptr;
|
||||
if (VN_IS(subtypep, IfaceRefDType)) {
|
||||
ifacerefp = VN_AS(varp->subDTypep(), IfaceRefDType);
|
||||
} else if (VN_IS(subtypep, BracketArrayDType)) {
|
||||
const AstBracketArrayDType* const arrp
|
||||
= VN_AS(subtypep, BracketArrayDType);
|
||||
const AstNodeDType* const arrsubtypep = arrp->subDTypep();
|
||||
if (VN_IS(arrsubtypep, IfaceRefDType)) {
|
||||
ifacerefp = VN_AS(arrsubtypep, IfaceRefDType);
|
||||
}
|
||||
} else if (VN_IS(subtypep, UnpackArrayDType)) {
|
||||
const AstUnpackArrayDType* const arrp
|
||||
= VN_AS(subtypep, UnpackArrayDType);
|
||||
const AstNodeDType* const arrsubtypep = arrp->subDTypep();
|
||||
if (VN_IS(arrsubtypep, IfaceRefDType)) {
|
||||
ifacerefp = VN_AS(arrsubtypep, IfaceRefDType);
|
||||
}
|
||||
}
|
||||
|
||||
if (ifacerefp && !ifacerefp->cellp()
|
||||
&& (ifacerefp->ifacep()->user1() == 0)) {
|
||||
ifacerefp->ifacep()->user1(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
DeadVisitor(AstNetlist* nodep, bool elimUserVars, bool elimDTypes, bool elimScopes,
|
||||
bool elimCells, bool elimTopIfaces, bool elimTasks)
|
||||
bool elimCells, bool elimTasks)
|
||||
: m_elimUserVars{elimUserVars}
|
||||
, m_elimDTypes{elimDTypes}
|
||||
, m_elimCells{elimCells}
|
||||
@@ -874,7 +836,6 @@ public:
|
||||
if (elimCells) deadCheckCells();
|
||||
deadCheckClasses();
|
||||
// Modules after vars, because might be vars we delete inside a mod we delete
|
||||
if (!elimTopIfaces) preserveTopIfaces(nodep);
|
||||
deadCheckMod();
|
||||
|
||||
// After deleting as much as can, demote some virtual functions
|
||||
@@ -901,32 +862,32 @@ public:
|
||||
|
||||
void V3Dead::deadifyModules(AstNetlist* nodep) {
|
||||
UINFO(2, __FUNCTION__ << ":");
|
||||
{ // node, elimUserVars, elimDTypes, elimScopes, elimCells, elimTopIfaces
|
||||
DeadVisitor{nodep, false, false, false, false, !v3Global.opt.topIfacesSupported(), false};
|
||||
{ // node, elimUserVars, elimDTypes, elimScopes, elimCells, elimTasks
|
||||
DeadVisitor{nodep, false, false, false, false, false};
|
||||
} // Destruct before checking
|
||||
V3Global::dumpCheckGlobalTree("deadModules", 0, dumpTreeEitherLevel() >= 6);
|
||||
}
|
||||
|
||||
void V3Dead::deadifyDTypes(AstNetlist* nodep) {
|
||||
UINFO(2, __FUNCTION__ << ":");
|
||||
{ DeadVisitor{nodep, false, true, false, false, false, true}; } // Destruct before checking
|
||||
{ DeadVisitor{nodep, false, true, false, false, true}; } // Destruct before checking
|
||||
V3Global::dumpCheckGlobalTree("deadDtypes", 0, dumpTreeEitherLevel() >= 3);
|
||||
}
|
||||
|
||||
void V3Dead::deadifyDTypesScoped(AstNetlist* nodep) {
|
||||
UINFO(2, __FUNCTION__ << ":");
|
||||
{ DeadVisitor{nodep, false, true, true, false, false, false}; } // Destruct before checking
|
||||
{ DeadVisitor{nodep, false, true, true, false, false}; } // Destruct before checking
|
||||
V3Global::dumpCheckGlobalTree("deadDtypesScoped", 0, dumpTreeEitherLevel() >= 3);
|
||||
}
|
||||
|
||||
void V3Dead::deadifyAll(AstNetlist* nodep) {
|
||||
UINFO(2, __FUNCTION__ << ":");
|
||||
{ DeadVisitor{nodep, true, true, false, true, false, true}; } // Destruct before checking
|
||||
{ DeadVisitor{nodep, true, true, false, true, true}; } // Destruct before checking
|
||||
V3Global::dumpCheckGlobalTree("deadAll", 0, dumpTreeEitherLevel() >= 3);
|
||||
}
|
||||
|
||||
void V3Dead::deadifyAllScoped(AstNetlist* nodep) {
|
||||
UINFO(2, __FUNCTION__ << ":");
|
||||
{ DeadVisitor{nodep, true, true, true, true, false, true}; } // Destruct before checking
|
||||
{ DeadVisitor{nodep, true, true, true, true, true}; } // Destruct before checking
|
||||
V3Global::dumpCheckGlobalTree("deadAllScoped", 0, dumpTreeEitherLevel() >= 3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user