Internals: Use Var::isConst to allow constant substitution

This commit is contained in:
Wilson Snyder
2026-02-01 21:06:26 -05:00
parent c1e343d9cf
commit 407fc74195
6 changed files with 11 additions and 12 deletions
+2
View File
@@ -917,6 +917,7 @@ void addMTaskToFunction(const ThreadSchedule& schedule, const uint32_t threadId,
AstBasicDType* const s_mtaskStateDtypep
= v3Global.rootp()->typeTablep()->findBasicDType(fl, VBasicDTypeKwd::MTASKSTATE);
AstVar* const varp = new AstVar{fl, VVarType::MODULETEMP, name, s_mtaskStateDtypep};
varp->isConst(true);
varp->valuep(new AstConst{fl, nDependencies});
varp->protect(false); // Do not protect as we have references in text
modp->addStmtsp(varp);
@@ -998,6 +999,7 @@ const std::vector<AstCFunc*> createThreadFunctions(const ThreadSchedule& schedul
AstVar* const varp = new AstVar{fl, VVarType::MODULETEMP,
"__Vm_mtaskstate_final__" + cvtToStr(schedule.id()) + tag,
s_mtaskStateDtypep};
varp->isConst(true);
varp->valuep(new AstConst(fl, funcps.size()));
varp->protect(false); // Do not protect as we have references in text
modp->addStmtsp(varp);