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
+7 -7
View File
@@ -178,9 +178,9 @@ private:
iterateAndNextNull(nodep->condp());
const uint32_t savedCount = m_instrCount;
UINFO(8, "ifsp:\n");
UINFO(8, "thensp:\n");
reset();
iterateAndNextNull(nodep->ifsp());
iterateAndNextNull(nodep->thensp());
uint32_t ifCount = m_instrCount;
if (nodep->branchPred().unlikely()) ifCount = 0;
@@ -196,7 +196,7 @@ private:
if (nodep->elsesp()) nodep->elsesp()->user4(0); // Don't dump it
} else {
m_instrCount = savedCount + elseCount;
if (nodep->ifsp()) nodep->ifsp()->user4(0); // Don't dump it
if (nodep->thensp()) nodep->thensp()->user4(0); // Don't dump it
}
}
void visit(AstNodeCond* nodep) override {
@@ -209,21 +209,21 @@ private:
UINFO(8, "?\n");
reset();
iterateAndNextNull(nodep->expr1p());
iterateAndNextNull(nodep->thenp());
const uint32_t ifCount = m_instrCount;
UINFO(8, ":\n");
reset();
iterateAndNextNull(nodep->expr2p());
iterateAndNextNull(nodep->elsep());
const uint32_t elseCount = m_instrCount;
reset();
if (ifCount < elseCount) {
m_instrCount = savedCount + elseCount;
if (nodep->expr1p()) nodep->expr1p()->user4(0); // Don't dump it
if (nodep->thenp()) nodep->thenp()->user4(0); // Don't dump it
} else {
m_instrCount = savedCount + ifCount;
if (nodep->expr2p()) nodep->expr2p()->user4(0); // Don't dump it
if (nodep->elsep()) nodep->elsep()->user4(0); // Don't dump it
}
}
void visit(AstCAwait* nodep) override {