astgen: Enforce the use of aliased operand accessors (#4688)

This patch enforces the use of the most specific accessors for operands
which have an '@astgen alias' declaration, by making the superclass
accessors of the same operands private. This ensures client code is
cleaner as you can't use multiple different methods to reference the
same operands (which we used to in some places). Also prep for some
refactoring.
This commit is contained in:
Geza Lore
2023-11-12 18:30:48 +00:00
committed by GitHub
parent 1c0af6c7bc
commit 47588f343b
13 changed files with 106 additions and 86 deletions
+4 -4
View File
@@ -731,7 +731,7 @@ private:
} else {
if (isImpure(nodep)) return;
FileLine* const fl = nodep->fileline();
AstNodeExpr* lhsp = nodep->lhsp()->unlinkFrBack();
AstNodeExpr* lhsp = nodep->srcp()->unlinkFrBack();
AstNodeExpr* newp;
const int lhswidth = lhsp->widthMin();
if (lhswidth == 1) {
@@ -739,7 +739,7 @@ private:
newp = new AstNegate{fl, lhsp};
} else {
UINFO(8, " REPLICATE " << nodep << endl);
const AstConst* const constp = VN_AS(nodep->rhsp(), Const);
const AstConst* const constp = VN_AS(nodep->countp(), Const);
UASSERT_OBJ(constp, nodep,
"Replication value isn't a constant. Checked earlier!");
const uint32_t times = constp->toUInt();
@@ -765,9 +765,9 @@ private:
UINFO(8, " Wordize ASSIGN(REPLICATE) " << nodep << endl);
if (!doExpandWide(rhsp)) return false;
FileLine* const fl = nodep->fileline();
AstNodeExpr* const lhsp = rhsp->lhsp();
AstNodeExpr* const lhsp = rhsp->srcp();
const int lhswidth = lhsp->widthMin();
const AstConst* const constp = VN_AS(rhsp->rhsp(), Const);
const AstConst* const constp = VN_AS(rhsp->countp(), Const);
UASSERT_OBJ(constp, rhsp, "Replication value isn't a constant. Checked earlier!");
const uint32_t times = constp->toUInt();
for (int w = 0; w < rhsp->widthWords(); ++w) {