Strengthen AstNode types to AstNodeExpr

Declare every AstNode children and variables as AstNodeExpr where we
statically know this is the appropriate sub-type.
This commit is contained in:
Geza Lore
2022-11-20 19:31:28 +00:00
parent 352d0b4582
commit 3abb65d732
52 changed files with 1742 additions and 1572 deletions
+4 -4
View File
@@ -336,7 +336,7 @@ private:
AstNode* createLookupInput(FileLine* fl, AstVarScope* indexVscp) {
// Concat inputs into a single temp variable (inside always)
// First var in inVars becomes the LSB of the concat
AstNode* concatp = nullptr;
AstNodeExpr* concatp = nullptr;
for (AstVarScope* invscp : m_inVarps) {
AstVarRef* const refp = new AstVarRef{fl, invscp, VAccess::READ};
if (concatp) {
@@ -359,8 +359,8 @@ private:
AstVarScope* outputAssignedTableVscp) {
FileLine* const fl = nodep->fileline();
for (TableOutputVar& tov : m_outVarps) {
AstNode* const alhsp = new AstVarRef{fl, tov.varScopep(), VAccess::WRITE};
AstNode* const arhsp = select(fl, tov.tabeVarScopep(), indexVscp);
AstNodeExpr* const alhsp = new AstVarRef{fl, tov.varScopep(), VAccess::WRITE};
AstNodeExpr* const arhsp = select(fl, tov.tabeVarScopep(), indexVscp);
AstNode* outsetp = m_assignDly
? static_cast<AstNode*>(new AstAssignDly{fl, alhsp, arhsp})
: static_cast<AstNode*>(new AstAssign{fl, alhsp, arhsp});
@@ -369,7 +369,7 @@ private:
if (tov.mayBeUnassigned()) {
V3Number outputChgMask{nodep, static_cast<int>(m_outVarps.size()), 0};
outputChgMask.setBit(tov.ord(), 1);
AstNode* const condp
AstNodeExpr* const condp
= new AstAnd{fl, select(fl, outputAssignedTableVscp, indexVscp),
new AstConst{fl, outputChgMask}};
outsetp = new AstIf{fl, condp, outsetp};