Internals: Cleanup some missing VL_RESTORERs. No functional change intended.

This commit is contained in:
Wilson Snyder 2025-02-27 21:18:27 -05:00
parent 7f94fa1da7
commit 098ee6fa7a
16 changed files with 34 additions and 36 deletions

View File

@ -72,13 +72,13 @@ class CaseLintVisitor final : public VNVisitorConst {
// Check for X/Z in non-casex statements
{
VL_RESTORER(m_caseExprp);
m_caseExprp = nodep;
iterateConst(nodep->exprp());
for (AstCaseItem* itemp = nodep->itemsp(); itemp;
itemp = VN_AS(itemp->nextp(), CaseItem)) {
iterateAndNextConstNull(itemp->condsp());
}
m_caseExprp = nullptr;
}
}
void visit(AstConst* nodep) override {

View File

@ -188,9 +188,9 @@ class CombineVisitor final : VNVisitor {
}
void visit(AstNodeModule* nodep) override {
UASSERT_OBJ(!m_modp, nodep, "Should not nest");
VL_RESTORER(m_modp);
m_modp = nodep;
iterateChildrenConst(nodep);
m_modp = nullptr;
}
void visit(AstCFunc* nodep) override {
iterateChildrenConst(nodep);

View File

@ -215,9 +215,9 @@ class DescopeVisitor final : public VNVisitor {
makePublicFuncWrappers();
}
void visit(AstScope* nodep) override {
VL_RESTORER(m_scopep);
m_scopep = nodep;
iterateChildren(nodep);
m_scopep = nullptr;
}
void visit(AstVarScope* nodep) override {
// Delete the varscope when we're finished

View File

@ -109,6 +109,7 @@ class InlineMarkVisitor final : public VNVisitor {
// VISITORS
void visit(AstNodeModule* nodep) override {
UASSERT_OBJ(!m_modp, nodep, "Unsupported: Nested modules");
VL_RESTORER(m_modp);
m_modp = nodep;
m_allMods.push_back(nodep);
m_modp->user2(CIL_MAYBE);
@ -123,7 +124,6 @@ class InlineMarkVisitor final : public VNVisitor {
}
iterateChildren(nodep);
m_modp = nullptr;
}
void visit(AstClass* nodep) override {
// TODO allow inlining of modules that have classes
@ -584,13 +584,13 @@ class InlineVisitor final : public VNVisitor {
}
void visit(AstNodeModule* nodep) override {
UASSERT_OBJ(!m_modp, nodep, "Unsupported: Nested modules");
VL_RESTORER(m_modp);
m_modp = nodep;
// Iterate the stored cells directly to reduce traversal
for (AstCell* const cellp : m_moduleState(nodep).m_childCells) {
if (m_moduleState(cellp->modp()).m_inlined) inlineCell(cellp);
}
m_moduleState(nodep).m_childCells.clear();
m_modp = nullptr;
}
void visit(AstIfaceRefDType* nodep) override {
if (nodep->user1()) {

View File

@ -44,11 +44,11 @@ class InstVisitor final : public VNVisitor {
// VISITORS
void visit(AstCell* nodep) override {
UINFO(4, " CELL " << nodep << endl);
VL_RESTORER(m_cellp);
m_cellp = nodep;
// VV***** We reset user1p() on each cell!!!
AstNode::user1ClearTree();
iterateChildren(nodep);
m_cellp = nullptr;
}
void visit(AstPin* nodep) override {
// PIN(p,expr) -> ASSIGNW(VARXREF(p),expr) (if sub's input)

View File

@ -321,6 +321,7 @@ class LifePostDlyVisitor final : public VNVisitor {
}
void visit(AstExecGraph* nodep) override {
// Treat the ExecGraph like a call to each mtask body
VL_RESTORER(m_execMTaskp);
if (m_inEvalNba) {
UASSERT_OBJ(!m_mtasksGraphp, nodep, "Cannot handle more than one AstExecGraph");
m_mtasksGraphp = nodep->depGraphp();
@ -331,7 +332,6 @@ class LifePostDlyVisitor final : public VNVisitor {
m_sequence = 0;
iterate(mtaskp->bodyp());
}
m_execMTaskp = nullptr;
}
void visit(AstCFunc* nodep) override {
if (!m_tracingCall && !nodep->entryPoint()) return;

View File

@ -168,9 +168,9 @@ class LinkJumpVisitor final : public VNVisitor {
iterateChildren(nodep);
}
void visit(AstNodeFTask* nodep) override {
VL_RESTORER(m_ftaskp);
m_ftaskp = nodep;
iterateChildren(nodep);
m_ftaskp = nullptr;
}
void visit(AstNodeBlock* nodep) override {
UINFO(8, " " << nodep << endl);

View File

@ -121,9 +121,9 @@ class LinkResolveVisitor final : public VNVisitor {
if (m_assertp) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Assert not allowed under another assert");
}
VL_RESTORER(m_assertp);
m_assertp = nodep;
iterateChildren(nodep);
m_assertp = nullptr;
}
void visit(AstVar* nodep) override {
iterateChildren(nodep);
@ -171,11 +171,9 @@ class LinkResolveVisitor final : public VNVisitor {
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
return;
}
{
m_ftaskp = nodep;
iterateChildren(nodep);
}
m_ftaskp = nullptr;
VL_RESTORER(m_ftaskp);
m_ftaskp = nodep;
iterateChildren(nodep);
if (nodep->dpiExport()) nodep->scopeNamep(new AstScopeName{nodep->fileline(), false});
}
void visit(AstNodeFTaskRef* nodep) override {

View File

@ -132,6 +132,10 @@ class OrderGraphBuilder final : public VNVisitor {
UASSERT_OBJ(!m_logicVxp, nodep, "AstActive under logic");
UASSERT_OBJ(!m_inClocked && !m_domainp && !m_hybridp, nodep, "Should not nest");
VL_RESTORER(m_domainp);
VL_RESTORER(m_hybridp);
VL_RESTORER(m_inClocked);
// This is the original sensitivity of the block (i.e.: not the ref into the TRIGGERVEC)
const AstSenTree* const senTreep
@ -163,11 +167,6 @@ class OrderGraphBuilder final : public VNVisitor {
// Analyze logic underneath
iterateChildren(nodep);
//
m_inClocked = false;
m_domainp = nullptr;
m_hybridp = nullptr;
}
void visit(AstNodeVarRef* nodep) override {
// As we explicitly not visit (see ignored nodes below) any subtree that is not relevant
@ -299,9 +298,9 @@ class OrderGraphBuilder final : public VNVisitor {
}
void visit(AstAlwaysPost* nodep) override {
UASSERT_OBJ(!m_inPost, nodep, "Should not nest");
VL_RESTORER(m_inPost);
m_inPost = true;
iterateLogic(nodep);
m_inPost = false;
}
void visit(AstAlwaysObserved* nodep) override { //
iterateLogic(nodep);

View File

@ -228,9 +228,9 @@ class SchedGraphBuilder final : public VNVisitor {
});
}
VL_RESTORER(m_senTreep);
m_senTreep = senTreep;
iterateChildrenConst(nodep);
m_senTreep = nullptr;
}
void visit(AstNodeProcedure* nodep) override { visitLogic(nodep); }

View File

@ -401,7 +401,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
AstNodeModule* m_modp = nullptr;
// AstNodeStmt, AstCell, or AstAlways(Public) for sensitivity
AstNode* m_contextp = nullptr;
const AstNodeFTask* m_inFTask = nullptr;
const AstNodeFTask* m_inFTaskp = nullptr;
size_t m_numSplit = 0;
// List for SplitPackedVarVisitor
SplitVarRefsMap m_refsForPackedSplit;
@ -461,11 +461,11 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
UASSERT_OBJ(!m_modp, m_modp, "Nested module declaration");
UASSERT_OBJ(m_refs.empty(), nodep, "The last module didn't finish split()");
VL_RESTORER(m_modp);
m_modp = nodep;
m_tempNames.reset();
iterateChildren(nodep);
split();
m_modp = nullptr;
}
void visit(AstNodeStmt* nodep) override { setContextAndIterateChildren(nodep); }
void visit(AstCell* nodep) override { setContextAndIterateChildren(nodep); }
@ -531,11 +531,11 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
}
void visit(AstNodeFTask* nodep) override {
UASSERT_OBJ(!m_inFTask, nodep, "Nested func/task");
UASSERT_OBJ(!m_inFTaskp, nodep, "Nested func/task");
if (!cannotSplitTaskReason(nodep)) {
m_inFTask = nodep;
VL_RESTORER(m_inFTaskp);
m_inFTaskp = nodep;
iterateChildren(nodep);
m_inFTask = nullptr;
}
}
void visit(AstVar* nodep) override {
@ -548,7 +548,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
void visit(AstVarRef* nodep) override {
if (!nodep->varp()->attrSplitVar()) return; // Nothing to do
if (m_refs.tryAdd(m_contextp, nodep, m_inFTask)) {
if (m_refs.tryAdd(m_contextp, nodep, m_inFTaskp)) {
m_foundTargetVar.insert(nodep->varp());
}
m_refsForPackedSplit[m_modp].add(nodep);
@ -563,7 +563,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
if (indexp) { // OK
UINFO(4, "add " << nodep << " for " << refp->varp()->prettyName() << "\n");
if (indexp->toSInt() < outerMostSizeOfUnpackedArray(refp->varp())) {
m_refs.tryAdd(m_contextp, refp, nodep, indexp->toSInt(), m_inFTask);
m_refs.tryAdd(m_contextp, refp, nodep, indexp->toSInt(), m_inFTaskp);
} else {
warnNoSplit(refp->varp(), nodep->bitp(), "index is out of range");
m_refs.remove(refp->varp());
@ -590,7 +590,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
"Range check for AstSliceSel must have been finished in V3Width.cpp");
UINFO(4, "add " << nodep << " for " << refp->varp()->prettyName() << "\n");
m_refs.tryAdd(m_contextp, refp, nodep, nodep->declRange().hi(),
nodep->declRange().lo(), m_inFTask);
nodep->declRange().lo(), m_inFTaskp);
} else {
iterateChildren(nodep);
}

View File

@ -389,9 +389,9 @@ private:
}
void visit(AstScope* nodep) override {
UINFO(4, " SCOPE " << nodep << endl);
VL_RESTORER(m_scopep);
m_scopep = nodep;
iterateChildren(nodep);
m_scopep = nullptr;
}
void visit(AstAlways* nodep) override {
UINFO(4, " ALWAYS " << nodep << endl);

View File

@ -255,6 +255,9 @@ private:
}
void visit(AstClass* nodep) override {
// Move initial statements into the constructor
VL_RESTORER(m_initialps);
VL_RESTORER(m_ctorp);
VL_RESTORER(m_classp);
m_initialps.clear();
m_ctorp = nullptr;
m_classp = nodep;
@ -274,8 +277,6 @@ private:
VL_DO_DANGLING(pushDeletep(initialp->unlinkFrBack()), initialp);
}
m_initialps.clear();
m_ctorp = nullptr;
m_classp = nullptr;
}
void visit(AstInitialAutomatic* nodep) override {
m_initialps.push_back(nodep);
@ -1443,10 +1444,10 @@ class TaskVisitor final : public VNVisitor {
iterateChildren(nodep);
}
void visit(AstScope* nodep) override {
VL_RESTORER(m_scopep);
m_scopep = nodep;
m_insStmtp = nullptr;
iterateChildren(nodep);
m_scopep = nullptr;
}
void visit(AstNodeFTaskRef* nodep) override {
if (m_inSensesp) {

View File

@ -772,9 +772,9 @@ class TimingControlVisitor final : public VNVisitor {
}
}
void visit(AstActive* nodep) override {
VL_RESTORER(m_activep);
m_activep = nodep;
iterateChildren(nodep);
m_activep = nullptr;
}
void visit(AstNodeProcedure* nodep) override {
VL_RESTORER(m_procp);

View File

@ -893,9 +893,9 @@ class TraceVisitor final : public VNVisitor {
nodep->user1p(vertexp);
UASSERT_OBJ(m_cfuncp, nodep, "Trace not under func");
VL_RESTORER(m_tracep);
m_tracep = nodep;
iterateChildren(nodep);
m_tracep = nullptr;
}
}
void visit(AstVarRef* nodep) override {

View File

@ -5795,6 +5795,7 @@ class WidthVisitor final : public VNVisitor {
return;
}
nodep->doingWidth(true);
VL_RESTORER(m_ftaskp);
m_ftaskp = nodep;
// Property call will be replaced by property body in V3AssertPre. Property body has bit
// dtype, so set it here too
@ -5810,7 +5811,6 @@ class WidthVisitor final : public VNVisitor {
}
nodep->didWidth(true);
nodep->doingWidth(false);
m_ftaskp = nullptr;
}
void visit(AstReturn* nodep) override {
// IEEE: Assignment-like context