From dca504c706a3f6c1e33be92a9bff679aef9a584e Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 2 Aug 2025 13:44:40 -0400 Subject: [PATCH] Internals: Use UINFOTREE istead of dumpTree --- src/V3Assert.cpp | 2 +- src/V3Begin.cpp | 4 +- src/V3Case.cpp | 14 +++--- src/V3Cast.cpp | 2 +- src/V3Clock.cpp | 2 +- src/V3Const.cpp | 68 +++++++++++++------------- src/V3Depth.cpp | 2 +- src/V3DepthBlock.cpp | 6 +-- src/V3Descope.cpp | 2 +- src/V3Error.h | 5 +- src/V3Gate.cpp | 2 +- src/V3Inline.cpp | 3 +- src/V3Inst.cpp | 10 ++-- src/V3Life.cpp | 2 +- src/V3LinkDot.cpp | 20 ++++---- src/V3LinkInc.cpp | 4 +- src/V3LinkResolve.cpp | 6 +-- src/V3Param.cpp | 8 +-- src/V3Randomize.cpp | 2 +- src/V3Reloop.cpp | 4 +- src/V3Simulate.h | 2 +- src/V3Slice.cpp | 6 +-- src/V3Split.cpp | 4 +- src/V3SplitAs.cpp | 6 +-- src/V3Subst.cpp | 4 +- src/V3Table.cpp | 2 +- src/V3Task.cpp | 14 +++--- src/V3Trace.cpp | 2 +- src/V3Tristate.cpp | 36 +++++++------- src/V3Unknown.cpp | 22 ++++----- src/V3Unroll.cpp | 8 +-- src/V3Width.cpp | 111 +++++++++++++++++++++--------------------- src/V3WidthCommit.cpp | 4 +- src/V3WidthSel.cpp | 36 +++++++------- 34 files changed, 214 insertions(+), 211 deletions(-) diff --git a/src/V3Assert.cpp b/src/V3Assert.cpp index bd1423034..57ca6092b 100644 --- a/src/V3Assert.cpp +++ b/src/V3Assert.cpp @@ -473,7 +473,7 @@ class AssertVisitor final : public VNVisitor { AstNode* const assp = new AstAssignDly{ nodep->fileline(), new AstVarRef{nodep->fileline(), outvarp, VAccess::WRITE}, inp}; alwaysp->addStmtsp(assp); - // if (debug() >= 9) assp->dumpTree("- ass: "); + // UINFOTREE(9, assp, "", "ass"); invarp = outvarp; inp = new AstVarRef{nodep->fileline(), invarp, VAccess::READ}; } diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index b1f5ce772..2a9733bf1 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -423,7 +423,7 @@ static AstNode* createForeachLoopRanged(AstNodeForeach* nodep, AstNode* bodysp, : VNType::atGteS); } AstNode* V3Begin::convertToWhile(AstForeach* nodep) { - // if (debug()) dumpTree("- foreach-old: "); + // UINFOTREE(1, nodep, "", "foreach-old"); const AstSelLoopVars* const loopsp = VN_CAST(nodep->arrayp(), SelLoopVars); UASSERT_OBJ(loopsp, nodep, "No loop variables under foreach"); AstNodeExpr* const fromp = loopsp->fromp(); @@ -542,6 +542,6 @@ AstNode* V3Begin::convertToWhile(AstForeach* nodep) { } VL_DO_DANGLING(bodyPointp->deleteTree(), bodyPointp); VL_DO_DANGLING(nodep->deleteTree(), nodep); - // if (debug()) newp->dumpTreeAndNext(cout, "- foreach-new: "); + // UINFOTREE(1, newp, "", "foreach-new"); return newp; } diff --git a/src/V3Case.cpp b/src/V3Case.cpp index c0b3f8648..1c13b744a 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -201,7 +201,7 @@ class CaseVisitor final : public VNVisitor { for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp = VN_AS(itemp->nextp(), CaseItem)) { for (AstNode* icondp = itemp->condsp(); icondp; icondp = icondp->nextp()) { - // if (debug() >= 9) icondp->dumpTree("- caseitem: "); + // UINFOTREE(9, icondp, "", "caseitem"); AstConst* const iconstp = VN_AS(icondp, Const); UASSERT_OBJ(iconstp, nodep, "above 'can't parse' should have caught this"); if (neverItem(nodep, iconstp)) { @@ -396,7 +396,7 @@ class CaseVisitor final : public VNVisitor { } VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(cexprp->deleteTree(), cexprp); - if (debug() >= 9) ifrootp->dumpTree("- _simp: "); + UINFOTREE(9, ifrootp, "", "_simp"); } void replaceCaseComplicated(AstCase* nodep) { @@ -407,7 +407,7 @@ class CaseVisitor final : public VNVisitor { AstNodeExpr* const cexprp = nodep->exprp()->unlinkFrBack(); // We'll do this in two stages. First stage, convert the conditions to // the appropriate IF AND terms. - if (debug() >= 9) nodep->dumpTree("- _comp_IN::: "); + UINFOTREE(9, nodep, "", "_comp_IN::"); bool hadDefault = false; for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp = VN_AS(itemp->nextp(), CaseItem)) { @@ -474,7 +474,7 @@ class CaseVisitor final : public VNVisitor { nodep->addItemsp(new AstCaseItem{ nodep->fileline(), new AstConst{nodep->fileline(), AstConst::BitTrue{}}, nullptr}); } - if (debug() >= 9) nodep->dumpTree("- _comp_COND: "); + UINFOTREE(9, nodep, "", "_comp_COND"); // Now build the IF statement tree // The tree can be quite huge. Pull ever group of 8 out, and make a OR tree. // This reduces the depth for the bottom elements, at the cost of @@ -524,12 +524,12 @@ class CaseVisitor final : public VNVisitor { itemnextp = newp; } } - if (debug() >= 9) nodep->dumpTree("- _comp_TREE: "); + UINFOTREE(9, nodep, "", "_comp_TREE"); // Handle any assertions replaceCaseParallel(nodep, false); // Replace the CASE... with IF... - if (debug() >= 9 && grouprootp) grouprootp->dumpTree("- _new: "); if (grouprootp) { + UINFOTREE(9, grouprootp, "", "_new"); nodep->replaceWith(grouprootp); } else { nodep->unlinkFrBack(); @@ -563,7 +563,7 @@ class CaseVisitor final : public VNVisitor { void visit(AstCase* nodep) override { V3Case::caseLint(nodep); iterateChildren(nodep); - if (debug() >= 9) nodep->dumpTree("- case_old: "); + UINFOTREE(9, nodep, "", "case_old"); if (isCaseTreeFast(nodep) && v3Global.opt.fCase()) { // It's a simple priority encoder or complete statement // we can make a tree of statements to avoid extra comparisons diff --git a/src/V3Cast.cpp b/src/V3Cast.cpp index 9795de230..9a2972e96 100644 --- a/src/V3Cast.cpp +++ b/src/V3Cast.cpp @@ -64,7 +64,7 @@ class CastVisitor final : public VNVisitor { = new AstCCast{nodep->fileline(), nodep, needsize, nodep->widthMin()}; UINFO(4, " MadeCast " << static_cast(castp) << " for " << nodep); relinkHandle.relink(castp); - // if (debug() > 8) castp->dumpTree("- castins: "); + // UINFOTREE(9, castp, "", "castins"); // ensureLower32Cast(castp); nodep->user1(1); // Now must be of known size diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index b9d2e2c6f..7dc65f903 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -97,7 +97,7 @@ class ClockVisitor final : public VNVisitor { } // VISITORS void visit(AstCoverToggle* nodep) override { - // if (debug()) nodep->dumpTree("- ct: "); + // UINFOTREE(1, nodep, "", "ct"); // COVERTOGGLE(INC, ORIG, CHANGE) -> // IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; } AstNode* const incp = nodep->incp()->unlinkFrBack(); diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 058bf0493..3c5e568c1 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -396,7 +396,7 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst { if (fail && !m_failed) { UINFO(9, "cannot optimize " << m_rootp << " reason:" << reason << " called from line:" << line << " when checking:" << nodep); - // if (debug() >= 9) m_rootp->dumpTree("- root: "); + // UINFOTREE(9, m_rootp, "", "root"); m_failed = true; } return m_failed; @@ -1334,12 +1334,12 @@ class ConstVisitor final : public VNVisitor { // Add or any operation which doesn't care if we discard top bits AstNodeBiop* const bip = VN_CAST(nodep->fromp(), NodeBiop); if (!(m_doV && bip && VN_IS(nodep->lsbp(), Const) && nodep->lsbConst() == 0)) return false; - if (debug() >= 9) nodep->dumpTree("- SEL(BI)-in: "); + UINFOTREE(9, nodep, "", "SEL(BI)-in"); AstNodeExpr* const bilhsp = bip->lhsp()->unlinkFrBack(); AstNodeExpr* const birhsp = bip->rhsp()->unlinkFrBack(); bip->lhsp(new AstSel{nodep->fileline(), bilhsp, 0, nodep->widthConst()}); bip->rhsp(new AstSel{nodep->fileline(), birhsp, 0, nodep->widthConst()}); - if (debug() >= 9) bip->dumpTree("- SEL(BI)-ou: "); + UINFOTREE(9, bip, "", "SEL(BI)-ou"); VL_DO_DANGLING(replaceWChild(nodep, bip), nodep); return true; } @@ -1362,11 +1362,11 @@ class ConstVisitor final : public VNVisitor { if (newLsb + nodep->widthConst() > ap->width()) return false; // UINFO(9, "SEL(SHIFTR(a,b),l,w) -> SEL(a,l+b,w)"); - if (debug() >= 9) nodep->dumpTree("- SEL(SH)-in: "); + UINFOTREE(9, nodep, "", "SEL(SH)-in"); AstSel* const newp = new AstSel{nodep->fileline(), ap->unlinkFrBack(), newLsb, nodep->widthConst()}; nodep->replaceWithKeepDType(newp); - if (debug() >= 9) newp->dumpTree("- SEL(SH)-ou: "); + UINFOTREE(9, newp, "", "SEL(SH)-ou"); VL_DO_DANGLING(pushDeletep(nodep), nodep); return true; } @@ -1384,7 +1384,7 @@ class ConstVisitor final : public VNVisitor { if (!constp) return false; if (!constp->num().isBitsZero(constp->width() - 1, subsize)) return false; // - if (debug() >= 9) nodep->dumpTree("- BI(EXTEND)-in: "); + UINFOTREE(9, nodep, "", "BI(EXTEND)-in"); smallerp->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(extendp->unlinkFrBack()), extendp); // aka nodep->lhsp. nodep->rhsp(smallerp); @@ -1393,7 +1393,7 @@ class ConstVisitor final : public VNVisitor { V3Number num{constp, subsize, constp->num()}; nodep->lhsp(new AstConst{constp->fileline(), num}); VL_DO_DANGLING(pushDeletep(constp), constp); - if (debug() >= 9) nodep->dumpTree("- BI(EXTEND)-ou: "); + UINFOTREE(9, nodep, "", "BI(EXTEND)-ou"); return true; } bool operandBiExtendConstOver(const AstNodeBiop* nodep) { @@ -1588,8 +1588,8 @@ class ConstVisitor final : public VNVisitor { "Already constant??"); AstNode* const newp = new AstConst{oldp->fileline(), num}; oldp->replaceWithKeepDType(newp); - if (debug() > 5) oldp->dumpTree("- const_old: "); - if (debug() > 5) newp->dumpTree("- _new: "); + UINFOTREE(6, oldp, "", "const_old"); + UINFOTREE(6, newp, "", "_new"); VL_DO_DANGLING(pushDeletep(oldp), oldp); } void replaceNum(AstNode* nodep, uint32_t val) { @@ -1663,8 +1663,8 @@ class ConstVisitor final : public VNVisitor { // Replace oldp node with a constant set to specified value UASSERT(oldp, "Null old"); AstNode* const newp = new AstConst{oldp->fileline(), AstConst::String{}, num}; - if (debug() > 5) oldp->dumpTree("- const_old: "); - if (debug() > 5) newp->dumpTree("- _new: "); + UINFOTREE(6, oldp, "", "const_old"); + UINFOTREE(6, newp, "", "_new"); oldp->replaceWithKeepDType(newp); VL_DO_DANGLING(pushDeletep(oldp), oldp); } @@ -1721,7 +1721,7 @@ class ConstVisitor final : public VNVisitor { void replaceAsv(AstNodeBiop* nodep) { // BIASV(CONSTa, BIASV(CONSTb, c)) -> BIASV( BIASV_CONSTED(a,b), c) // BIASV(SAMEa, BIASV(SAMEb, c)) -> BIASV( BIASV(SAMEa,SAMEb), c) - // if (debug()) nodep->dumpTree("- repAsvConst_old: "); + // UINFOTREE(1, nodep, "", "repAsvConst_old"); AstNodeExpr* const ap = nodep->lhsp(); AstNodeBiop* const rp = VN_AS(nodep->rhsp(), NodeBiop); AstNodeExpr* const bp = rp->lhsp(); @@ -1736,7 +1736,7 @@ class ConstVisitor final : public VNVisitor { rp->rhsp(bp); rp->dtypeFrom(nodep); // Upper widthMin more likely correct if (VN_IS(rp->lhsp(), Const) && VN_IS(rp->rhsp(), Const)) replaceConst(rp); - // if (debug()) nodep->dumpTree("- repAsvConst_new: "); + // UINFOTREE(1, nodep, "", "repAsvConst_new"); } void replaceAsvLUp(AstNodeBiop* nodep) { // BIASV(BIASV(CONSTll,lr),r) -> BIASV(CONSTll,BIASV(lr,r)) @@ -1749,7 +1749,7 @@ class ConstVisitor final : public VNVisitor { lp->lhsp(lrp); lp->rhsp(rp); lp->dtypeFrom(nodep); // Upper widthMin more likely correct - // if (debug()) nodep->dumpTree("- repAsvLUp_new: "); + // UINFOTREE(1, nodep, "", "repAsvLUp_new"); } void replaceAsvRUp(AstNodeBiop* nodep) { // BIASV(l,BIASV(CONSTrl,rr)) -> BIASV(CONSTrl,BIASV(l,rr)) @@ -1762,7 +1762,7 @@ class ConstVisitor final : public VNVisitor { rp->lhsp(lp); rp->rhsp(rrp); rp->dtypeFrom(nodep); // Upper widthMin more likely correct - // if (debug()) nodep->dumpTree("- repAsvRUp_new: "); + // UINFOTREE(1, nodep, "", "repAsvRUp_new"); } void replaceAndOr(AstNodeBiop* nodep) { // OR (AND (CONSTll,lr), AND(CONSTrl==ll,rr)) -> AND (CONSTll, OR(lr,rr)) @@ -1795,7 +1795,7 @@ class ConstVisitor final : public VNVisitor { } else { nodep->v3fatalSrc("replaceAndOr on something operandAndOrSame shouldn't have matched"); } - // if (debug()) nodep->dumpTree("- repAndOr_new: "); + // UINFOTREE(1, nodep, "", "repAndOr_new"); } void replaceShiftSame(AstNodeBiop* nodep) { // Or(Shift(ll,CONSTlr),Shift(rl,CONSTrr==lr)) -> Shift(Or(ll,rl),CONSTlr) @@ -1814,7 +1814,7 @@ class ConstVisitor final : public VNVisitor { nodep->dtypep(llp->dtypep()); // dtype of Biop is before shift. VL_DO_DANGLING(pushDeletep(rp), rp); VL_DO_DANGLING(pushDeletep(rrp), rrp); - // if (debug()) nodep->dumpTree("- repShiftSame_new: "); + // UINFOTREE(1, nodep, "", "repShiftSame_new"); } void replaceConcatSel(AstConcat* nodep) { // {a[1], a[0]} -> a[1:0] @@ -1940,7 +1940,7 @@ class ConstVisitor final : public VNVisitor { } void replaceShiftShift(AstNodeBiop* nodep) { UINFO(4, "SHIFT(SHIFT(a,s1),s2)->SHIFT(a,ADD(s1,s2)) " << nodep); - if (debug() >= 9) nodep->dumpTree("- repShiftShift_old: "); + UINFOTREE(9, nodep, "", "repShiftShift_old"); AstNodeBiop* const lhsp = VN_AS(nodep->lhsp(), NodeBiop); lhsp->unlinkFrBack(); AstNodeExpr* const ap = lhsp->lhsp()->unlinkFrBack(); @@ -1992,7 +1992,7 @@ class ConstVisitor final : public VNVisitor { newp = new AstAnd{nodep->fileline(), newp, new AstConst{nodep->fileline(), mask}}; nodep->replaceWithKeepDType(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); - // if (debug()) newp->dumpTree("- repShiftShift_new: "); + // UINFOTREE(1, newp, "", "repShiftShift_new"); iterate(newp); // Further reduce, either node may have more reductions. } VL_DO_DANGLING(pushDeletep(lhsp), lhsp); @@ -2035,8 +2035,8 @@ class ConstVisitor final : public VNVisitor { const bool lsbFirstAssign = (con1p->toUInt() < con2p->toUInt()); UINFO(4, "replaceAssignMultiSel " << nodep); UINFO(4, " && " << nextp); - // if (debug()) nodep->dumpTree("- comb1: "); - // if (debug()) nextp->dumpTree("- comb2: "); + // UINFOTREE(1, nodep, "", "comb1"); + // UINFOTREE(1, nextp, "", "comb2"); AstNodeExpr* const rhs1p = nodep->rhsp()->unlinkFrBack(); AstNodeExpr* const rhs2p = nextp->rhsp()->unlinkFrBack(); AstNodeAssign* newp; @@ -2049,7 +2049,7 @@ class ConstVisitor final : public VNVisitor { sel2p->lsbConst(), sel1p->width() + sel2p->width()}, new AstConcat{rhs1p->fileline(), rhs1p, rhs2p}); } - // if (debug()) pnewp->dumpTree("- conew: "); + // UINFOTREE(1, pnewp, "", "conew"); nodep->replaceWith(newp); // dypep intentionally changing VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nextp->unlinkFrBack()), nextp); @@ -2133,7 +2133,7 @@ class ConstVisitor final : public VNVisitor { // ASSIGN(CONCAT(lc1,lc2),rhs) -> ASSIGN(lc1,SEL(rhs,{size})), // ASSIGN(lc2,SEL(newrhs,{size})) } - if (debug() >= 9) nodep->dumpTree("- Ass_old: "); + UINFOTREE(9, nodep, "", "Ass_old"); // Unlink the stuff AstNodeExpr* const lc1p = VN_AS(nodep->lhsp(), Concat)->lhsp()->unlinkFrBack(); AstNodeExpr* const lc2p = VN_AS(nodep->lhsp(), Concat)->rhsp()->unlinkFrBack(); @@ -2369,7 +2369,7 @@ class ConstVisitor final : public VNVisitor { return true; } void replaceBoolShift(AstNode* nodep) { - if (debug() >= 9) nodep->dumpTree("- bshft_old: "); + UINFOTREE(9, nodep, "", "bshft_old"); AstConst* const andConstp = VN_AS(VN_AS(nodep, And)->lhsp(), Const); AstNodeExpr* const fromp = VN_AS(VN_AS(nodep, And)->rhsp(), ShiftR)->lhsp()->unlinkFrBack(); @@ -2383,7 +2383,7 @@ class ConstVisitor final : public VNVisitor { newp->dtypeSetLogicSized(nodep->width(), VSigning::UNSIGNED); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); - if (debug() >= 9) newp->dumpTree("- _new: "); + UINFOTREE(9, newp, "", "_new"); } void replaceWithSimulation(AstNode* nodep) { @@ -2796,7 +2796,7 @@ class ConstVisitor final : public VNVisitor { UASSERT_OBJ(nodep->varp(), nodep, "Not linked"); bool did = false; if (m_doV && nodep->varp()->valuep() && !m_attrp) { - // if (debug()) valuep->dumpTree("- visitvaref: "); + // UINFOTREE(1, valuep, "", "visitvaref"); iterateAndNextNull(nodep->varp()->valuep()); // May change nodep->varp()->valuep() AstNode* const valuep = nodep->varp()->valuep(); if (nodep->access().isReadOnly() @@ -2859,7 +2859,7 @@ class ConstVisitor final : public VNVisitor { UASSERT_OBJ(nodep->itemp(), nodep, "Not linked"); bool did = false; if (nodep->itemp()->valuep()) { - // if (debug()) nodep->itemp()->valuep()->dumpTree("- visitvaref: "); + // UINFOTREE(1, nodep->itemp()->valuep(), "", "visitvaref"); if (nodep->itemp()->user4()) { nodep->v3error("Recursive enum value: " << nodep->itemp()->prettyNameQ()); } else { @@ -3003,7 +3003,7 @@ class ConstVisitor final : public VNVisitor { void visit(AstSenTree* nodep) override { iterateChildren(nodep); if (m_doExpensive) { - // if (debug()) nodep->dumpTree("- ssin: "); + // UINFOTREE(1, nodep, "", "ssin"); // Optimize ideas for the future: // SENTREE(... SENGATE(x,a), SENGATE(SENITEM(x),b) ...) => SENGATE(x,OR(a,b)) @@ -3952,7 +3952,7 @@ uint32_t ConstVisitor::s_globalPassNum = 0; //! Force this cell node's parameter list to become a constant //! @return Pointer to the edited node. AstNode* V3Const::constifyParamsEdit(AstNode* nodep) { - // if (debug() > 0) nodep->dumpTree("- forceConPRE : "); + // UINFOTREE(1, nodep, "", "forceConPRE"); // Resize even if the node already has a width, because buried in the tree // we may have a node we just created with signing, etc, that isn't sized yet. @@ -3968,14 +3968,14 @@ AstNode* V3Const::constifyParamsEdit(AstNode* nodep) { nodep = visitor.mainAcceptEdit(nodep); } // Because we do edits, nodep links may get trashed and core dump if have next line - // if (debug() > 0) nodep->dumpTree("- forceConDONE: "); + // UINFOTREE(1, nodep, "", "forceConDONE"); return nodep; } //! Constify this cell node's parameter list if possible //! @return Pointer to the edited node. AstNode* V3Const::constifyParamsNoWarnEdit(AstNode* nodep) { - // if (debug() > 0) nodep->dumpTree("- forceConPRE : "); + // UINFOTREE(1, nodep, "", "forceConPRE"); // Resize even if the node already has a width, because buried in the tree // we may have a node we just created with signing, etc, that isn't sized yet. @@ -3991,7 +3991,7 @@ AstNode* V3Const::constifyParamsNoWarnEdit(AstNode* nodep) { nodep = visitor.mainAcceptEdit(nodep); } // Because we do edits, nodep links may get trashed and core dump this. - // if (debug() > 0) nodep->dumpTree("- forceConDONE: "); + // UINFOTREE(1, nodep, "", "forceConDONE"); return nodep; } @@ -4004,7 +4004,7 @@ AstNode* V3Const::constifyParamsNoWarnEdit(AstNode* nodep) { //! width check. //! @return Pointer to the edited node. AstNode* V3Const::constifyGenerateParamsEdit(AstNode* nodep) { - // if (debug() > 0) nodep->dumpTree("- forceConPRE:: "); + // UINFOTREE(1, nodep, "", "forceConPRE:"); // Resize even if the node already has a width, because buried in the tree // we may have a node we just created with signing, etc, that isn't sized // yet. @@ -4021,7 +4021,7 @@ AstNode* V3Const::constifyGenerateParamsEdit(AstNode* nodep) { nodep = visitor.mainAcceptEdit(nodep); } // Because we do edits, nodep links may get trashed and core dump this. - // if (debug() > 0) nodep->dumpTree("- forceConDONE: "); + // UINFOTREE(1, nodep, "", "forceConDONE"); return nodep; } diff --git a/src/V3Depth.cpp b/src/V3Depth.cpp index 96994fe66..7ff71ecdd 100644 --- a/src/V3Depth.cpp +++ b/src/V3Depth.cpp @@ -48,7 +48,7 @@ class DepthVisitor final : public VNVisitor { void createDeepTemp(AstNodeExpr* nodep) { UINFO(6, " Deep " << nodep); - // if (debug() >= 9) nodep->dumpTree("- deep: "); + // UINFOTREE(9, nodep, "", "deep"); AstVar* const varp = new AstVar{nodep->fileline(), VVarType::STMTTEMP, m_tempNames.get(nodep), nodep->dtypep()}; if (m_cfuncp) { diff --git a/src/V3DepthBlock.cpp b/src/V3DepthBlock.cpp index f4f54ee8c..cbd5bd771 100644 --- a/src/V3DepthBlock.cpp +++ b/src/V3DepthBlock.cpp @@ -89,11 +89,11 @@ class DepthBlockVisitor final : public VNVisitor { if (m_depth > v3Global.opt.compLimitBlocks()) { // Already done UINFO(4, "DeepBlocks " << m_depth << " " << nodep); const AstNode* const backp = nodep->backp(); // Only for debug - if (debug() >= 9) backp->dumpTree("- pre : "); + UINFOTREE(9, backp, "", "pre "); AstCFunc* const funcp = createDeepFunc(nodep); iterate(funcp); - if (debug() >= 9) backp->dumpTree("- post: "); - if (debug() >= 9) funcp->dumpTree("- func: "); + UINFOTREE(9, backp, "", "post"); + UINFOTREE(9, funcp, "", "func"); } else { iterateChildren(nodep); } diff --git a/src/V3Descope.cpp b/src/V3Descope.cpp index 0545551ae..8d670b967 100644 --- a/src/V3Descope.cpp +++ b/src/V3Descope.cpp @@ -195,7 +195,7 @@ class DescopeVisitor final : public VNVisitor { // "%%Error: "s+name+"() called with bad // scope", nullptr)); // newfuncp->addStmtsp(new AstStop(newfuncp->fileline())); - if (debug() >= 9) newfuncp->dumpTree("- newfunc: "); + UINFOTREE(9, newfuncp, "", "newfunc"); } else { // Only a single function under this name, we can rename it UINFO(6, " Wrapping " << name << " just one " << topFuncp); diff --git a/src/V3Error.h b/src/V3Error.h index 6706e4891..4e2eadb64 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -643,11 +643,14 @@ void v3errorEndFatal(std::ostringstream& sstr) do { std::cout << "- " << V3Error::lineStr(__FILE__, __LINE__) << stmsg; } while (false) /// Based on debug level, call UINFO then dumpTree on nodep, using given message prefix +/// If uinfo_msg = "", suppress the first UINFO /// If dt_msg = "", use the uinfo_msg; note any uinfo_msg side effects will happen twice. #define UINFOTREE(level, nodep, uinfo_msg, dt_msg) \ do { \ if (VL_UNCOVERABLE(debug() >= (level))) { \ - UINFO(level, uinfo_msg); \ + std::ostringstream us; \ + us << uinfo_msg; \ + if (!us.str().empty()) UINFO(level, us.str()); \ std::ostringstream ss; \ ss << dt_msg; \ if (ss.str().empty()) ss << uinfo_msg; \ diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index e7368142f..578799b04 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -867,7 +867,7 @@ class GateInline final { if (!canInline) continue; // Cannot optimize this replacement - if (debug() >= 9) dstVtxp->nodep()->dumpTree(" inside: "); + UINFOTREE(9, dstVtxp->nodep(), "", "inside"); if (logicp == dstVtxp->nodep()) { // This is a bit involved. The graph tells us that the logic is circular diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp index 37c6f73d1..d998bb922 100644 --- a/src/V3Inline.cpp +++ b/src/V3Inline.cpp @@ -365,8 +365,7 @@ class InlineRelinkVisitor final : public VNVisitor { const string name = m_cellp->name() + "__DOT__" + nodep->name(); if (!nodep->isFuncLocal() && !nodep->isClassMember()) nodep->inlineAttrReset(name); if (!m_cellp->isTrace()) nodep->trace(false); - if (debug() >= 9) nodep->dumpTree("- varchanged: "); - if (debug() >= 9 && nodep->valuep()) nodep->valuep()->dumpTree("- varchangei: "); + UINFOTREE(9, nodep, "", "varchanged"); } void visit(AstNodeFTask* nodep) override { // Function under the inline cell, need to rename to avoid conflicts diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index 4fc415479..e53d9f8c6 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -59,7 +59,7 @@ class InstVisitor final : public VNVisitor { V3Inst::pinReconnectSimple(nodep, m_cellp, false); } if (!nodep->exprp()) return; // No-connect - if (debug() >= 9) nodep->dumpTree("- Pin_oldb: "); + UINFOTREE(9, nodep, "", "Pin_oldb"); V3Inst::checkOutputShort(nodep); // Use user1p on the PIN to indicate we created an assign for this pin if (!nodep->user1SetOnce()) { @@ -83,7 +83,7 @@ class InstVisitor final : public VNVisitor { m_cellp->name(), VAccess::WRITE}, exprp}; m_cellp->addNextHere(assp); - if (debug() >= 9) assp->dumpTree("- _new: "); + UINFOTREE(9, assp, "", "_new"); } else if (nodep->modVarp()->isIfaceRef() || (VN_IS(nodep->modVarp()->dtypep()->skipRefp(), UnpackArrayDType) && VN_IS(VN_AS(nodep->modVarp()->dtypep()->skipRefp(), UnpackArrayDType) @@ -642,7 +642,7 @@ public: // Done. Constant. } else { // Make a new temp wire - // if (1 || debug() >= 9) pinp->dumpTree("- in_pin: "); + // UINFOTREE(9, pinp, "", "in_pin"); V3Inst::checkOutputShort(pinp); AstNodeExpr* const pinexprp = VN_AS(pinp->exprp(), NodeExpr)->unlinkFrBack(); const string newvarname @@ -674,8 +674,8 @@ public: pinp->exprp(new AstVarRef{pinexprp->fileline(), newvarp, VAccess::READ}); } if (assignp) cellp->addNextHere(assignp); - // if (debug()) pinp->dumpTree("- out: "); - // if (debug()) assignp->dumpTree("- aout: "); + // UINFOTREE(1, pinp, "", "out"); + // UINFOTREE(1, assignp, "", "aout"); } return assignp; } diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 1cdd0c17d..c51d9d216 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -152,7 +152,7 @@ public: // Redundant assignment, in same level block // Don't delete it now as it will confuse iteration since it maybe WAY // above our current iteration point. - if (debug() > 4) oldassp->dumpTree("- REMOVE/SAMEBLK: "); + UINFOTREE(7, oldassp, "", "REMOVE/SAMEBLK"); entp->complexAssign(); oldassp->unlinkFrBack(); if (VN_IS(oldassp, CReset)) { diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index d41eef7d7..7df735e67 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -2210,7 +2210,7 @@ class LinkDotScopeVisitor final : public VNVisitor { void visit(AstAssignAlias* nodep) override { // ScopeVisitor:: // Track aliases created by V3Inline; if we get a VARXREF(aliased_from) // we'll need to replace it with a VARXREF(aliased_to) - if (debug() >= 9) nodep->dumpTree("- alias: "); + UINFOTREE(9, nodep, "", "alias"); AstVarScope* const fromVscp = VN_AS(nodep->lhsp(), VarRef)->varScopep(); AstVarScope* const toVscp = VN_AS(nodep->rhsp(), VarRef)->varScopep(); UASSERT_OBJ(fromVscp && toVscp, nodep, "Bad alias scopes"); @@ -2219,7 +2219,7 @@ class LinkDotScopeVisitor final : public VNVisitor { } void visit(AstAssignVarScope* nodep) override { // ScopeVisitor:: UINFO(5, "ASSIGNVARSCOPE " << nodep); - if (debug() >= 9) nodep->dumpTree("- avs: "); + UINFOTREE(9, nodep, "", "avs"); VSymEnt* rhsSymp; { AstVarRef* const refp = VN_CAST(nodep->rhsp(), VarRef); @@ -2852,8 +2852,8 @@ class LinkDotResolveVisitor final : public VNVisitor { else { m_pinSymp = m_statep->getNodeSym(nodep->modp()); UINFO(4, indent() << "(Backto) visit " << nodep); - // if (debug()) nodep->dumpTree("- linkcell: "); - // if (debug()) nodep->modp()->dumpTree("- linkcemd: "); + // UINFOTREE(1, nodep, "", "linkcell"); + // UINFOTREE(1, nodep->modp(), "", "linkcemd"); iterateChildren(nodep); } } @@ -2875,8 +2875,8 @@ class LinkDotResolveVisitor final : public VNVisitor { // ClassRef's have pins, so track m_pinSymp = m_statep->getNodeSym(nodep->classp()); UINFO(4, indent() << "(Backto) visit " << nodep); - // if (debug()) nodep->dumpTree("- linkcell: "); - // if (debug()) nodep->modp()->dumpTree("- linkcemd: "); + // UINFOTREE(1, nodep, "", "linkcell"); + // UINFOTREE(1, nodep->modp(), "", "linkcemd"); iterateChildren(nodep); } } @@ -2958,7 +2958,7 @@ class LinkDotResolveVisitor final : public VNVisitor { VL_RESTORER(m_randSymp); { if (start) { // Starting dot sequence - if (debug() >= 9) nodep->dumpTree("- dot-in: "); + UINFOTREE(9, nodep, "", "dot-in"); m_ds.init(m_curSymp); // Start from current point } m_ds.m_dotp = nodep; // Always, not just at start @@ -3057,7 +3057,7 @@ class LinkDotResolveVisitor final : public VNVisitor { UINFO(8, indent() << "iter.lhs " << m_ds.ascii() << " " << nodep); iterateAndNextNull(nodep->lhsp()); UINFO(8, indent() << "iter.ldone " << m_ds.ascii() << " " << nodep); - // if (debug() >= 9) nodep->dumpTree("- dot-lho: "); + // UINFOTREE(9, nodep, "", "dot-lho"); } if (m_statep->forPrimary() && isParamedClassRef(nodep->lhsp())) { // Dots of paramed classes will be linked after deparameterization @@ -3077,7 +3077,7 @@ class LinkDotResolveVisitor final : public VNVisitor { // m_ds.m_dotSymp points at lhsp()'s symbol table, so resolve RHS under that iterateAndNextNull(nodep->rhsp()); UINFO(8, indent() << "iter.rdone " << m_ds.ascii() << " " << nodep); - // if (debug() >= 9) nodep->dumpTree("- dot-rho: "); + // UINFOTREE(9, nodep, "", "dot-rho"); } if (!m_ds.m_unresolvedClass) { if (start) { @@ -3087,7 +3087,7 @@ class LinkDotResolveVisitor final : public VNVisitor { } else { newp = nodep->rhsp()->unlinkFrBack(); } - if (debug() >= 9) newp->dumpTree("- dot-out: "); + UINFOTREE(9, newp, "", "dot-out"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { // Dot midpoint diff --git a/src/V3LinkInc.cpp b/src/V3LinkInc.cpp index bb17df158..f8c08fb51 100644 --- a/src/V3LinkInc.cpp +++ b/src/V3LinkInc.cpp @@ -81,7 +81,7 @@ class LinkIncVisitor final : public VNVisitor { } void insertBeforeStmt(AstNode* nodep, AstNode* newp) { // Return node that must be visited, if any - if (debug() >= 9) newp->dumpTree("- newstmt: "); + UINFOTREE(9, newp, "", "newstmt"); UASSERT_OBJ(m_insStmtp, nodep, "Expression not underneath a statement"); // In a while condition, the statement also needs to go on the // back-edge to the loop header, 'incsp' is that place. @@ -209,7 +209,7 @@ class LinkIncVisitor final : public VNVisitor { } void prepost_stmt_sel_visit(AstNodeTriop* nodep) { // Special case array[something]++, see comments at file top - // if (debug() >= 9) nodep->dumpTree("-pp-stmt-sel-in: "); + // UINFOTREE(9, nodep, "", "pp-stmt-sel-in"); iterateChildren(nodep); AstConst* const constp = VN_AS(nodep->lhsp(), Const); UASSERT_OBJ(nodep, constp, "Expecting CONST"); diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index 9694dc6c5..c6506f530 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -190,8 +190,8 @@ class LinkResolveVisitor final : public VNVisitor { if (VN_IS(nodep->backp(), StmtExpr)) { nodep->v3error("Expected statement, not let substitution " << letp->prettyNameQ()); } - // if (debug()) letp->dumpTree("-let-let "); - // if (debug()) nodep->dumpTree("-let-ref "); + // UINFOTREE(1, letp, "", "let-let"); + // UINFOTREE(1, nodep, "", "let-ref"); AstStmtExpr* const letStmtp = VN_AS(letp->stmtsp(), StmtExpr); AstNodeExpr* const newp = letStmtp->exprp()->cloneTree(false); const V3TaskConnects tconnects = V3Task::taskConnects(nodep, letp->stmtsp()); @@ -214,7 +214,7 @@ class LinkResolveVisitor final : public VNVisitor { VL_DO_DANGLING(pushDeletep(refp), refp); } }); - // if (debug()) newp->dumpTree("-let-new "); + // UINFOTREE(1, newp, "", "let-new"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Iterate to expand further now, so we can look for recursions diff --git a/src/V3Param.cpp b/src/V3Param.cpp index 4eba561cc..7bf2a98b3 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -745,7 +745,7 @@ class ParamProcessor final { AstConst* const exprp = VN_CAST(pinp->exprp(), Const); AstConst* const origp = VN_CAST(modvarp->valuep(), Const); if (!exprp) { - if (debug()) pinp->dumpTree("- "); + UINFOTREE(1, pinp, "", "errnode"); pinp->v3error("Can't convert defparam value to constant: Param " << pinp->prettyNameQ() << " of " << nodep->prettyNameQ()); pinp->exprp()->replaceWith(new AstConst{ @@ -884,9 +884,9 @@ class ParamProcessor final { AstPin* pinsp, bool any_overrides) { // Make sure constification worked // Must be a separate loop, as constant conversion may have changed some pointers. - // if (debug()) nodep->dumpTree("- cel2: "); + // UINFOTREE(1, nodep, "", "cel2"); string longname = srcModpr->name() + "_"; - if (debug() > 8 && paramsp) paramsp->dumpTreeAndNext(cout, "- cellparams: "); + if (debug() >= 9 && paramsp) paramsp->dumpTreeAndNext(cout, "- cellparams: "); if (srcModpr->hierBlock()) { longname = parameterizedHierBlockName(srcModpr, paramsp); @@ -991,7 +991,7 @@ public: // and remove any recursive references UINFO(4, "De-parameterize: " << nodep); // Create new module name with _'s between the constants - if (debug() >= 10) nodep->dumpTree("- cell: "); + UINFOTREE(10, nodep, "", "cell"); // Evaluate all module constants V3Const::constifyParamsEdit(nodep); // Set name for warnings for when we param propagate the module diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index decadd40e..ecf20d1d4 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -2191,7 +2191,7 @@ class RandomizeVisitor final : public VNVisitor { // else warning // Note this code assumes that the expressions after V3Const are fast to compute // Optimize: we would be better with a binary search tree to reduce ifs that execute - if (debug() >= 9) nodep->dumpTree("- rcin:: "); + UINFOTREE(9, nodep, "", "rcin:"); AstNodeDType* const sumDTypep = nodep->findUInt64DType(); FileLine* const fl = nodep->fileline(); diff --git a/src/V3Reloop.cpp b/src/V3Reloop.cpp index 19133d323..99855dbf0 100644 --- a/src/V3Reloop.cpp +++ b/src/V3Reloop.cpp @@ -121,8 +121,8 @@ class ReloopVisitor final : public VNVisitor { rbitp->replaceWith(m_mgOffset < 0 ? new AstAdd{fl, rvrefp, offsetp} : rvrefp); VL_DO_DANGLING(rbitp->deleteTree(), lbitp); } - if (debug() >= 9) initp->dumpTree("- new: "); - if (debug() >= 9) whilep->dumpTree("- new: "); + UINFOTREE(9, initp, "", "new"); + UINFOTREE(9, whilep, "", "new"); // Remove remaining assigns for (AstNodeAssign* assp : m_mgAssignps) { diff --git a/src/V3Simulate.h b/src/V3Simulate.h index 516af3400..190b3580f 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -739,7 +739,7 @@ private: // Values are in the "real" tree under the InitArray so can eventually extract it, // Not in the usual setValue (via m_varAux) initp->addIndexValuep(index, valuep); - if (debug() >= 9) initp->dumpTree("- array: "); + UINFOTREE(9, initp, "", "array"); assignOutValue(nodep, vscp, initp); } } diff --git a/src/V3Slice.cpp b/src/V3Slice.cpp index b96d980ad..685334575 100644 --- a/src/V3Slice.cpp +++ b/src/V3Slice.cpp @@ -272,10 +272,10 @@ class SliceVisitor final : public VNVisitor { VL_DO_DANGLING(pushDeletep(exprp), exprp); }); } - if (debug() >= 9) newp->dumpTree("- new: "); + UINFOTREE(9, newp, "", "new"); newlistp = AstNode::addNext(newlistp, newp); } - if (debug() >= 9) nodep->dumpTree("- Deslice-Dn: "); + UINFOTREE(9, nodep, "", "Deslice-Dn"); nodep->replaceWith(newlistp); VL_DO_DANGLING(nodep->deleteTree(), nodep); // Normal edit iterator will now iterate on all of the expansion assignments @@ -287,7 +287,7 @@ class SliceVisitor final : public VNVisitor { // Called recursively on newly created assignments if (nodep->user1SetOnce()) return; // Process once if (VN_IS(nodep, AssignAlias)) return; - if (debug() >= 9) nodep->dumpTree("- Deslice-In: "); + UINFOTREE(9, nodep, "", "Deslice-In"); VL_RESTORER(m_assignError); VL_RESTORER(m_assignp); VL_RESTORER(m_okInitArray); // Set in assignOptimize diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 323ebd5b3..dca6a21f2 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -598,10 +598,10 @@ protected: void visit(AstAlways* nodep) override { UINFO(4, " ALW " << nodep); - if (debug() >= 9) nodep->dumpTree("- alwIn:: "); + UINFOTREE(9, nodep, "", "alwIn:"); scoreboardClear(); processBlock(nodep->stmtsp()); - if (debug() >= 9) nodep->dumpTree("- alwOut: "); + UINFOTREE(9, nodep, "", "alwOut"); } void visit(AstNodeIf* nodep) override { diff --git a/src/V3SplitAs.cpp b/src/V3SplitAs.cpp index 4f29d6767..c5c5fb5fd 100644 --- a/src/V3SplitAs.cpp +++ b/src/V3SplitAs.cpp @@ -131,7 +131,7 @@ class SplitAsVisitor final : public VNVisitor { // METHODS void splitAlways(AstAlways* nodep, AstVarScope* splitVscp) { - if (debug() >= 9) nodep->dumpTree("- in: "); + UINFOTREE(9, nodep, "", "in"); // Duplicate it and link in // Below cloneTree should perhaps be cloneTreePure, but given // isolate_assignments is required to hit this code, we presume the user @@ -141,11 +141,11 @@ class SplitAsVisitor final : public VNVisitor { nodep->addNextHere(newp); { // Delete stuff we don't want in old const SplitAsCleanVisitor visitor{nodep, splitVscp, false}; - if (debug() >= 9) nodep->dumpTree("- out0: "); + UINFOTREE(9, nodep, "", "out0"); } { // Delete stuff we don't want in new const SplitAsCleanVisitor visitor{newp, splitVscp, true}; - if (debug() >= 9) newp->dumpTree("- out1: "); + UINFOTREE(9, newp, "", "out1"); } } diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index 98ceea886..f86e4fa8c 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -284,12 +284,12 @@ class SubstVisitor final : public VNVisitor { if (!hit) iterate(nodep->lhsp()); } void replaceSubstEtc(AstNode* nodep, AstNodeExpr* substp) { - if (debug() > 5) nodep->dumpTree("- substw_old: "); + UINFOTREE(6, nodep, "", "substw_old"); AstNodeExpr* newp = substp->cloneTreePure(true); if (!nodep->isQuad() && newp->isQuad()) { newp = new AstCCast{newp->fileline(), newp, nodep}; } - if (debug() > 5) newp->dumpTree("- w_new: "); + UINFOTREE(6, newp, "", "w_new"); nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep); ++m_statSubsts; diff --git a/src/V3Table.cpp b/src/V3Table.cpp index 74fd45945..3f9fabd4b 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -275,7 +275,7 @@ private: // Keep sensitivity list, but delete all else nodep->stmtsp()->unlinkFrBackWithNext()->deleteTree(); nodep->addStmtsp(stmtsp); - if (debug() >= 6) nodep->dumpTree("- table_new: "); + UINFOTREE(6, nodep, "", "table_new"); } void createTables(AstAlways* nodep, TableBuilder& outputAssignedTableBuilder) { diff --git a/src/V3Task.cpp b/src/V3Task.cpp index e7cfc5357..3cab796a2 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -530,7 +530,7 @@ class TaskVisitor final : public VNVisitor { } } } else if (portp->isInout()) { - // if (debug() >= 9) pinp->dumpTree("-pinrsize- "); + // UINFOTREE(9, pinp, "", "pinrsize-"); AstVarScope* const newvscp = createVarScope(portp, namePrefix + "__" + portp->shortName()); @@ -1411,7 +1411,7 @@ class TaskVisitor final : public VNVisitor { // Delete rest of cloned task and return new func VL_DO_DANGLING(pushDeletep(nodep), nodep); - if (debug() >= 9) cfuncp->dumpTree("- userFunc: "); + UINFOTREE(9, cfuncp, "", "userFunc"); return cfuncp; } @@ -1424,9 +1424,9 @@ class TaskVisitor final : public VNVisitor { iterate(nodep); } void insertBeforeStmt(AstNode* nodep, AstNode* newp) { - if (debug() >= 9) nodep->dumpTree("- newstmt: "); + UINFOTREE(9, nodep, "", "newstmt"); UASSERT_OBJ(m_insStmtp, nodep, "Function call not underneath a statement"); - if (debug() >= 9) newp->dumpTree("- newfunc: "); + UINFOTREE(9, newp, "", "newfunc"); m_insStmtp->addHereThisAsNext(newp); } @@ -1464,7 +1464,7 @@ class TaskVisitor final : public VNVisitor { UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked?"); iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs UINFO(4, " FTask REF " << nodep); - if (debug() >= 9) nodep->dumpTree("- inlfunc: "); + UINFOTREE(9, nodep, "", "inlfunc"); UASSERT_OBJ(m_scopep, nodep, "func ref not under scope"); const string namePrefix = ((VN_IS(nodep, FuncRef) ? "__Vfunc_" : "__Vtask_") + nodep->taskp()->shortName() + "__" + cvtToStr(m_modNCalls++)); @@ -1853,7 +1853,7 @@ void V3Task::taskConnectWrap(AstNodeFTaskRef* nodep, const V3TaskConnects& tconn // Change outside call to connect to new function nodep->taskp(newTaskp); nodep->name(newTaskp->name()); - // if (debug() >= 9) nodep->dumpTree("-taskConnectWrap-call "); + // UINFOTREE(9, nodep, "", "taskConnectWrap-call"); } AstNodeFTask* V3Task::taskConnectWrapNew(AstNodeFTask* taskp, const string& newname, @@ -1928,7 +1928,7 @@ AstNodeFTask* V3Task::taskConnectWrapNew(AstNodeFTask* taskp, const string& newn const auto it = oldNewVars.find(refp->varp()); if (it != oldNewVars.end()) refp->varp(it->second); }); - // if (debug() >= 9) newTaskp->dumpTree("-taskConnectWrap-new "); + // UINFOTREE(9, newTaskp, "", "taskConnectWrap-new"); return newTaskp; } diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index cbc8833f4..1a14843f4 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -309,7 +309,7 @@ class TraceVisitor final : public VNVisitor { if (TraceTraceVertex* const vtxp = vtx.cast()) { ActCodeSet actSet; UINFO(9, " Add to sort: " << vtxp); - if (debug() >= 9) vtxp->nodep()->dumpTree("- trnode: "); + UINFOTREE(9, vtxp->nodep(), "", "trnode"); for (const V3GraphEdge& edge : vtxp->inEdges()) { const TraceActivityVertex* const cfvertexp = edge.fromp()->cast(); diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index be40fec9a..36ebdd123 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -822,7 +822,7 @@ class TristateVisitor final : public TristateBaseVisitor { if (envarp) { AstAssignW* const enAssp = new AstAssignW{ enp->fileline(), new AstVarRef{envarp->fileline(), envarp, VAccess::WRITE}, enp}; - if (debug() >= 9) enAssp->dumpTree("- enAssp: "); + UINFOTREE(9, enAssp, "", "enAssp"); nodep->addStmtsp(enAssp); } @@ -830,7 +830,7 @@ class TristateVisitor final : public TristateBaseVisitor { AstNode* const assp = new AstAssignW{ lhsp->fileline(), new AstVarRef{lhsp->fileline(), lhsp, VAccess::WRITE}, orp}; assp->user2(U2_BOTH); // Don't process further; already resolved - if (debug() >= 9) assp->dumpTree("- lhsp-eqn: "); + UINFOTREE(9, assp, "", "lhsp-eqn"); nodep->addStmtsp(assp); // If this is a top-level inout, make sure that the INOUT pins get __en and __out @@ -1145,7 +1145,7 @@ class TristateVisitor final : public TristateBaseVisitor { AstNodeExpr* const newp = newEnableDeposit(nodep, VN_AS(nodep->user1p(), NodeExpr)); nodep->fromp()->user1p(newp); // Push to varref (etc) - if (debug() >= 9) newp->dumpTree("- assign-sel: "); + UINFOTREE(9, newp, "", "assign-sel"); m_tgraph.didProcess(nodep); } iterateChildren(nodep); @@ -1223,7 +1223,7 @@ class TristateVisitor final : public TristateBaseVisitor { associateLogic(nodep->rhsp(), nodep); m_tgraph.setTristate(nodep); } else { - if (debug() >= 9) nodep->backp()->dumpTree("- bufif: "); + UINFOTREE(9, nodep->backp(), "", "bufif"); if (m_alhs) { nodep->v3warn(E_UNSUPPORTED, "Unsupported LHS tristate construct: " << nodep->prettyTypeName()); @@ -1328,7 +1328,7 @@ class TristateVisitor final : public TristateBaseVisitor { nodep->user2(U2_NONGRAPH); iterateAndNextNull(nodep->rhsp()); UINFO(9, dbgState() << nodep); - if (debug() >= 9) nodep->dumpTree("- assign: "); + UINFOTREE(9, nodep, "", "assign"); // if the rhsp of this assign statement has an output enable driver, // then propagate the corresponding output enable assign statement. // down the lvalue tree by recursion for eventual attachment to @@ -1398,8 +1398,8 @@ class TristateVisitor final : public TristateBaseVisitor { new AstEqCase{fl, new AstConst{fl, oneIfEnOne}, rhsp}}; if (neq) newp = new AstLogNot{fl, newp}; UINFO(9, " newceq " << newp); - if (debug() >= 9) nodep->dumpTree("- caseeq-old: "); - if (debug() >= 9) newp->dumpTree("- caseeq-new: "); + UINFOTREE(9, nodep, "", "caseeq-old"); + UINFOTREE(9, newp, "", "caseeq-new"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (constp && nodep->rhsp()->user1p()) { @@ -1414,8 +1414,8 @@ class TristateVisitor final : public TristateBaseVisitor { if (neq) newp = new AstLogNot{fl, newp}; rhsp->user1p(nullptr); UINFO(9, " newceq " << newp); - if (debug() >= 9) nodep->dumpTree("- caseeq-old: "); - if (debug() >= 9) newp->dumpTree("- caseeq-new: "); + UINFOTREE(9, nodep, "", "caseeq-old"); + UINFOTREE(9, newp, "", "caseeq-new"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { @@ -1495,7 +1495,7 @@ class TristateVisitor final : public TristateBaseVisitor { } newp = new AstAdd{nodep->fileline(), nodep, newp}; } - if (debug() >= 9) newp->dumpTree("- countout: "); + UINFOTREE(9, newp, "", "countout"); relinkHandle.relink(newp); } iterateChildren(nodep); @@ -1511,7 +1511,7 @@ class TristateVisitor final : public TristateBaseVisitor { varrefp = VN_AS(VN_AS(nodep->lhsp(), Sel)->fromp(), VarRef); } if (!varrefp) { - if (debug() >= 4) nodep->dumpTree("- "); + UINFOTREE(4, nodep, "", ""); nodep->v3warn(E_UNSUPPORTED, "Unsupported pullup/down (weak driver) construct."); } else { if (m_graphing) { @@ -1591,7 +1591,7 @@ class TristateVisitor final : public TristateBaseVisitor { } // Tristate exists: UINFO(9, dbgState() << nodep); - if (debug() >= 9) nodep->dumpTree("- pin-pre: "); + UINFOTREE(9, nodep, "", "pin-pre"); // Empty/in-only; need Z to propagate const bool inDeclProcessing = (nodep->exprp() @@ -1646,7 +1646,7 @@ class TristateVisitor final : public TristateBaseVisitor { m_modp->addStmtsp(enVarp); enrefp = new AstVarRef{nodep->fileline(), enVarp, VAccess::READ}; UINFO(9, " newvrf " << enrefp); - if (debug() >= 9) enpinp->dumpTree("- pin-ena: "); + UINFOTREE(9, enpinp, "", "pin-ena"); } // Create new output pin const AstAssignW* outAssignp = nullptr; // If reconnected, the related assignment @@ -1677,11 +1677,11 @@ class TristateVisitor final : public TristateBaseVisitor { // a VarRef without any ArraySel, etc TristatePinVisitor{outexprp, m_tgraph, true}; } - if (debug() >= 9) outpinp->dumpTree("- pin-opr: "); + UINFOTREE(9, outpinp, "", "pin-opr"); outAssignp = V3Inst::pinReconnectSimple(outpinp, m_cellp, true); // Note may change outpinp->exprp() - if (debug() >= 9) outpinp->dumpTree("- pin-out: "); - if (debug() >= 9 && outAssignp) outAssignp->dumpTree("- pin-out: "); + UINFOTREE(9, outpinp, "", "pin-out"); + UINFOTREE(9, outAssignp, "", "pin-oas"); // Must still iterate the outAssignp, as need to build output equation } @@ -1689,8 +1689,8 @@ class TristateVisitor final : public TristateBaseVisitor { const TristatePinVisitor visitor{nodep->exprp(), m_tgraph, false}; const AstNode* const inAssignp = V3Inst::pinReconnectSimple( nodep, m_cellp, true); // Note may change nodep->exprp() - if (debug() >= 9) nodep->dumpTree("- pin-in:: "); - if (debug() >= 9 && inAssignp) inAssignp->dumpTree("- pin-as:: "); + UINFOTREE(9, nodep, "", "pin-in:"); + UINFOTREE(9, inAssignp, "", "pin-as:"); // Connect enable to output signal AstVarRef* exprrefp; // Tristate variable that the Pin's expression refers to diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 2536862ac..42fb8d822 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -134,7 +134,7 @@ class UnknownVisitor final : public VNVisitor { fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}))}; newp->branchPred(VBranchPred::BP_LIKELY); newp->isBoundsCheck(true); - if (debug() >= 9) newp->dumpTree("- _new: "); + UINFOTREE(9, newp, "", "_new"); abovep->addNextStmt(newp, abovep); prep->user2p(newp); // Save so we may LogAnd it next time } @@ -319,7 +319,7 @@ class UnknownVisitor final : public VNVisitor { void visit(AstConst* nodep) override { if (m_constXCvt && nodep->num().isFourState()) { UINFO(4, " CONST4 " << nodep); - if (debug() >= 9) nodep->dumpTree("- Const_old: "); + UINFOTREE(9, nodep, "", "Const_old"); // CONST(num) -> VARREF(newvarp) // -> VAR(newvarp) // -> INITIAL(VARREF(newvarp, OR(num_No_Xs,AND(random,num_1s_Where_X)) @@ -368,9 +368,9 @@ class UnknownVisitor final : public VNVisitor { m_modp->addStmtsp(newvarp); m_modp->addStmtsp(newinitp); m_modp->addStmtsp(afterp); - if (debug() >= 9) newref1p->dumpTree("- _new: "); - if (debug() >= 9) newvarp->dumpTree("- _new: "); - if (debug() >= 9) newinitp->dumpTree("- _new: "); + UINFOTREE(9, newref1p, "", "_newref"); + UINFOTREE(9, newvarp, "", "_newvar"); + UINFOTREE(9, newinitp, "", "_newini"); VL_DO_DANGLING(nodep->deleteTree(), nodep); } } @@ -388,7 +388,7 @@ class UnknownVisitor final : public VNVisitor { // Find range of dtype we are selecting from // Similar code in V3Const::warnSelect const int maxmsb = nodep->fromp()->dtypep()->width() - 1; - if (debug() >= 9) nodep->dumpTree("- sel_old: "); + UINFOTREE(9, nodep, "", "sel_old"); // If (maxmsb >= selected), we're in bound AstNodeExpr* condp @@ -412,7 +412,7 @@ class UnknownVisitor final : public VNVisitor { AstNodeExpr* const newp = condp->isZero() ? xexprp : new AstCondBound{nodep->fileline(), condp, nodep, xexprp}; - if (debug() >= 9) newp->dumpTree("- _new: "); + UINFOTREE(9, newp, "", "_new"); // Link in conditional replaceHandle.relink(newp); // Added X's, tristate them too @@ -429,7 +429,7 @@ class UnknownVisitor final : public VNVisitor { void visit(AstArraySel* nodep) override { iterateChildren(nodep); if (!nodep->user1SetOnce()) { - if (debug() == 9) nodep->dumpTree("- in: "); + UINFOTREE(9, nodep, "", "in"); // Guard against reading/writing past end of arrays AstNode* const basefromp = AstArraySel::baseFromp(nodep->fromp(), true); bool lvalue = false; @@ -447,7 +447,7 @@ class UnknownVisitor final : public VNVisitor { const AstNodeArrayDType* const adtypep = VN_CAST(dtypep, NodeArrayDType); UASSERT_OBJ(adtypep, nodep, "Select from non-array " << dtypep->prettyTypeName()); declElements = adtypep->elementsConst(); - if (debug() >= 9) nodep->dumpTree("- arraysel_old: "); + UINFOTREE(9, nodep, "", "arraysel_old"); // If value MODDIV constant, where constant <= declElements, known ok // V3Random makes these to intentionally prevent exceeding enum array bounds. @@ -487,7 +487,7 @@ class UnknownVisitor final : public VNVisitor { } AstNode* const newp = new AstCondBound{nodep->fileline(), condp, nodep, new AstConst{nodep->fileline(), xnum}}; - if (debug() >= 9) newp->dumpTree("- _new: "); + UINFOTREE(9, newp, "", "_new"); // Link in conditional, can blow away temp xor replaceHandle.relink(newp); // Added X's, tristate them too @@ -500,7 +500,7 @@ class UnknownVisitor final : public VNVisitor { bitp->fileline(), condp, bitp, new AstConst{bitp->fileline(), AstConst::WidthedValue{}, bitp->width(), 0}}; // Added X's, tristate them too - if (debug() >= 9) newp->dumpTree("- _new: "); + UINFOTREE(9, newp, "", "_new"); replaceHandle.relink(newp); iterate(newp); } else { // lvalue diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index 99e7aa89f..23084fe1e 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -68,7 +68,7 @@ class UnrollVisitor final : public VNVisitor { if (m_generate) nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason); UINFO(4, " Can't Unroll: " << reason << " :" << nodep); - // if (debug() >= 9) nodep->dumpTree("- cant: "); + // UINFOTREE(9, nodep, "", "cant"); V3Stats::addStatSum("Unrolling gave up, "s + reason, 1); return false; } @@ -158,7 +158,7 @@ class UnrollVisitor final : public VNVisitor { } else { UINFO(8, " Loop Variable: " << m_forVarp); } - if (debug() >= 9) nodep->dumpTree("- for: "); + UINFOTREE(9, nodep, "", "for"); if (!m_generate) { const AstAssign* const incpAssign = VN_AS(incp, Assign); @@ -219,7 +219,7 @@ class UnrollVisitor final : public VNVisitor { simvis.mainParamEmulate(clonep); if (!simvis.optimizable()) { UINFO(4, "Unable to simulate"); - if (debug() >= 9) nodep->dumpTree("- _simtree: "); + UINFOTREE(9, nodep, "", "_simtree"); VL_DO_DANGLING(clonep->deleteTree(), clonep); return false; } @@ -383,7 +383,7 @@ class UnrollVisitor final : public VNVisitor { if (bodysp) VL_DO_DANGLING(pushDeletep(bodysp), bodysp); if (initp) VL_DO_DANGLING(pushDeletep(initp), initp); if (incp && !incp->backp()) VL_DO_DANGLING(pushDeletep(incp), incp); - if (debug() >= 9 && newbodysp) newbodysp->dumpTree("- _new: "); + if (newbodysp) UINFOTREE(9, newbodysp, "", "_new"); return true; } diff --git a/src/V3Width.cpp b/src/V3Width.cpp index a9bff2d59..7e2f4af83 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -911,6 +911,7 @@ class WidthVisitor final : public VNVisitor { } void visit(AstNodeStream* nodep) override { VL_RESTORER(m_streamConcat); + UINFOTREE(1, nodep, "stream-in vup" << m_vup, "stream-in "); if (m_vup->prelim()) { m_streamConcat = true; iterateCheckSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); @@ -977,7 +978,7 @@ class WidthVisitor final : public VNVisitor { if (nodep->didWidth()) return; UASSERT_OBJ(m_vup, nodep, "Select under an unexpected context"); if (m_vup->prelim()) { - if (debug() >= 9) nodep->dumpTree("- selWidth: "); + UINFOTREE(9, nodep, "", "selWidth"); userIterateAndNext(nodep->fromp(), WidthVP{CONTEXT_DET, PRELIM}.p()); userIterateAndNext(nodep->lsbp(), WidthVP{SELF, PRELIM}.p()); checkCvtUS(nodep->fromp(), false); @@ -1095,7 +1096,7 @@ class WidthVisitor final : public VNVisitor { widthCheckSized(nodep, "Extract Range", nodep->lsbp(), selwidthDTypep, EXTEND_EXP, false /*NOWARN*/); } - // if (debug() >= 9) nodep->dumpTree("-seldone "); + // UINFOTREE(9, nodep, "", "seldone"); } } @@ -2131,8 +2132,8 @@ class WidthVisitor final : public VNVisitor { UINFO(9, "CAST " << nodep); nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); if (m_vup->prelim()) { - if (debug() >= 9) nodep->dumpTree("- CastPre: "); - // if (debug()) nodep->backp()->dumpTree("- CastPreUpUp: "); + UINFOTREE(9, nodep, "", "CastPre"); + // UINFOTREE(1, nodep->backp(), "", "CastPreUpUp"); if (AstSigned* const fromp = VN_CAST(nodep->fromp(), Signed)) { if (VN_IS(fromp->lhsp(), NodeStream)) { AstNode* const lhsp = fromp->lhsp()->unlinkFrBack(); @@ -2141,7 +2142,7 @@ class WidthVisitor final : public VNVisitor { } } userIterateAndNext(nodep->fromp(), WidthVP{SELF, PRELIM}.p()); - if (debug() >= 9) nodep->dumpTree("- CastDit: "); + UINFOTREE(9, nodep, "", "CastDit"); AstNodeDType* const toDtp = nodep->dtypep()->skipRefToEnump(); AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump(); const auto castable = AstNode::computeCastable(toDtp, fromDtp, nodep->fromp()); @@ -2237,20 +2238,20 @@ class WidthVisitor final : public VNVisitor { } if (!newp) newp = nodep->fromp()->unlinkFrBack(); nodep->fromp(newp); - if (debug() >= 9) nodep->dumpTree("- CastOut: "); - // if (debug()) nodep->backp()->dumpTree("- CastOutUpUp: "); + UINFOTREE(9, nodep, "", "CastOut"); + // UINFOTREE(1, nodep->backp(), "", "CastOutUpUp"); } if (m_vup->final()) { - if (debug() >= 9) nodep->dumpTree("- CastFPit: "); + UINFOTREE(9, nodep, "", "CastFPit"); iterateCheck(nodep, "value", nodep->fromp(), SELF, FINAL, nodep->fromp()->dtypep(), EXTEND_EXP, false); - if (debug() >= 9) nodep->dumpTree("- CastFin: "); + UINFOTREE(9, nodep, "", "CastFin"); AstNodeExpr* const underp = nodep->fromp()->unlinkFrBack(); underp->dtypeFrom(nodep); underp->didWidth(true); AstNodeExpr* const newp = new AstCastWrap{nodep->fileline(), underp}; newp->didWidth(true); - if (debug() >= 9) newp->dumpTree("- CastRep: "); + UINFOTREE(9, newp, "", "CastRep"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } @@ -2258,7 +2259,7 @@ class WidthVisitor final : public VNVisitor { void visit(AstCastSize* nodep) override { // IEEE: Signedness of result is same as self-determined signedness // However, the result is same as BITSEL, so we do not sign extend the LHS - // if (debug()) nodep->dumpTree("- CastSizePre: "); + // UINFOTREE(1, nodep, "", "CastSizePre"); if (m_vup->prelim()) { int width = nodep->rhsp()->toSInt(); if (width < 1) { @@ -2274,7 +2275,7 @@ class WidthVisitor final : public VNVisitor { nodep->replaceWithKeepDType(underp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - // if (debug()) nodep->dumpTree("- CastSizeOut: "); + // UINFOTREE(1, nodep, "", "CastSizeOut"); } void visit(AstCastWrap* nodep) override { // Inserted by V3Width only so we know has been resolved @@ -2305,7 +2306,7 @@ class WidthVisitor final : public VNVisitor { VL_DANGLING(underp); underp = nodep->op1p(); // Above asserts that op1 was underp pre-relink } - // if (debug()) nodep->dumpTree("- CastSizeClc: "); + // UINFOTREE(1, nodep, "", "CastSizeClc"); // Next step, make the proper output width { AstNodeDType* const outDtp @@ -2337,7 +2338,7 @@ class WidthVisitor final : public VNVisitor { nodep->dtypep(nodep->rangep()->dtypep()); } void visit(AstVar* nodep) override { - // if (debug()) nodep->dumpTree("- InitPre: "); + // UINFOTREE(1, nodep, "", "InitPre"); // Must have deterministic constant width // We can't skip this step when width()!=0, as creating a AstVar // with non-constant range gets size 1, not size 0. So use didWidth(). @@ -2472,14 +2473,14 @@ class WidthVisitor final : public VNVisitor { << badDtp->warnContextSecondary()); } if (nodep->valuep() && !didchk) { - // if (debug()) nodep->dumpTree("- final: "); + // UINFOTREE(1, nodep, "", "final"); // AstPattern requires assignments to pass datatype on PRELIM userIterateAndNext(nodep->valuep(), WidthVP{nodep->dtypep(), PRELIM}.p()); iterateCheckAssign(nodep, "Initial value", nodep->valuep(), FINAL, nodep->dtypep()); } userIterateAndNext(nodep->delayp(), WidthVP{nodep->dtypep(), PRELIM}.p()); UINFO(4, "varWidthed " << nodep); - // if (debug()) nodep->dumpTree("- InitOut: "); + // UINFOTREE(1, nodep, "", "InitOut"); nodep->didWidth(true); nodep->doingWidth(false); } @@ -2500,14 +2501,14 @@ class WidthVisitor final : public VNVisitor { // Var hasn't been widthed, so make it so. userIterate(nodep->varp(), nullptr); } - // if (debug()>=9) { nodep->dumpTree("- VRin:: "); - // nodep->varp()->dumpTree("- forvar: "); } + // UINFOTREE(9, nodep, "", "VRin"); + // UINFOTREE(9, nodep->varp(), "", "forvar"); // Note genvar's are also entered as integers nodep->dtypeFrom(nodep->varp()); if (VN_IS(nodep->backp(), NodeAssign) && nodep->access().isWriteOrRW()) { // On LHS UASSERT_OBJ(nodep->dtypep(), nodep, "LHS var should be dtype completed"); } - // if (debug() >= 9) nodep->dumpTree("- VRout: "); + // UINFOTREE(9, nodep, "", "VRout"); if (nodep->access().isWriteOrRW() && nodep->varp()->direction() == VDirection::CONSTREF) { nodep->v3error("Assigning to const ref variable: " << nodep->prettyNameQ()); } else if (nodep->access().isWriteOrRW() && nodep->varp()->isInput() @@ -2848,7 +2849,7 @@ class WidthVisitor final : public VNVisitor { } if (!newp) newp = new AstConst{nodep->fileline(), AstConst::BitFalse{}}; - if (debug() >= 9) nodep->dumpTree("- dist-out: "); + UINFOTREE(9, nodep, "", "dist-out"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } @@ -2895,7 +2896,7 @@ class WidthVisitor final : public VNVisitor { EXTEND_EXP); } - if (debug() >= 9) nodep->dumpTree("- inside-in: "); + UINFOTREE(9, nodep, "", "inside-in"); // Now rip out the inside and replace with simple math AstNodeExpr* newp = nullptr; for (AstNodeExpr *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) { @@ -2905,7 +2906,7 @@ class WidthVisitor final : public VNVisitor { newp = newp ? new AstLogOr{nodep->fileline(), newp, inewp} : inewp; } if (!newp) newp = new AstConst{nodep->fileline(), AstConst::BitFalse{}}; - if (debug() >= 9) newp->dumpTree("- inside-out: "); + UINFOTREE(9, newp, "", "inside-out"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } @@ -2951,7 +2952,7 @@ class WidthVisitor final : public VNVisitor { void visit(AstNodeUOrStructDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed UINFO(5, " NODEUORS " << nodep); - // if (debug() >= 9) nodep->dumpTree("- class-in: "); + // UINFOTREE(9, nodep, "", "class-in"); if (!nodep->packed() && v3Global.opt.structsPacked()) nodep->packed(true); userIterateChildren(nodep, nullptr); // First size all members nodep->dtypep(nodep); @@ -3010,7 +3011,7 @@ class WidthVisitor final : public VNVisitor { } else { nodep->widthForce(1, 1); } - // if (debug() >= 9) nodep->dumpTree("- class-out: "); + // UINFOTREE(9, nodep, "", "class-out"); } void visit(AstClass* nodep) override { if (nodep->didWidthAndSet()) return; @@ -3088,9 +3089,9 @@ class WidthVisitor final : public VNVisitor { void visit(AstMemberSel* nodep) override { UINFO(5, " MEMBERSEL " << nodep); if (nodep->didWidth()) return; - if (debug() >= 9) nodep->dumpTree("- mbs-in: "); + UINFOTREE(9, nodep, "", "mbs-in"); userIterateChildren(nodep, WidthVP{SELF, BOTH}.p()); - if (debug() >= 9) nodep->dumpTree("- mbs-ic: "); + UINFOTREE(9, nodep, "", "mbs-ic"); // Find the fromp dtype - should be a class UASSERT_OBJ(nodep->fromp()->dtypep(), nodep->fromp(), "Unlinked data type"); AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump(); @@ -3335,7 +3336,7 @@ class WidthVisitor final : public VNVisitor { void visit(AstMethodCall* nodep) override { UINFO(5, " METHODCALL " << nodep); if (nodep->didWidth()) return; - if (debug() >= 9) nodep->dumpTree("- mts-in: "); + UINFOTREE(9, nodep, "", "mts-in"); // Should check types the method requires, but at present we don't do much userIterate(nodep->fromp(), WidthVP{SELF, BOTH}.p()); // Args are checked within each particular method's decode @@ -4869,7 +4870,7 @@ class WidthVisitor final : public VNVisitor { } else { nodep->v3error("Assignment pattern with no members"); } - // if (debug() >= 9) newp->dumpTree("- apat-out: "); + // UINFOTREE(9, newp, "", "apat-out"); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present } void patternAssoc(AstPattern* nodep, AstAssocArrayDType* arrayDtp, AstPatMember* defaultp) { @@ -4898,7 +4899,7 @@ class WidthVisitor final : public VNVisitor { newp = newap; } nodep->replaceWith(newp); - // if (debug() >= 9) newp->dumpTree("- apat-out: "); + // UINFOTREE(9, newp, "", "apat-out"); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present } void patternWildcard(AstPattern* nodep, AstWildcardArrayDType* arrayDtp, @@ -4918,7 +4919,7 @@ class WidthVisitor final : public VNVisitor { newp = newap; } nodep->replaceWith(newp); - // if (debug() >= 9) newp->dumpTree("- apat-out: "); + // UINFOTREE(9, newp, "", "apat-out"); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present } void patternDynArray(AstPattern* nodep, AstDynArrayDType* arrayp, AstPatMember*) { @@ -4937,7 +4938,7 @@ class WidthVisitor final : public VNVisitor { newp = newap; } nodep->replaceWith(newp); - // if (debug() >= 9) newp->dumpTree("- apat-out: "); + // UINFOTREE(9, newp, "", "apat-out"); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present } void patternQueue(AstPattern* nodep, AstQueueDType* arrayp, AstPatMember*) { @@ -4958,7 +4959,7 @@ class WidthVisitor final : public VNVisitor { newp = newap; } nodep->replaceWith(newp); - // if (debug() >= 9) newp->dumpTree("- apat-out: "); + // UINFOTREE(9, newp, "", "apat-out"); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present } void patternBasic(AstPattern* nodep, AstNodeDType* vdtypep, AstPatMember* defaultp) { @@ -5007,7 +5008,7 @@ class WidthVisitor final : public VNVisitor { } else { nodep->v3error("Assignment pattern with no members"); } - // if (debug() >= 9) newp->dumpTree("- apat-out: "); + // UINFOTREE(9, newp, "", "apat-out"); VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present } AstNodeExpr* patternMemberValueIterate(AstPatMember* patp) { @@ -5240,13 +5241,13 @@ class WidthVisitor final : public VNVisitor { } void visit(AstNodeIf* nodep) override { assertAtStatement(nodep); - // if (debug()) nodep->dumpTree("- IfPre: "); + // UINFOTREE(1, nodep, "", "IfPre"); if (!VN_IS(nodep, GenIf)) { // for m_paramsOnly userIterateAndNext(nodep->thensp(), nullptr); userIterateAndNext(nodep->elsesp(), nullptr); } iterateCheckBool(nodep, "If", nodep->condp(), BOTH); // it's like an if() condition. - // if (debug()) nodep->dumpTree("- IfOut: "); + // UINFOTREE(1, nodep, "", "IfOut"); } void visit(AstExprStmt* nodep) override { userIterateAndNext(nodep->stmtsp(), nullptr); @@ -5259,7 +5260,7 @@ class WidthVisitor final : public VNVisitor { nodep->didWidth(true); const AstSelLoopVars* const loopsp = VN_CAST(nodep->arrayp(), SelLoopVars); UASSERT_OBJ(loopsp, nodep, "No loop variables under foreach"); - // if (debug()) nodep->dumpTree("- foreach-old: "); + // UINFOTREE(1, nodep, "", "foreach-old"); userIterateAndNext(loopsp->fromp(), WidthVP{SELF, BOTH}.p()); AstNodeExpr* const fromp = loopsp->fromp(); UASSERT_OBJ(fromp->dtypep(), fromp, "Missing data type"); @@ -5320,19 +5321,19 @@ class WidthVisitor final : public VNVisitor { // handled in each visitor. // Then LHS sign-extends only if *RHS* is signed assertAtStatement(nodep); - // if (debug()) nodep->dumpTree("- AssignPre: "); + // UINFOTREE(1, nodep, "", "AssignPre"); { - // if (debug()) nodep->dumpTree("- assin:: "); + // UINFOTREE(1, nodep, "", "assin:"); userIterateAndNext(nodep->lhsp(), WidthVP{SELF, BOTH}.p()); UASSERT_OBJ(nodep->lhsp()->dtypep(), nodep, "How can LHS be untyped?"); UASSERT_OBJ(nodep->lhsp()->dtypep()->widthSized(), nodep, "How can LHS be unsized?"); nodep->dtypeFrom(nodep->lhsp()); // // AstPattern needs to know the proposed data type of the lhs, so pass on the prelim - // if (debug()) nodep->dumpTree("- assrhs: "); + // UINFOTREE(1, nodep, "", "assrhs"); userIterateAndNext(nodep->rhsp(), WidthVP{nodep->dtypep(), PRELIM}.p()); // - // if (debug()) nodep->dumpTree("- assign: "); + // UINFOTREE(1, nodep, "", "assign"); AstNodeDType* const lhsDTypep = nodep->lhsp()->dtypep(); // Note we use rhsp for context determined @@ -5372,7 +5373,7 @@ class WidthVisitor final : public VNVisitor { } iterateCheckAssign(nodep, "Assign RHS", nodep->rhsp(), FINAL, lhsDTypep); - // if (debug()) nodep->dumpTree("- AssignOut: "); + // UINFOTREE(1, nodep, "", "AssignOut"); } if (AstNode* const controlp = nodep->timingControlp()) { if (VN_IS(m_ftaskp, Func)) { @@ -5840,7 +5841,7 @@ class WidthVisitor final : public VNVisitor { iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. } void visit(AstPin* nodep) override { - // if (debug()) nodep->dumpTree("- PinPre: "); + // UINFOTREE(1, nodep, "", "PinPre"); // TOP LEVEL NODE if (nodep->modVarp() && nodep->modVarp()->isGParam()) { // Widthing handled as special init() case @@ -5969,7 +5970,7 @@ class WidthVisitor final : public VNVisitor { iterateCheckAssign(nodep, "pin connection", nodep->exprp(), FINAL, subDTypep); } } - // if (debug()) nodep->dumpTree("- PinOut: "); + // UINFOTREE(1, nodep, "", "PinOut"); } void visit(AstCell* nodep) override { VL_RESTORER(m_cellp); @@ -6142,7 +6143,7 @@ class WidthVisitor final : public VNVisitor { } } } - // if (debug()) nodep->dumpTree("- FuncOut: "); + // UINFOTREE(1, nodep, "", "FuncOut"); } // Returns true if dtypep0 and dtypep1 have same dimensions static bool areSameSize(AstUnpackArrayDType* dtypep0, AstUnpackArrayDType* dtypep1) { @@ -7081,7 +7082,7 @@ class WidthVisitor final : public VNVisitor { // because the rhs could be larger, and we need to have proper editing to get the widths // to be the same for our operations. // - // if (debug() >= 9) { UINFO(0, "rus " << m_vup); nodep->dumpTree("- rusin: "); } + // UINFOTREE(9, nodep, "rus " << m_vup, "rusin"); if (m_vup->prelim()) { // First stage evaluation // Determine expression widths only relying on what's in the subops userIterateAndNext(nodep->lhsp(), WidthVP{CONTEXT_DET, PRELIM}.p()); @@ -7137,7 +7138,7 @@ class WidthVisitor final : public VNVisitor { iterateCheck(nodep, "RHS", nodep->rhsp(), CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP, rhsWarn); } - // if (debug() >= 9) nodep->dumpTree("- rusou: "); + // UINFOTREE(9, nodep, "", "rusou"); } void visit_real_add_sub(AstNodeBiop* nodep) { // CALLER: AddD, MulD, ... @@ -7290,8 +7291,8 @@ class WidthVisitor final : public VNVisitor { num.opRepl(constp->num(), expWidth); // {width{'1}} AstNodeExpr* const newp = new AstConst{constp->fileline(), num}; // Spec says always unsigned with proper width - if (debug() > 4) constp->dumpTree("- fixAutoExtend_old: "); - if (debug() > 4) newp->dumpTree("- _new: "); + UINFOTREE(5, constp, "", "fixAutoExtend_old"); + UINFOTREE(5, newp, "", "_new"); constp->replaceWith(newp); VL_DO_DANGLING(constp->deleteTree(), constp); // Tell caller the new constp, and that we changed it. @@ -7309,8 +7310,8 @@ class WidthVisitor final : public VNVisitor { num.opExtendXZ(constp->num(), constp->width()); AstNodeExpr* const newp = new AstConst{constp->fileline(), num}; // Spec says always unsigned with proper width - if (debug() > 4) constp->dumpTree("- fixUnszExtend_old: "); - if (debug() > 4) newp->dumpTree("- _new: "); + UINFOTREE(5, constp, "", "fixUnszExtend_old"); + UINFOTREE(5, newp, "", "_new"); constp->replaceWith(newp); VL_DO_DANGLING(constp->deleteTree(), constp); // Tell caller the new constp, and that we changed it. @@ -7477,7 +7478,7 @@ class WidthVisitor final : public VNVisitor { void iterateCheckAssign(AstNode* nodep, const char* side, AstNode* rhsp, Stage stage, AstNodeDType* lhsDTypep) { // Check using assignment-like context rules - // if (debug()) nodep->dumpTree("- checkass: "); + // UINFOTREE(1, nodep, "", "checkass"); UASSERT_OBJ(stage == FINAL, nodep, "Bad width call"); // Create unpacked byte from string see IEEE 1800-2023 5.9 if (AstConst* constp = VN_CAST(rhsp, Const)) { @@ -7517,7 +7518,7 @@ class WidthVisitor final : public VNVisitor { = (VN_IS(nodep, NodeAssign) && VN_IS(VN_AS(nodep, NodeAssign)->lhsp(), NodeStream)); rhsp = iterateCheck(nodep, side, rhsp, ASSIGN, FINAL, lhsDTypep, lhsStream ? EXTEND_OFF : EXTEND_LHS); - // if (debug()) nodep->dumpTree("- checkout: "); + // UINFOTREE(1, nodep, "", "checkout"); (void)rhsp; // cppcheck } @@ -7558,7 +7559,7 @@ class WidthVisitor final : public VNVisitor { const bool bad = widthBad(underp, nodep->findBitDType()); if (bad) { { // if (warnOn), but not needed here - if (debug() > 4) nodep->backp()->dumpTree("- back: "); + UINFOTREE(5, nodep->backp(), "", "back"); nodep->v3widthWarn(1, underp->width(), "Logical operator " << nodep->prettyTypeName() << " expects 1 bit on the " @@ -7627,7 +7628,7 @@ class WidthVisitor final : public VNVisitor { << " (IEEE 1800-2023 6.19.3)\n" << nodep->warnMore() << "... Suggest use enum's mnemonic, or static cast"); - // if (debug()) nodep->backp()->dumpTree("- back: "); + // UINFOTREE(1, nodep->backp(), "", "back"); } } AstNodeDType* subDTypep = expDTypep; @@ -7747,7 +7748,7 @@ class WidthVisitor final : public VNVisitor { warnOn = false; } if (bad && warnOn) { - if (debug() > 4) nodep->backp()->dumpTree("- back: "); + UINFOTREE(5, nodep->backp(), "", "back"); nodep->v3widthWarn( expWidth, underp->width(), diff --git a/src/V3WidthCommit.cpp b/src/V3WidthCommit.cpp index 53e2e152f..0f1c841ba 100644 --- a/src/V3WidthCommit.cpp +++ b/src/V3WidthCommit.cpp @@ -161,8 +161,8 @@ private: nodep->replaceWith(newp); AstNode* const oldp = nodep; nodep = newp; - // if (debug() > 4) oldp->dumpTree("- fixConstSize_old: "); - // if (debug() > 4) newp->dumpTree("- _new: "); + // UINFOTREE(5, oldp, "", "fixConstSize_old"); + // UINFOTREE(5, newp, "", "_new"); VL_DO_DANGLING(pushDeletep(oldp), oldp); } editDType(nodep); diff --git a/src/V3WidthSel.cpp b/src/V3WidthSel.cpp index b53e2ae3c..139006d68 100644 --- a/src/V3WidthSel.cpp +++ b/src/V3WidthSel.cpp @@ -227,11 +227,11 @@ class WidthSelVisitor final : public VNVisitor { // Select of a non-width specified part of an array, i.e. "array[2]" // This select style has a lsb and msb (no user specified width) UINFO(6, "SELBIT " << nodep); - if (debug() >= 9) nodep->backp()->dumpTree("- SELBT0: "); + UINFOTREE(9, nodep->backp(), "", "SELBT0"); // lhsp/rhsp do not need to be constant AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack(); AstNodeExpr* const rhsp = nodep->bitp()->unlinkFrBack(); // bit we're extracting - if (debug() >= 9) nodep->dumpTree("- SELBT2: "); + UINFOTREE(9, nodep, "", "SELBT2"); const FromData fromdata = fromDataForArray(nodep, fromp); AstNodeDType* const ddtypep = fromdata.m_dtypep; const VNumRange fromRange = fromdata.m_fromRange; @@ -244,7 +244,7 @@ class WidthSelVisitor final : public VNVisitor { } AstArraySel* const newp = new AstArraySel{nodep->fileline(), fromp, subp}; newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference - if (debug() >= 9) newp->dumpTree("- SELBTn: "); + UINFOTREE(9, newp, "", "SELBTn"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (const AstPackArrayDType* const adtypep = VN_CAST(ddtypep, PackArrayDType)) { @@ -266,14 +266,14 @@ class WidthSelVisitor final : public VNVisitor { newp->declRange(fromRange); newp->declElWidth(elwidth); newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference - if (debug() >= 9) newp->dumpTree("- SELBTn: "); + UINFOTREE(9, newp, "", "SELBTn"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (const AstAssocArrayDType* const adtypep = VN_CAST(ddtypep, AssocArrayDType)) { // SELBIT(array, index) -> ASSOCSEL(array, index) AstAssocSel* const newp = new AstAssocSel{nodep->fileline(), fromp, rhsp}; newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference - if (debug() >= 9) newp->dumpTree("- SELBTn: "); + UINFOTREE(9, newp, "", "SELBTn"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (const AstWildcardArrayDType* const adtypep @@ -281,7 +281,7 @@ class WidthSelVisitor final : public VNVisitor { // SELBIT(array, index) -> WILDCARDSEL(array, index) AstWildcardSel* const newp = new AstWildcardSel{nodep->fileline(), fromp, rhsp}; newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference - if (debug() >= 9) newp->dumpTree("- SELBTn: "); + UINFOTREE(9, newp, "", "SELBTn"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (const AstDynArrayDType* const adtypep = VN_CAST(ddtypep, DynArrayDType)) { @@ -290,7 +290,7 @@ class WidthSelVisitor final : public VNVisitor { AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, methodName, rhsp}; newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference - if (debug() >= 9) newp->dumpTree("- SELBTq: "); + UINFOTREE(9, newp, "", "SELBTq"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (const AstQueueDType* const adtypep = VN_CAST(ddtypep, QueueDType)) { @@ -304,7 +304,7 @@ class WidthSelVisitor final : public VNVisitor { newp = new AstCMethodHard{nodep->fileline(), fromp, methodName, rhsp}; } newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference - if (debug() >= 9) newp->dumpTree("- SELBTq: "); + UINFOTREE(9, newp, "", "SELBTq"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (VN_IS(ddtypep, BasicDType) && ddtypep->isString()) { @@ -335,7 +335,7 @@ class WidthSelVisitor final : public VNVisitor { = new AstSel{nodep->fileline(), fromp, newSubLsbOf(rhsp, fromRange), 1}; newp->declRange(fromRange); UINFO(6, " new " << newp); - if (debug() >= 9) newp->dumpTree("- SELBTn: "); + UINFOTREE(9, newp, "", "SELBTn"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (VN_IS(ddtypep, NodeUOrStructDType)) { // A bit from the packed struct @@ -344,7 +344,7 @@ class WidthSelVisitor final : public VNVisitor { = new AstSel{nodep->fileline(), fromp, newSubLsbOf(rhsp, fromRange), 1}; newp->declRange(fromRange); UINFO(6, " new " << newp); - if (debug() >= 9) newp->dumpTree("- SELBTn: "); + UINFOTREE(9, newp, "", "SELBTn"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { // nullptr=bad extract, or unknown node type @@ -361,11 +361,11 @@ class WidthSelVisitor final : public VNVisitor { // SELEXTRACT(from,msb,lsb) -> SEL(from, lsb, 1+msb-lsb) // This select style has a (msb or lsb) and width UINFO(6, "SELEXTRACT " << nodep); - // if (debug() >= 9) nodep->dumpTree("- SELEX0: "); + // UINFOTREE(9, nodep, "", "SELEX0"); // Below 2 lines may change nodep->widthp() V3Const::constifyParamsNoWarnEdit(nodep->leftp()); // May relink pointed to node V3Const::constifyParamsNoWarnEdit(nodep->rightp()); // May relink pointed to node - // if (debug() >= 9) nodep->dumpTree("- SELEX3: "); + // UINFOTREE(9, nodep, "", "SELEX3"); AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack(); const FromData fromdata = fromDataForArray(nodep, fromp); AstNodeDType* const ddtypep = fromdata.m_dtypep; @@ -451,7 +451,7 @@ class WidthSelVisitor final : public VNVisitor { newp->declRange(fromRange); newp->declElWidth(elwidth); newp->dtypeFrom(sliceDType(adtypep, msb, lsb)); - // if (debug() >= 9) newp->dumpTree("- EXTBTn: "); + // UINFOTREE(9, newp, "", "EXTBTn"); UASSERT_OBJ(newp->widthMin() == newp->widthConst(), nodep, "Width mismatch"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); @@ -476,7 +476,7 @@ class WidthSelVisitor final : public VNVisitor { msb + 1 - lsb}; newp->declRange(fromRange); UINFO(6, " new " << newp); - // if (debug() >= 9) newp->dumpTree("- SELEXnew: "); + // UINFOTREE(9, newp, "", "SELEXnew"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else if (VN_IS(ddtypep, NodeUOrStructDType)) { @@ -495,7 +495,7 @@ class WidthSelVisitor final : public VNVisitor { msb + 1 - lsb}; newp->declRange(fromRange); UINFO(6, " new " << newp); - // if (debug() >= 9) newp->dumpTree("- SELEXnew: "); + // UINFOTREE(9, newp, "", "SELEXnew"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { // nullptr=bad extract, or unknown node type @@ -517,13 +517,13 @@ class WidthSelVisitor final : public VNVisitor { // This select style has a lsb and width UINFO(6, "SELPLUS/MINUS " << nodep); // Below 2 lines may change nodep->widthp() - if (debug() >= 9) nodep->dumpTree("- SELPM0: "); + UINFOTREE(9, nodep, "", "SELPM0"); V3Width::widthParamsEdit(nodep->rhsp()); // constifyEdit doesn't ensure widths finished V3Const::constifyEdit(nodep->rhsp()); // May relink pointed to node, ok if not const V3Const::constifyParamsEdit(nodep->thsp()); // May relink pointed to node checkConstantOrReplace(nodep->thsp(), "Width of :+ or :- bit slice range isn't a constant"); - if (debug() >= 9) nodep->dumpTree("- SELPM3: "); + UINFOTREE(9, nodep, "", "SELPM3"); // Now replace it with an AstSel AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack(); AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack(); @@ -600,7 +600,7 @@ class WidthSelVisitor final : public VNVisitor { newp->declRange(fromRange); newp->declElWidth(elwidth); UINFO(6, " new " << newp); - if (debug() >= 9) newp->dumpTree("- SELNEW: "); + UINFOTREE(9, newp, "", "SELNEW"); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } else { // nullptr=bad extract, or unknown node type