Improve V3Ast function usage ergonomics (#3650)

Signed-off-by: HungMingWu <[email protected]>
This commit is contained in:
HungMingWu
2022-10-21 14:12:12 +01:00
committed by Geza Lore
parent 627a144b83
commit 196f3292d5
30 changed files with 343 additions and 260 deletions
+4 -4
View File
@@ -138,7 +138,7 @@ private:
AstDelay* getLhsNetDelay(AstNodeAssign* nodep) const {
bool foundWrite = false;
AstDelay* delayp = nullptr;
nodep->lhsp()->foreach<AstNodeVarRef>([&](const AstNodeVarRef* const refp) {
nodep->lhsp()->foreach([&](const AstNodeVarRef* const refp) {
if (!refp->access().isWriteOrRW()) return;
UASSERT_OBJ(!foundWrite, nodep, "Should only be one variable written to on the LHS");
foundWrite = true;
@@ -190,7 +190,7 @@ private:
AstSenItem* varRefpsToSenItemsp(AstNode* const nodep) const {
AstNode* senItemsp = nullptr;
const VNUser4InUse user4InUse;
nodep->foreach<AstNodeVarRef>([&](AstNodeVarRef* refp) {
nodep->foreach([&](AstNodeVarRef* refp) {
if (refp->access().isWriteOnly()) return;
AstVarScope* const vscp = refp->varScopep();
if (vscp->user4SetOnce()) return;
@@ -530,12 +530,12 @@ private:
// we want as only the top level selects are LValues. As an example,
// this transforms 'x[a[i]][b[j]] = y'
// into 't1 = a[i]; t0 = b[j]; x[t1][t0] = y'.
nodep->lhsp()->foreach<AstSel>([&](AstSel* selp) {
nodep->lhsp()->foreach([&](AstSel* selp) {
if (VN_IS(selp->lsbp(), Const)) return;
replaceWithIntermediate(selp->lsbp(), m_intraLsbNames.get(nodep));
// widthp should be const
});
nodep->lhsp()->foreach<AstNodeSel>([&](AstNodeSel* selp) {
nodep->lhsp()->foreach([&](AstNodeSel* selp) {
if (VN_IS(selp->bitp(), Const)) return;
replaceWithIntermediate(selp->bitp(), m_intraIndexNames.get(nodep));
});