Internals: Add some const etc. No functional change.

This commit is contained in:
Wilson Snyder 2021-10-05 19:42:31 -04:00
parent 55da66164b
commit 02aa639425
2 changed files with 9 additions and 7 deletions

View File

@ -923,8 +923,9 @@ private:
if (ccastp) {
andp->replaceWith(ccastp);
VL_DO_DANGLING(andp->deleteTree(), andp);
return true;
}
return ccastp;
return false;
}
static bool operandAndOrSame(const AstNode* nodep) {
@ -2217,8 +2218,8 @@ private:
void swapSides(AstNodeBiCom* nodep) {
// COMMUTATIVE({a},CONST) -> COMMUTATIVE(CONST,{a})
// This simplifies later optimizations
AstNode* lhsp = nodep->lhsp()->unlinkFrBackWithNext();
AstNode* rhsp = nodep->rhsp()->unlinkFrBackWithNext();
AstNode* const lhsp = nodep->lhsp()->unlinkFrBackWithNext();
AstNode* const rhsp = nodep->rhsp()->unlinkFrBackWithNext();
nodep->lhsp(rhsp);
nodep->rhsp(lhsp);
iterate(nodep); // Again?
@ -2227,8 +2228,8 @@ private:
int operandConcatMove(AstConcat* nodep) {
// CONCAT under concat (See moveConcat)
// Return value: true indicates to do it; 2 means move to LHS
AstConcat* abConcp = VN_CAST(nodep->lhsp(), Concat);
AstConcat* bcConcp = VN_CAST(nodep->rhsp(), Concat);
AstConcat* const abConcp = VN_CAST(nodep->lhsp(), Concat);
AstConcat* const bcConcp = VN_CAST(nodep->rhsp(), Concat);
if (!abConcp && !bcConcp) return 0;
if (bcConcp) {
AstNode* ap = nodep->lhsp();

View File

@ -2195,12 +2195,13 @@ private:
virtual void visit(AstInitArray* nodep) override {
// InitArray has type of the array; children are array values
if (m_vup->prelim()) { // First stage evaluation
AstNodeDType* vdtypep = m_vup->dtypep();
AstNodeDType* const vdtypep = m_vup->dtypeNullp();
UASSERT_OBJ(vdtypep, nodep, "InitArray type not assigned by AstPattern/Var visitor");
nodep->dtypep(vdtypep);
if (AstNodeArrayDType* arrayp = VN_CAST(vdtypep->skipRefp(), NodeArrayDType)) {
if (AstNodeArrayDType* const arrayp = VN_CAST(vdtypep->skipRefp(), NodeArrayDType)) {
userIterateChildren(nodep, WidthVP(arrayp->subDTypep(), BOTH).p());
} else {
UINFO(1, "dtype object " << vdtypep->skipRefp() << endl);
nodep->v3fatalSrc("InitArray on non-array");
}
}