Generate AstNode accessors via astgen

Introduce the @astgen directives parsed by astgen, currently used for
the generation child node (operand) accessors. Please see the updated
internal documentation for details.
This commit is contained in:
Geza Lore
2022-09-21 14:05:27 +01:00
parent 72e7271a14
commit 95145038b4
74 changed files with 1427 additions and 1579 deletions
+6 -6
View File
@@ -69,7 +69,7 @@ private:
underp = VN_AS(nodep, NodeFTask)->stmtsp();
} else if (VN_IS(nodep, Foreach)) {
if (endOfIter) {
underp = VN_AS(nodep, Foreach)->bodysp();
underp = VN_AS(nodep, Foreach)->stmtsp();
} else {
underp = nodep;
under_and_next = false; // IE we skip the entire foreach
@@ -78,7 +78,7 @@ private:
if (endOfIter) {
// Note we jump to end of bodysp; a FOR loop has its
// increment under incsp() which we don't skip
underp = VN_AS(nodep, While)->bodysp();
underp = VN_AS(nodep, While)->stmtsp();
} else {
underp = nodep;
under_and_next = false; // IE we skip the entire while
@@ -157,7 +157,7 @@ private:
AstVar* const varp
= new AstVar(nodep->fileline(), VVarType::BLOCKTEMP, name, nodep->findSigned32DType());
varp->usedLoopIdx(true);
m_modp->addStmtp(varp);
m_modp->addStmtsp(varp);
AstNode* initsp = new AstAssign(
nodep->fileline(), new AstVarRef(nodep->fileline(), varp, VAccess::WRITE), countp);
AstNode* const decp = new AstAssign(
@@ -167,7 +167,7 @@ private:
AstNode* const zerosp = new AstConst(nodep->fileline(), AstConst::Signed32(), 0);
AstNode* const condp = new AstGtS(
nodep->fileline(), new AstVarRef(nodep->fileline(), varp, VAccess::READ), zerosp);
AstNode* const bodysp = nodep->bodysp();
AstNode* const bodysp = nodep->stmtsp();
if (bodysp) bodysp->unlinkFrBackWithNext();
AstNode* newp = new AstWhile(nodep->fileline(), condp, bodysp, decp);
initsp = initsp->addNext(newp);
@@ -184,7 +184,7 @@ private:
m_loopInc = false;
iterateAndNextNull(nodep->precondsp());
iterateAndNextNull(nodep->condp());
iterateAndNextNull(nodep->bodysp());
iterateAndNextNull(nodep->stmtsp());
m_loopInc = true;
iterateAndNextNull(nodep->incsp());
}
@@ -193,7 +193,7 @@ private:
VL_RESTORER(m_loopp);
{
m_loopp = nodep;
iterateAndNextNull(nodep->bodysp());
iterateAndNextNull(nodep->stmtsp());
}
}
void visit(AstReturn* nodep) override {