Internals: Avoid extra op#() calls. No functional change intended.

This commit is contained in:
Wilson Snyder 2025-03-16 14:34:19 -04:00
parent 21eb43a554
commit 780163b91e
6 changed files with 26 additions and 26 deletions

View File

@ -95,10 +95,10 @@ private:
if (const AstVarRef* varrefp = VN_CAST(nodep, VarRef)) {
if (varp == varrefp->varp()) nodep->replaceWith(exprp->cloneTree(false));
}
replaceVarRefsWithExprRecurse(nodep->op1p(), varp, exprp);
replaceVarRefsWithExprRecurse(nodep->op2p(), varp, exprp);
replaceVarRefsWithExprRecurse(nodep->op3p(), varp, exprp);
replaceVarRefsWithExprRecurse(nodep->op4p(), varp, exprp);
if (AstNode* const refp = nodep->op1p()) replaceVarRefsWithExprRecurse(refp, varp, exprp);
if (AstNode* const refp = nodep->op2p()) replaceVarRefsWithExprRecurse(refp, varp, exprp);
if (AstNode* const refp = nodep->op3p()) replaceVarRefsWithExprRecurse(refp, varp, exprp);
if (AstNode* const refp = nodep->op4p()) replaceVarRefsWithExprRecurse(refp, varp, exprp);
}
AstPropSpec* substitutePropertyCall(AstPropSpec* nodep) {
if (AstFuncRef* const funcrefp = VN_CAST(nodep->propp(), FuncRef)) {

View File

@ -147,10 +147,10 @@ class ExpandVisitor final : public VNVisitor {
// but are now being used on the RHS of the assignment
if (VN_IS(nodep, VarRef)) VN_AS(nodep, VarRef)->access(VAccess::READ);
// Iterate
if (nodep->op1p()) fixCloneLvalue(nodep->op1p());
if (nodep->op2p()) fixCloneLvalue(nodep->op2p());
if (nodep->op3p()) fixCloneLvalue(nodep->op3p());
if (nodep->op4p()) fixCloneLvalue(nodep->op4p());
if (AstNode* const refp = nodep->op1p()) fixCloneLvalue(refp);
if (AstNode* const refp = nodep->op2p()) fixCloneLvalue(refp);
if (AstNode* const refp = nodep->op3p()) fixCloneLvalue(refp);
if (AstNode* const refp = nodep->op4p()) fixCloneLvalue(refp);
}
static AstNodeExpr* newAstWordSelClone(AstNodeExpr* nodep, int word) {

View File

@ -1783,11 +1783,11 @@ class LinkDotParamVisitor final : public VNVisitor {
// These are perhaps a little too generous, as a SELect of siga[sigb]
// perhaps shouldn't create an implicit variable. But, we've warned...
else {
if (nodep->op1p()) pinImplicitExprRecurse(nodep->op1p());
if (nodep->op2p()) pinImplicitExprRecurse(nodep->op2p());
if (nodep->op3p()) pinImplicitExprRecurse(nodep->op3p());
if (nodep->op4p()) pinImplicitExprRecurse(nodep->op4p());
if (nodep->nextp()) pinImplicitExprRecurse(nodep->nextp());
if (AstNode* const refp = nodep->op1p()) pinImplicitExprRecurse(refp);
if (AstNode* const refp = nodep->op2p()) pinImplicitExprRecurse(refp);
if (AstNode* const refp = nodep->op3p()) pinImplicitExprRecurse(refp);
if (AstNode* const refp = nodep->op4p()) pinImplicitExprRecurse(refp);
if (AstNode* const refp = nodep->nextp()) pinImplicitExprRecurse(refp);
}
}

View File

@ -153,11 +153,11 @@ class LinkJumpVisitor final : public VNVisitor {
if (beginp->name() != "") beginp->name(prefix + beginp->name());
}
if (nodep->op1p()) addPrefixToBlocksRecurse(prefix, nodep->op1p());
if (nodep->op2p()) addPrefixToBlocksRecurse(prefix, nodep->op2p());
if (nodep->op3p()) addPrefixToBlocksRecurse(prefix, nodep->op3p());
if (nodep->op4p()) addPrefixToBlocksRecurse(prefix, nodep->op4p());
if (nodep->nextp()) addPrefixToBlocksRecurse(prefix, nodep->nextp());
if (AstNode* const refp = nodep->op1p()) addPrefixToBlocksRecurse(prefix, refp);
if (AstNode* const refp = nodep->op2p()) addPrefixToBlocksRecurse(prefix, refp);
if (AstNode* const refp = nodep->op3p()) addPrefixToBlocksRecurse(prefix, refp);
if (AstNode* const refp = nodep->op4p()) addPrefixToBlocksRecurse(prefix, refp);
if (AstNode* const refp = nodep->nextp()) addPrefixToBlocksRecurse(prefix, refp);
}
// VISITORS

View File

@ -302,10 +302,10 @@ public:
TristateVertex* const vertexp = reinterpret_cast<TristateVertex*>(nodep->user4p());
if (vertexp) vertexp->unlinkDelete(&m_graph);
}
deleteVerticesFromSubtreeRecurse(nodep->op1p());
deleteVerticesFromSubtreeRecurse(nodep->op2p());
deleteVerticesFromSubtreeRecurse(nodep->op3p());
deleteVerticesFromSubtreeRecurse(nodep->op4p());
if (AstNode* const refp = nodep->op1p()) deleteVerticesFromSubtreeRecurse(refp);
if (AstNode* const refp = nodep->op2p()) deleteVerticesFromSubtreeRecurse(refp);
if (AstNode* const refp = nodep->op3p()) deleteVerticesFromSubtreeRecurse(refp);
if (AstNode* const refp = nodep->op4p()) deleteVerticesFromSubtreeRecurse(refp);
}
void setTristate(AstNode* nodep) { makeVertex(nodep)->isTristate(true); }
bool isTristate(AstNode* nodep) {

View File

@ -183,10 +183,10 @@ class WidthClearVisitor final {
void clearWidthRecurse(AstNode* nodep) {
for (; nodep; nodep = nodep->nextp()) {
nodep->didWidth(false);
if (nodep->op1p()) clearWidthRecurse(nodep->op1p());
if (nodep->op2p()) clearWidthRecurse(nodep->op2p());
if (nodep->op3p()) clearWidthRecurse(nodep->op3p());
if (nodep->op4p()) clearWidthRecurse(nodep->op4p());
if (AstNode* const refp = nodep->op1p()) clearWidthRecurse(refp);
if (AstNode* const refp = nodep->op2p()) clearWidthRecurse(refp);
if (AstNode* const refp = nodep->op3p()) clearWidthRecurse(refp);
if (AstNode* const refp = nodep->op4p()) clearWidthRecurse(refp);
}
}