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
@@ -289,7 +289,7 @@ class LinkJumpVisitor final : public VNVisitor {
// Note var can be signed or unsigned based on original number.
AstNodeExpr* const countp = nodep->countp()->unlinkFrBackWithNext();
const string name = "__Vrepeat"s + cvtToStr(m_modRepeatNum++);
AstBegin* const beginp = new AstBegin{nodep->fileline(), "", nullptr, false, true};
AstBegin* const beginp = new AstBegin{nodep->fileline(), "", nullptr, true};
// Spec says value is integral, if negative is ignored
AstVar* const varp
= new AstVar{nodep->fileline(), VVarType::BLOCKTEMP, name, nodep->findSigned32DType()};
@@ -425,7 +425,7 @@ class LinkJumpVisitor final : public VNVisitor {
// Further handling of disable stmt requires all forks to be begin blocks
AstBegin* beginp = VN_CAST(forkItemp, Begin);
if (!beginp) {
beginp = new AstBegin{fl, "", nullptr, false, false};
beginp = new AstBegin{fl, "", nullptr, false};
forkItemp->replaceWith(beginp);
beginp->addStmtsp(forkItemp);
// In order to continue the iteration