mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 02:38:15 +02:00
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:
+6
-6
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user