Do not feed any empty logic into scheduling (#4972)
This commit is contained in:
parent
08c76b1da6
commit
878204db73
|
|
@ -77,6 +77,21 @@ class ActiveTopVisitor final : public VNVisitor {
|
||||||
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete empty procedures
|
||||||
|
for (AstNode *stmtp = nodep->stmtsp(), *nextp; stmtp; stmtp = nextp) {
|
||||||
|
nextp = stmtp->nextp();
|
||||||
|
if (AstNodeProcedure* const procp = VN_CAST(stmtp, NodeProcedure)) {
|
||||||
|
if (!procp->stmtsp()) VL_DO_DANGLING(pushDeletep(procp->unlinkFrBack()), stmtp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete empty actives
|
||||||
|
if (!nodep->stmtsp()) {
|
||||||
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Move the SENTREE for each active up to the global level.
|
// Move the SENTREE for each active up to the global level.
|
||||||
// This way we'll easily see what clock domains are identical
|
// This way we'll easily see what clock domains are identical
|
||||||
AstSenTree* const wantp = m_finder.getSenTree(sensesp);
|
AstSenTree* const wantp = m_finder.getSenTree(sensesp);
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,8 @@ public:
|
||||||
AstNode* const headp = [&]() -> AstNode* {
|
AstNode* const headp = [&]() -> AstNode* {
|
||||||
if (!procp) return logicp; // Not a procedure, handle as a unit
|
if (!procp) return logicp; // Not a procedure, handle as a unit
|
||||||
AstNode* const stmtsp = procp->stmtsp();
|
AstNode* const stmtsp = procp->stmtsp();
|
||||||
if (stmtsp) stmtsp->unlinkFrBackWithNext();
|
UASSERT_OBJ(stmtsp, procp, "Empty process should have been deleted earlier");
|
||||||
|
stmtsp->unlinkFrBackWithNext();
|
||||||
// Procedure is no longer needed and can be deleted right now
|
// Procedure is no longer needed and can be deleted right now
|
||||||
VL_DO_DANGLING(procp->deleteTree(), procp);
|
VL_DO_DANGLING(procp->deleteTree(), procp);
|
||||||
return stmtsp;
|
return stmtsp;
|
||||||
|
|
|
||||||
|
|
@ -355,14 +355,9 @@ LogicClasses gatherLogicClasses(AstNetlist* netlistp) {
|
||||||
LogicClasses result;
|
LogicClasses result;
|
||||||
|
|
||||||
netlistp->foreach([&](AstScope* scopep) {
|
netlistp->foreach([&](AstScope* scopep) {
|
||||||
std::vector<AstActive*> empty;
|
|
||||||
|
|
||||||
scopep->foreach([&](AstActive* activep) {
|
scopep->foreach([&](AstActive* activep) {
|
||||||
AstSenTree* const senTreep = activep->sensesp();
|
AstSenTree* const senTreep = activep->sensesp();
|
||||||
if (!activep->stmtsp()) {
|
if (senTreep->hasStatic()) {
|
||||||
// Some AstActives might be empty due to previous optimizations
|
|
||||||
empty.push_back(activep);
|
|
||||||
} else if (senTreep->hasStatic()) {
|
|
||||||
UASSERT_OBJ(!senTreep->sensesp()->nextp(), activep,
|
UASSERT_OBJ(!senTreep->sensesp()->nextp(), activep,
|
||||||
"static initializer with additional sensitivities");
|
"static initializer with additional sensitivities");
|
||||||
result.m_static.emplace_back(scopep, activep);
|
result.m_static.emplace_back(scopep, activep);
|
||||||
|
|
@ -393,8 +388,6 @@ LogicClasses gatherLogicClasses(AstNetlist* netlistp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (AstActive* const activep : empty) activep->unlinkFrBack()->deleteTree();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue