Internals: Refactor generate construct Ast handling (#6280) (#6470)

Internals: Refactor generate construct Ast handling (#6280)

We introduce AstNodeGen, the common base class of AstGenBlock,
AstGenCase, AstGenFor, and AstGenIf, which together represent all SV
generate constructs. Subsequently remove AstNodeFor, AstNodeCase
(AstCase is now directly derived from AstNodeStmt) and adjust internals
to work on the new representation.

Output is identical modulo hashes do to changed AstNode type ids, no
functional change intended.

Step towards #6280.
This commit is contained in:
Geza Lore
2025-09-23 19:49:01 +01:00
committed by GitHub
parent df187c4406
commit 800af37975
42 changed files with 687 additions and 517 deletions
+2 -2
View File
@@ -194,7 +194,7 @@ struct SplitVarImpl VL_NOT_FINAL {
stmtp->unlinkFrBack();
// Insert begin-end because temp value may be inserted to this block later.
const std::string name = "__VsplitVarBlk" + cvtToStr(modp->user1Inc(1));
ap->addStmtsp(new AstBegin{ap->fileline(), name, stmtp, false, false});
ap->addStmtsp(new AstBegin{ap->fileline(), name, stmtp, false});
}
}
@@ -204,7 +204,7 @@ struct SplitVarImpl VL_NOT_FINAL {
// Insert begin-end because temp value may be inserted to this block later.
FileLine* const fl = initp->fileline();
const std::string name = "__VsplitVarBlk" + cvtToStr(modp->user1Inc(1));
initp->replaceWith(new AstInitial{fl, new AstBegin{fl, name, stmtp, false, false}});
initp->replaceWith(new AstInitial{fl, new AstBegin{fl, name, stmtp, false}});
VL_DO_DANGLING(initp->deleteTree(), initp);
}
}