Internals: Cleanup debug dumps so can grep-out leading-dashed lines

This commit is contained in:
Wilson Snyder 2022-11-27 08:31:22 -05:00
parent 5f583b0680
commit 2c7f1ef40f
36 changed files with 227 additions and 227 deletions

View File

@ -363,7 +363,7 @@ private:
AstNode* const assp = new AstAssignDly{ AstNode* const assp = new AstAssignDly{
nodep->fileline(), new AstVarRef{nodep->fileline(), outvarp, VAccess::WRITE}, inp}; nodep->fileline(), new AstVarRef{nodep->fileline(), outvarp, VAccess::WRITE}, inp};
alwaysp->addStmtsp(assp); alwaysp->addStmtsp(assp);
// if (debug() >= 9) assp->dumpTree(cout, "-ass: "); // if (debug() >= 9) assp->dumpTree("- ass: ");
invarp = outvarp; invarp = outvarp;
inp = new AstVarRef{nodep->fileline(), invarp, VAccess::READ}; inp = new AstVarRef{nodep->fileline(), invarp, VAccess::READ};
} }

View File

@ -226,9 +226,9 @@ void AstNode::debugTreeChange(const AstNode* nodep, const char* prefix, int line
// // Commenting out the section below may crash, as the tree state // // Commenting out the section below may crash, as the tree state
// // between edits is not always consistent for printing // // between edits is not always consistent for printing
// cout<<"-treeChange: V3Ast.cpp:"<<lineno<<" Tree Change for "<<prefix<<endl; // cout<<"-treeChange: V3Ast.cpp:"<<lineno<<" Tree Change for "<<prefix<<endl;
// v3Global.rootp()->dumpTree(cout, "-treeChange: "); // v3Global.rootp()->dumpTree("- treeChange: ");
// if (next||1) this->dumpTreeAndNext(cout, prefix); // if (next||1) this->dumpTreeAndNext(cout, prefix);
// else this->dumpTree(cout, prefix); // else this->dumpTree(prefix);
// this->checkTree(); // this->checkTree();
// v3Global.rootp()->checkTree(); // v3Global.rootp()->checkTree();
//} //}

View File

@ -1909,7 +1909,7 @@ public:
void dumpTree(std::ostream& os = std::cout, const string& indent = " ", void dumpTree(std::ostream& os = std::cout, const string& indent = " ",
int maxDepth = 0) const; int maxDepth = 0) const;
void dumpTree(const string& indent, int maxDepth = 0) const { void dumpTree(const string& indent, int maxDepth = 0) const {
dumpTree(cout, indent, maxDepth); dumpTree(std::cout, indent, maxDepth);
} }
static void dumpTreeGdb(const AstNode* nodep); // For GDB only static void dumpTreeGdb(const AstNode* nodep); // For GDB only
void dumpTreeAndNext(std::ostream& os = std::cout, const string& indent = " ", void dumpTreeAndNext(std::ostream& os = std::cout, const string& indent = " ",

View File

@ -170,7 +170,7 @@ private:
for (AstCaseItem* itemp = nodep->itemsp(); itemp; for (AstCaseItem* itemp = nodep->itemsp(); itemp;
itemp = VN_AS(itemp->nextp(), CaseItem)) { itemp = VN_AS(itemp->nextp(), CaseItem)) {
for (AstNode* icondp = itemp->condsp(); icondp; icondp = icondp->nextp()) { for (AstNode* icondp = itemp->condsp(); icondp; icondp = icondp->nextp()) {
// if (debug() >= 9) icondp->dumpTree(cout, " caseitem: "); // if (debug() >= 9) icondp->dumpTree("- caseitem: ");
AstConst* const iconstp = VN_AS(icondp, Const); AstConst* const iconstp = VN_AS(icondp, Const);
UASSERT_OBJ(iconstp, nodep, "above 'can't parse' should have caught this"); UASSERT_OBJ(iconstp, nodep, "above 'can't parse' should have caught this");
if (neverItem(nodep, iconstp)) { if (neverItem(nodep, iconstp)) {
@ -331,7 +331,7 @@ private:
} }
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
VL_DO_DANGLING(cexprp->deleteTree(), cexprp); VL_DO_DANGLING(cexprp->deleteTree(), cexprp);
if (debug() >= 9) ifrootp->dumpTree(cout, " _simp: "); if (debug() >= 9) ifrootp->dumpTree("- _simp: ");
} }
void replaceCaseComplicated(AstCase* nodep) { void replaceCaseComplicated(AstCase* nodep) {
@ -342,7 +342,7 @@ private:
AstNodeExpr* const cexprp = nodep->exprp()->unlinkFrBack(); AstNodeExpr* const cexprp = nodep->exprp()->unlinkFrBack();
// We'll do this in two stages. First stage, convert the conditions to // We'll do this in two stages. First stage, convert the conditions to
// the appropriate IF AND terms. // the appropriate IF AND terms.
if (debug() >= 9) nodep->dumpTree(cout, " _comp_IN: "); if (debug() >= 9) nodep->dumpTree("- _comp_IN::: ");
bool hadDefault = false; bool hadDefault = false;
for (AstCaseItem* itemp = nodep->itemsp(); itemp; for (AstCaseItem* itemp = nodep->itemsp(); itemp;
itemp = VN_AS(itemp->nextp(), CaseItem)) { itemp = VN_AS(itemp->nextp(), CaseItem)) {
@ -409,7 +409,7 @@ private:
nodep->addItemsp(new AstCaseItem{ nodep->addItemsp(new AstCaseItem{
nodep->fileline(), new AstConst{nodep->fileline(), AstConst::BitTrue{}}, nullptr}); nodep->fileline(), new AstConst{nodep->fileline(), AstConst::BitTrue{}}, nullptr});
} }
if (debug() >= 9) nodep->dumpTree(cout, " _comp_COND: "); if (debug() >= 9) nodep->dumpTree("- _comp_COND: ");
// Now build the IF statement tree // Now build the IF statement tree
// The tree can be quite huge. Pull ever group of 8 out, and make a OR 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 // This reduces the depth for the bottom elements, at the cost of
@ -459,11 +459,11 @@ private:
itemnextp = newp; itemnextp = newp;
} }
} }
if (debug() >= 9) nodep->dumpTree(cout, " _comp_TREE: "); if (debug() >= 9) nodep->dumpTree("- _comp_TREE: ");
// Handle any assertions // Handle any assertions
replaceCaseParallel(nodep, false); replaceCaseParallel(nodep, false);
// Replace the CASE... with IF... // Replace the CASE... with IF...
if (debug() >= 9 && grouprootp) grouprootp->dumpTree(cout, " _new: "); if (debug() >= 9 && grouprootp) grouprootp->dumpTree("- _new: ");
if (grouprootp) { if (grouprootp) {
nodep->replaceWith(grouprootp); nodep->replaceWith(grouprootp);
} else { } else {
@ -498,7 +498,7 @@ private:
void visit(AstCase* nodep) override { void visit(AstCase* nodep) override {
V3Case::caseLint(nodep); V3Case::caseLint(nodep);
iterateChildren(nodep); iterateChildren(nodep);
if (debug() >= 9) nodep->dumpTree(cout, " case_old: "); if (debug() >= 9) nodep->dumpTree("- case_old: ");
if (isCaseTreeFast(nodep) && v3Global.opt.fCase()) { if (isCaseTreeFast(nodep) && v3Global.opt.fCase()) {
// It's a simple priority encoder or complete statement // It's a simple priority encoder or complete statement
// we can make a tree of statements to avoid extra comparisons // we can make a tree of statements to avoid extra comparisons

View File

@ -71,7 +71,7 @@ private:
AstCCast* const castp AstCCast* const castp
= new AstCCast{nodep->fileline(), nodep, needsize, nodep->widthMin()}; = new AstCCast{nodep->fileline(), nodep, needsize, nodep->widthMin()};
relinkHandle.relink(castp); relinkHandle.relink(castp);
// if (debug() > 8) castp->dumpTree(cout, "-castins: "); // if (debug() > 8) castp->dumpTree("- castins: ");
// //
ensureLower32Cast(castp); ensureLower32Cast(castp);
nodep->user1(1); // Now must be of known size nodep->user1(1); // Now must be of known size

View File

@ -251,7 +251,7 @@ private:
if (false && debug() >= 9) { if (false && debug() >= 9) {
UINFO(9, "Trace Logic:\n"); UINFO(9, "Trace Logic:\n");
nodep->dumpTree(cout, "-log1: "); nodep->dumpTree("- log1: ");
} }
} }
} }

View File

@ -122,7 +122,7 @@ private:
} }
// VISITORS // VISITORS
void visit(AstCoverToggle* nodep) override { void visit(AstCoverToggle* nodep) override {
// nodep->dumpTree(cout, "ct:"); // nodep->dumpTree("- ct: ");
// COVERTOGGLE(INC, ORIG, CHANGE) -> // COVERTOGGLE(INC, ORIG, CHANGE) ->
// IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; } // IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; }
AstNode* const incp = nodep->incp()->unlinkFrBack(); AstNode* const incp = nodep->incp()->unlinkFrBack();

View File

@ -366,7 +366,7 @@ class ConstBitOpTreeVisitor final : public VNVisitor {
if (fail && !m_failed) { if (fail && !m_failed) {
UINFO(9, "cannot optimize " << m_rootp << " reason:" << reason << " called from line:" UINFO(9, "cannot optimize " << m_rootp << " reason:" << reason << " called from line:"
<< line << " when checking:" << nodep << std::endl); << line << " when checking:" << nodep << std::endl);
// if (debug() >= 9) m_rootp->dumpTree(std::cout << "Root node:\n"); // if (debug() >= 9) m_rootp->dumpTree("- root: ");
m_failed = true; m_failed = true;
} }
return m_failed; return m_failed;
@ -752,16 +752,16 @@ public:
if (needsCleaning) ++resultOps; if (needsCleaning) ++resultOps;
if (debug() >= 9) { // LCOV_EXCL_START if (debug() >= 9) { // LCOV_EXCL_START
cout << "Bitop tree considered: " << endl; cout << "- Bitop tree considered: " << endl;
for (AstNodeExpr* const termp : termps) termp->dumpTree("Reduced term: "); for (AstNodeExpr* const termp : termps) termp->dumpTree("- Reduced term: ");
for (const std::pair<AstNodeExpr*, FrozenNodeInfo>& termp : visitor.m_frozenNodes) { for (const std::pair<AstNodeExpr*, FrozenNodeInfo>& termp : visitor.m_frozenNodes) {
termp.first->dumpTree("Frozen term with lsb " + std::to_string(termp.second.m_lsb) termp.first->dumpTree("- Frozen term with lsb "
+ " polarity " + std::to_string(termp.second.m_polarity) + std::to_string(termp.second.m_lsb) + " polarity "
+ ": "); + std::to_string(termp.second.m_polarity) + ": ");
} }
cout << "Needs flipping: " << needsFlip << endl; cout << "- Needs flipping: " << needsFlip << endl;
cout << "Needs cleaning: " << needsCleaning << endl; cout << "- Needs cleaning: " << needsCleaning << endl;
cout << "Size: " << resultOps << " input size: " << visitor.m_ops << endl; cout << "- Size: " << resultOps << " input size: " << visitor.m_ops << endl;
} // LCOV_EXCL_END } // LCOV_EXCL_END
// Sometimes we have no terms left after ignoring redundant terms // Sometimes we have no terms left after ignoring redundant terms
@ -1148,7 +1148,7 @@ private:
string debugPrefix; string debugPrefix;
if (debug() >= 9) { // LCOV_EXCL_START if (debug() >= 9) { // LCOV_EXCL_START
static int c = 0; static int c = 0;
debugPrefix = "matchBitOpTree["; debugPrefix = "- matchBitOpTree[";
debugPrefix += cvtToStr(++c); debugPrefix += cvtToStr(++c);
debugPrefix += "] "; debugPrefix += "] ";
nodep->dumpTree(debugPrefix + "INPUT: "); nodep->dumpTree(debugPrefix + "INPUT: ");
@ -1277,12 +1277,12 @@ private:
if (!(m_doV && bip && VN_IS(nodep->lsbp(), Const) && VN_IS(nodep->widthp(), Const) if (!(m_doV && bip && VN_IS(nodep->lsbp(), Const) && VN_IS(nodep->widthp(), Const)
&& nodep->lsbConst() == 0)) && nodep->lsbConst() == 0))
return false; return false;
if (debug() >= 9) nodep->dumpTree(cout, "SEL(BI)-in:"); if (debug() >= 9) nodep->dumpTree("- SEL(BI)-in: ");
AstNodeExpr* const bilhsp = bip->lhsp()->unlinkFrBack(); AstNodeExpr* const bilhsp = bip->lhsp()->unlinkFrBack();
AstNodeExpr* const birhsp = bip->rhsp()->unlinkFrBack(); AstNodeExpr* const birhsp = bip->rhsp()->unlinkFrBack();
bip->lhsp(new AstSel{nodep->fileline(), bilhsp, 0, nodep->widthConst()}); bip->lhsp(new AstSel{nodep->fileline(), bilhsp, 0, nodep->widthConst()});
bip->rhsp(new AstSel{nodep->fileline(), birhsp, 0, nodep->widthConst()}); bip->rhsp(new AstSel{nodep->fileline(), birhsp, 0, nodep->widthConst()});
if (debug() >= 9) bip->dumpTree(cout, "SEL(BI)-ou:"); if (debug() >= 9) bip->dumpTree("- SEL(BI)-ou: ");
VL_DO_DANGLING(replaceWChild(nodep, bip), nodep); VL_DO_DANGLING(replaceWChild(nodep, bip), nodep);
return true; return true;
} }
@ -1306,11 +1306,11 @@ private:
if (newLsb + nodep->widthConst() > ap->width()) return false; if (newLsb + nodep->widthConst() > ap->width()) return false;
// //
UINFO(9, "SEL(SHIFTR(a,b),l,w) -> SEL(a,l+b,w)\n"); UINFO(9, "SEL(SHIFTR(a,b),l,w) -> SEL(a,l+b,w)\n");
if (debug() >= 9) nodep->dumpTree(cout, "SEL(SH)-in:"); if (debug() >= 9) nodep->dumpTree("- SEL(SH)-in: ");
AstSel* const newp AstSel* const newp
= new AstSel{nodep->fileline(), ap->unlinkFrBack(), newLsb, nodep->widthConst()}; = new AstSel{nodep->fileline(), ap->unlinkFrBack(), newLsb, nodep->widthConst()};
newp->dtypeFrom(nodep); newp->dtypeFrom(nodep);
if (debug() >= 9) newp->dumpTree(cout, "SEL(SH)-ou:"); if (debug() >= 9) newp->dumpTree("- SEL(SH)-ou: ");
VL_DO_DANGLING(nodep->replaceWith(newp), nodep); VL_DO_DANGLING(nodep->replaceWith(newp), nodep);
return true; return true;
} }
@ -1328,7 +1328,7 @@ private:
if (!constp) return false; if (!constp) return false;
if (!constp->num().isBitsZero(constp->width() - 1, subsize)) return false; if (!constp->num().isBitsZero(constp->width() - 1, subsize)) return false;
// //
if (debug() >= 9) nodep->dumpTree(cout, "BI(EXTEND)-in:"); if (debug() >= 9) nodep->dumpTree("- BI(EXTEND)-in: ");
smallerp->unlinkFrBack(); smallerp->unlinkFrBack();
VL_DO_DANGLING(extendp->unlinkFrBack()->deleteTree(), extendp); // aka nodep->lhsp. VL_DO_DANGLING(extendp->unlinkFrBack()->deleteTree(), extendp); // aka nodep->lhsp.
nodep->rhsp(smallerp); nodep->rhsp(smallerp);
@ -1338,7 +1338,7 @@ private:
num.opAssign(constp->num()); num.opAssign(constp->num());
nodep->lhsp(new AstConst{constp->fileline(), num}); nodep->lhsp(new AstConst{constp->fileline(), num});
VL_DO_DANGLING(constp->deleteTree(), constp); VL_DO_DANGLING(constp->deleteTree(), constp);
if (debug() >= 9) nodep->dumpTree(cout, "BI(EXTEND)-ou:"); if (debug() >= 9) nodep->dumpTree("- BI(EXTEND)-ou: ");
return true; return true;
} }
bool operandBiExtendConstOver(const AstNodeBiop* nodep) { bool operandBiExtendConstOver(const AstNodeBiop* nodep) {
@ -1553,8 +1553,8 @@ private:
"Already constant??"); "Already constant??");
AstNode* const newp = new AstConst{oldp->fileline(), num}; AstNode* const newp = new AstConst{oldp->fileline(), num};
newp->dtypeFrom(oldp); newp->dtypeFrom(oldp);
if (debug() > 5) oldp->dumpTree(cout, " const_old: "); if (debug() > 5) oldp->dumpTree("- const_old: ");
if (debug() > 5) newp->dumpTree(cout, " _new: "); if (debug() > 5) newp->dumpTree("- _new: ");
oldp->replaceWith(newp); oldp->replaceWith(newp);
VL_DO_DANGLING(oldp->deleteTree(), oldp); VL_DO_DANGLING(oldp->deleteTree(), oldp);
} }
@ -1629,8 +1629,8 @@ private:
// Replace oldp node with a constant set to specified value // Replace oldp node with a constant set to specified value
UASSERT(oldp, "Null old"); UASSERT(oldp, "Null old");
AstNode* const newp = new AstConst{oldp->fileline(), AstConst::String{}, num}; AstNode* const newp = new AstConst{oldp->fileline(), AstConst::String{}, num};
if (debug() > 5) oldp->dumpTree(cout, " const_old: "); if (debug() > 5) oldp->dumpTree("- const_old: ");
if (debug() > 5) newp->dumpTree(cout, " _new: "); if (debug() > 5) newp->dumpTree("- _new: ");
oldp->replaceWith(newp); oldp->replaceWith(newp);
VL_DO_DANGLING(oldp->deleteTree(), oldp); VL_DO_DANGLING(oldp->deleteTree(), oldp);
} }
@ -1688,7 +1688,7 @@ private:
void replaceAsv(AstNodeBiop* nodep) { void replaceAsv(AstNodeBiop* nodep) {
// BIASV(CONSTa, BIASV(CONSTb, c)) -> BIASV( BIASV_CONSTED(a,b), c) // BIASV(CONSTa, BIASV(CONSTb, c)) -> BIASV( BIASV_CONSTED(a,b), c)
// BIASV(SAMEa, BIASV(SAMEb, c)) -> BIASV( BIASV(SAMEa,SAMEb), c) // BIASV(SAMEa, BIASV(SAMEb, c)) -> BIASV( BIASV(SAMEa,SAMEb), c)
// nodep->dumpTree(cout, " repAsvConst_old: "); // nodep->dumpTree("- repAsvConst_old: ");
AstNodeExpr* const ap = nodep->lhsp(); AstNodeExpr* const ap = nodep->lhsp();
AstNodeBiop* const rp = VN_AS(nodep->rhsp(), NodeBiop); AstNodeBiop* const rp = VN_AS(nodep->rhsp(), NodeBiop);
AstNodeExpr* const bp = rp->lhsp(); AstNodeExpr* const bp = rp->lhsp();
@ -1702,7 +1702,7 @@ private:
rp->lhsp(ap); rp->lhsp(ap);
rp->rhsp(bp); rp->rhsp(bp);
if (VN_IS(rp->lhsp(), Const) && VN_IS(rp->rhsp(), Const)) replaceConst(rp); if (VN_IS(rp->lhsp(), Const) && VN_IS(rp->rhsp(), Const)) replaceConst(rp);
// nodep->dumpTree(cout, " repAsvConst_new: "); // nodep->dumpTree("- repAsvConst_new: ");
} }
void replaceAsvLUp(AstNodeBiop* nodep) { void replaceAsvLUp(AstNodeBiop* nodep) {
// BIASV(BIASV(CONSTll,lr),r) -> BIASV(CONSTll,BIASV(lr,r)) // BIASV(BIASV(CONSTll,lr),r) -> BIASV(CONSTll,BIASV(lr,r))
@ -1714,7 +1714,7 @@ private:
nodep->rhsp(lp); nodep->rhsp(lp);
lp->lhsp(lrp); lp->lhsp(lrp);
lp->rhsp(rp); lp->rhsp(rp);
// nodep->dumpTree(cout, " repAsvLUp_new: "); // nodep->dumpTree("- repAsvLUp_new: ");
} }
void replaceAsvRUp(AstNodeBiop* nodep) { void replaceAsvRUp(AstNodeBiop* nodep) {
// BIASV(l,BIASV(CONSTrl,rr)) -> BIASV(CONSTrl,BIASV(l,rr)) // BIASV(l,BIASV(CONSTrl,rr)) -> BIASV(CONSTrl,BIASV(l,rr))
@ -1726,7 +1726,7 @@ private:
nodep->rhsp(rp); nodep->rhsp(rp);
rp->lhsp(lp); rp->lhsp(lp);
rp->rhsp(rrp); rp->rhsp(rrp);
// nodep->dumpTree(cout, " repAsvRUp_new: "); // nodep->dumpTree("- repAsvRUp_new: ");
} }
void replaceAndOr(AstNodeBiop* nodep) { void replaceAndOr(AstNodeBiop* nodep) {
// OR (AND (CONSTll,lr), AND(CONSTrl==ll,rr)) -> AND (CONSTll, OR(lr,rr)) // OR (AND (CONSTll,lr), AND(CONSTrl==ll,rr)) -> AND (CONSTll, OR(lr,rr))
@ -1759,7 +1759,7 @@ private:
} else { } else {
nodep->v3fatalSrc("replaceAndOr on something operandAndOrSame shouldn't have matched"); nodep->v3fatalSrc("replaceAndOr on something operandAndOrSame shouldn't have matched");
} }
// nodep->dumpTree(cout, " repAndOr_new: "); // nodep->dumpTree("- repAndOr_new: ");
} }
void replaceShiftSame(AstNodeBiop* nodep) { void replaceShiftSame(AstNodeBiop* nodep) {
// Or(Shift(ll,CONSTlr),Shift(rl,CONSTrr==lr)) -> Shift(Or(ll,rl),CONSTlr) // Or(Shift(ll,CONSTlr),Shift(rl,CONSTrr==lr)) -> Shift(Or(ll,rl),CONSTlr)
@ -1778,7 +1778,7 @@ private:
nodep->dtypep(llp->dtypep()); // dtype of Biop is before shift. nodep->dtypep(llp->dtypep()); // dtype of Biop is before shift.
VL_DO_DANGLING(rp->deleteTree(), rp); VL_DO_DANGLING(rp->deleteTree(), rp);
VL_DO_DANGLING(rrp->deleteTree(), rrp); VL_DO_DANGLING(rrp->deleteTree(), rrp);
// nodep->dumpTree(cout, " repShiftSame_new: "); // nodep->dumpTree("- repShiftSame_new: ");
} }
void replaceConcatSel(AstConcat* nodep) { void replaceConcatSel(AstConcat* nodep) {
// {a[1], a[0]} -> a[1:0] // {a[1], a[0]} -> a[1:0]
@ -1902,7 +1902,7 @@ private:
} }
void replaceShiftShift(AstNodeBiop* nodep) { void replaceShiftShift(AstNodeBiop* nodep) {
UINFO(4, "SHIFT(SHIFT(a,s1),s2)->SHIFT(a,ADD(s1,s2)) " << nodep << endl); UINFO(4, "SHIFT(SHIFT(a,s1),s2)->SHIFT(a,ADD(s1,s2)) " << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, " repShiftShift_old: "); if (debug() >= 9) nodep->dumpTree("- repShiftShift_old: ");
AstNodeBiop* const lhsp = VN_AS(nodep->lhsp(), NodeBiop); AstNodeBiop* const lhsp = VN_AS(nodep->lhsp(), NodeBiop);
lhsp->unlinkFrBack(); lhsp->unlinkFrBack();
AstNodeExpr* const ap = lhsp->lhsp()->unlinkFrBack(); AstNodeExpr* const ap = lhsp->lhsp()->unlinkFrBack();
@ -1955,7 +1955,7 @@ private:
newp->dtypeFrom(nodep); newp->dtypeFrom(nodep);
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
// newp->dumpTree(cout, " repShiftShift_new: "); // newp->dumpTree("- repShiftShift_new: ");
iterate(newp); // Further reduce, either node may have more reductions. iterate(newp); // Further reduce, either node may have more reductions.
} }
VL_DO_DANGLING(lhsp->deleteTree(), lhsp); VL_DO_DANGLING(lhsp->deleteTree(), lhsp);
@ -1998,8 +1998,8 @@ private:
const bool lsbFirstAssign = (con1p->toUInt() < con2p->toUInt()); const bool lsbFirstAssign = (con1p->toUInt() < con2p->toUInt());
UINFO(4, "replaceAssignMultiSel " << nodep << endl); UINFO(4, "replaceAssignMultiSel " << nodep << endl);
UINFO(4, " && " << nextp << endl); UINFO(4, " && " << nextp << endl);
// nodep->dumpTree(cout, "comb1: "); // nodep->dumpTree("- comb1: ");
// nextp->dumpTree(cout, "comb2: "); // nextp->dumpTree("- comb2: ");
AstNodeExpr* const rhs1p = nodep->rhsp()->unlinkFrBack(); AstNodeExpr* const rhs1p = nodep->rhsp()->unlinkFrBack();
AstNodeExpr* const rhs2p = nextp->rhsp()->unlinkFrBack(); AstNodeExpr* const rhs2p = nextp->rhsp()->unlinkFrBack();
AstNodeAssign* newp; AstNodeAssign* newp;
@ -2012,7 +2012,7 @@ private:
sel2p->lsbConst(), sel1p->width() + sel2p->width()}, sel2p->lsbConst(), sel1p->width() + sel2p->width()},
new AstConcat{rhs1p->fileline(), rhs1p, rhs2p}); new AstConcat{rhs1p->fileline(), rhs1p, rhs2p});
} }
// pnewp->dumpTree(cout, "conew: "); // pnewp->dumpTree("- conew: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
VL_DO_DANGLING(nextp->unlinkFrBack()->deleteTree(), nextp); VL_DO_DANGLING(nextp->unlinkFrBack()->deleteTree(), nextp);
@ -2071,7 +2071,7 @@ private:
// ASSIGN(CONCAT(lc1,lc2),rhs) -> ASSIGN(lc1,SEL(rhs,{size})), // ASSIGN(CONCAT(lc1,lc2),rhs) -> ASSIGN(lc1,SEL(rhs,{size})),
// ASSIGN(lc2,SEL(newrhs,{size})) // ASSIGN(lc2,SEL(newrhs,{size}))
} }
if (debug() >= 9) nodep->dumpTree(cout, " Ass_old: "); if (debug() >= 9) nodep->dumpTree("- Ass_old: ");
// Unlink the stuff // Unlink the stuff
AstNodeExpr* const lc1p = VN_AS(nodep->lhsp(), Concat)->lhsp()->unlinkFrBack(); AstNodeExpr* const lc1p = VN_AS(nodep->lhsp(), Concat)->lhsp()->unlinkFrBack();
AstNodeExpr* const lc2p = VN_AS(nodep->lhsp(), Concat)->rhsp()->unlinkFrBack(); AstNodeExpr* const lc2p = VN_AS(nodep->lhsp(), Concat)->rhsp()->unlinkFrBack();
@ -2129,7 +2129,7 @@ private:
newp = AstNode::addNext(newp, asn1bp); newp = AstNode::addNext(newp, asn1bp);
newp = AstNode::addNext(newp, asn2bp); newp = AstNode::addNext(newp, asn2bp);
} }
if (debug() >= 9 && newp) newp->dumpTreeAndNext(cout, " _new: "); if (debug() >= 9 && newp) newp->dumpTreeAndNext(cout, "- _new: ");
nodep->addNextHere(newp); nodep->addNextHere(newp);
// Cleanup // Cleanup
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
@ -2209,7 +2209,7 @@ private:
return true; return true;
} }
void replaceBoolShift(AstNode* nodep) { void replaceBoolShift(AstNode* nodep) {
if (debug() >= 9) nodep->dumpTree(cout, " bshft_old: "); if (debug() >= 9) nodep->dumpTree("- bshft_old: ");
AstConst* const andConstp = VN_AS(VN_AS(nodep, And)->lhsp(), Const); AstConst* const andConstp = VN_AS(VN_AS(nodep, And)->lhsp(), Const);
AstNodeExpr* const fromp AstNodeExpr* const fromp
= VN_AS(VN_AS(nodep, And)->rhsp(), ShiftR)->lhsp()->unlinkFrBack(); = VN_AS(VN_AS(nodep, And)->rhsp(), ShiftR)->lhsp()->unlinkFrBack();
@ -2223,7 +2223,7 @@ private:
newp->dtypeSetLogicSized(nodep->width(), VSigning::UNSIGNED); newp->dtypeSetLogicSized(nodep->width(), VSigning::UNSIGNED);
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
if (debug() >= 9) newp->dumpTree(cout, " _new: "); if (debug() >= 9) newp->dumpTree("- _new: ");
} }
void replaceWithSimulation(AstNode* nodep) { void replaceWithSimulation(AstNode* nodep) {
@ -2617,7 +2617,7 @@ private:
UASSERT_OBJ(nodep->varp(), nodep, "Not linked"); UASSERT_OBJ(nodep->varp(), nodep, "Not linked");
bool did = false; bool did = false;
if (m_doV && nodep->varp()->valuep() && !m_attrp) { if (m_doV && nodep->varp()->valuep() && !m_attrp) {
// if (debug()) valuep->dumpTree(cout, " visitvaref: "); // if (debug()) valuep->dumpTree("- visitvaref: ");
iterateAndNextNull(nodep->varp()->valuep()); // May change nodep->varp()->valuep() iterateAndNextNull(nodep->varp()->valuep()); // May change nodep->varp()->valuep()
AstNode* const valuep = nodep->varp()->valuep(); AstNode* const valuep = nodep->varp()->valuep();
if (nodep->access().isReadOnly() if (nodep->access().isReadOnly()
@ -2671,7 +2671,7 @@ private:
UASSERT_OBJ(nodep->itemp(), nodep, "Not linked"); UASSERT_OBJ(nodep->itemp(), nodep, "Not linked");
bool did = false; bool did = false;
if (nodep->itemp()->valuep()) { if (nodep->itemp()->valuep()) {
// if (debug()) nodep->itemp()->valuep()->dumpTree(cout, " visitvaref: "); // if (debug()) nodep->itemp()->valuep()->dumpTree("- visitvaref: ");
if (nodep->itemp()->user4()) { if (nodep->itemp()->user4()) {
nodep->v3error("Recursive enum value: " << nodep->itemp()->prettyNameQ()); nodep->v3error("Recursive enum value: " << nodep->itemp()->prettyNameQ());
} else { } else {
@ -2791,7 +2791,7 @@ private:
void visit(AstSenTree* nodep) override { void visit(AstSenTree* nodep) override {
iterateChildren(nodep); iterateChildren(nodep);
if (m_doExpensive) { if (m_doExpensive) {
// cout<<endl; nodep->dumpTree(cout, "ssin: "); // cout<<endl; nodep->dumpTree("- ssin: ");
// Optimize ideas for the future: // Optimize ideas for the future:
// SENTREE(... SENGATE(x,a), SENGATE(SENITEM(x),b) ...) => SENGATE(x,OR(a,b)) // SENTREE(... SENGATE(x,a), SENGATE(SENITEM(x),b) ...) => SENGATE(x,OR(a,b))
@ -2859,7 +2859,7 @@ private:
} }
} }
} }
// nodep->dumpTree(cout, "ssou: "); // nodep->dumpTree("- ssou: ");
} }
} }
@ -3645,7 +3645,7 @@ uint32_t ConstVisitor::s_globalPassNum = 0;
//! Force this cell node's parameter list to become a constant //! Force this cell node's parameter list to become a constant
//! @return Pointer to the edited node. //! @return Pointer to the edited node.
AstNode* V3Const::constifyParamsEdit(AstNode* nodep) { AstNode* V3Const::constifyParamsEdit(AstNode* nodep) {
// if (debug() > 0) nodep->dumpTree(cout, " forceConPRE : "); // if (debug() > 0) nodep->dumpTree("- forceConPRE : ");
// Resize even if the node already has a width, because buried in the tree // 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. // we may have a node we just created with signing, etc, that isn't sized yet.
@ -3661,7 +3661,7 @@ AstNode* V3Const::constifyParamsEdit(AstNode* nodep) {
nodep = visitor.mainAcceptEdit(nodep); nodep = visitor.mainAcceptEdit(nodep);
} }
// Because we do edits, nodep links may get trashed and core dump this. // Because we do edits, nodep links may get trashed and core dump this.
// if (debug() > 0) nodep->dumpTree(cout, " forceConDONE: "); // if (debug() > 0) nodep->dumpTree("- forceConDONE: ");
return nodep; return nodep;
} }
@ -3674,7 +3674,7 @@ AstNode* V3Const::constifyParamsEdit(AstNode* nodep) {
//! width check. //! width check.
//! @return Pointer to the edited node. //! @return Pointer to the edited node.
AstNode* V3Const::constifyGenerateParamsEdit(AstNode* nodep) { AstNode* V3Const::constifyGenerateParamsEdit(AstNode* nodep) {
// if (debug() > 0) nodep->dumpTree(cout, " forceConPRE : "); // if (debug() > 0) nodep->dumpTree("- forceConPRE:: ");
// Resize even if the node already has a width, because buried in the tree // 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 // we may have a node we just created with signing, etc, that isn't sized
// yet. // yet.
@ -3691,7 +3691,7 @@ AstNode* V3Const::constifyGenerateParamsEdit(AstNode* nodep) {
nodep = visitor.mainAcceptEdit(nodep); nodep = visitor.mainAcceptEdit(nodep);
} }
// Because we do edits, nodep links may get trashed and core dump this. // Because we do edits, nodep links may get trashed and core dump this.
// if (debug() > 0) nodep->dumpTree(cout, " forceConDONE: "); // if (debug() > 0) nodep->dumpTree("- forceConDONE: ");
return nodep; return nodep;
} }

View File

@ -54,7 +54,7 @@ private:
void createDeepTemp(AstNodeExpr* nodep) { void createDeepTemp(AstNodeExpr* nodep) {
UINFO(6, " Deep " << nodep << endl); UINFO(6, " Deep " << nodep << endl);
// if (debug() >= 9) nodep->dumpTree(cout, "deep:"); // if (debug() >= 9) nodep->dumpTree("- deep: ");
AstVar* const varp = new AstVar{nodep->fileline(), VVarType::STMTTEMP, AstVar* const varp = new AstVar{nodep->fileline(), VVarType::STMTTEMP,
m_tempNames.get(nodep), nodep->dtypep()}; m_tempNames.get(nodep), nodep->dtypep()};
if (m_cfuncp) { if (m_cfuncp) {

View File

@ -98,11 +98,11 @@ private:
if (m_depth > v3Global.opt.compLimitBlocks()) { // Already done if (m_depth > v3Global.opt.compLimitBlocks()) { // Already done
UINFO(4, "DeepBlocks " << m_depth << " " << nodep << endl); UINFO(4, "DeepBlocks " << m_depth << " " << nodep << endl);
const AstNode* const backp = nodep->backp(); // Only for debug const AstNode* const backp = nodep->backp(); // Only for debug
if (debug() >= 9) backp->dumpTree(cout, "- pre : "); if (debug() >= 9) backp->dumpTree("- pre : ");
AstCFunc* const funcp = createDeepFunc(nodep); AstCFunc* const funcp = createDeepFunc(nodep);
iterate(funcp); iterate(funcp);
if (debug() >= 9) backp->dumpTree(cout, "- post: "); if (debug() >= 9) backp->dumpTree("- post: ");
if (debug() >= 9) funcp->dumpTree(cout, "- func: "); if (debug() >= 9) funcp->dumpTree("- func: ");
} else { } else {
iterateChildren(nodep); iterateChildren(nodep);
} }

View File

@ -181,7 +181,7 @@ private:
// string("%%Error: ")+name+"() called with bad // string("%%Error: ")+name+"() called with bad
// scope", nullptr)); // scope", nullptr));
// newfuncp->addStmtsp(new AstStop(newfuncp->fileline())); // newfuncp->addStmtsp(new AstStop(newfuncp->fileline()));
if (debug() >= 9) newfuncp->dumpTree(cout, " newfunc: "); if (debug() >= 9) newfuncp->dumpTree("- newfunc: ");
} else { } else {
// Only a single function under this name, we can rename it // Only a single function under this name, we can rename it
UINFO(6, " Wrapping " << name << " just one " << topFuncp << endl); UINFO(6, " Wrapping " << name << " just one " << topFuncp << endl);

View File

@ -595,7 +595,7 @@ private:
return false; return false;
} else { } else {
UINFO(8, " ASSIGNSEL(varlsb,narrow) " << nodep << endl); UINFO(8, " ASSIGNSEL(varlsb,narrow) " << nodep << endl);
// nodep->dumpTree(cout, "- old: "); // nodep->dumpTree("- old: ");
AstNodeExpr* rhsp = nodep->rhsp()->unlinkFrBack(); AstNodeExpr* rhsp = nodep->rhsp()->unlinkFrBack();
AstNodeExpr* const destp = lhsp->fromp()->unlinkFrBack(); AstNodeExpr* const destp = lhsp->fromp()->unlinkFrBack();
AstNodeExpr* oldvalp = destp->cloneTree(true); AstNodeExpr* oldvalp = destp->cloneTree(true);

View File

@ -286,7 +286,7 @@ public:
clearSimple("Circular logic\n"); // Oh my, we'll get a UNOPTFLAT much later. clearSimple("Circular logic\n"); // Oh my, we'll get a UNOPTFLAT much later.
} }
} }
if (debug() >= 9 && !m_isSimple) nodep->dumpTree(cout, " gate!Ok: "); if (debug() >= 9 && !m_isSimple) nodep->dumpTree("- gate!Ok: ");
} }
~GateOkVisitor() override = default; ~GateOkVisitor() override = default;
// PUBLIC METHODS // PUBLIC METHODS
@ -387,7 +387,7 @@ private:
} }
void optimizeElimVar(AstVarScope* varscp, AstNode* substp, AstNode* consumerp) { void optimizeElimVar(AstVarScope* varscp, AstNode* substp, AstNode* consumerp) {
if (debug() >= 5) consumerp->dumpTree(cout, " elimUsePre: "); if (debug() >= 5) consumerp->dumpTree("- elimUsePre: ");
if (!m_substitutions.tryGet(consumerp)) m_optimized.push_back(consumerp); if (!m_substitutions.tryGet(consumerp)) m_optimized.push_back(consumerp);
m_substitutions(consumerp).emplace(varscp, substp->cloneTree(false)); m_substitutions(consumerp).emplace(varscp, substp->cloneTree(false));
} }
@ -619,8 +619,8 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
// Process it // Process it
AstNode* const substp = okVisitor.substTree(); AstNode* const substp = okVisitor.substTree();
if (debug() >= 5) logicp->dumpTree(cout, " elimVar: "); if (debug() >= 5) logicp->dumpTree("- elimVar: ");
if (debug() >= 5) substp->dumpTree(cout, " subst: "); if (debug() >= 5) substp->dumpTree("- subst: ");
++m_statSigs; ++m_statSigs;
bool removedAllUsages = true; bool removedAllUsages = true;
for (V3GraphEdge* edgep = vvertexp->outBeginp(); edgep;) { for (V3GraphEdge* edgep = vvertexp->outBeginp(); edgep;) {

View File

@ -355,8 +355,8 @@ private:
const string name = m_cellp->name() + "__DOT__" + nodep->name(); const string name = m_cellp->name() + "__DOT__" + nodep->name();
if (!nodep->isFuncLocal() && !nodep->isClassMember()) nodep->inlineAttrReset(name); if (!nodep->isFuncLocal() && !nodep->isClassMember()) nodep->inlineAttrReset(name);
if (!m_cellp->isTrace()) nodep->trace(false); if (!m_cellp->isTrace()) nodep->trace(false);
if (debug() >= 9) nodep->dumpTree(cout, "varchanged:"); if (debug() >= 9) nodep->dumpTree("- varchanged: ");
if (debug() >= 9 && nodep->valuep()) nodep->valuep()->dumpTree(cout, "varchangei:"); if (debug() >= 9 && nodep->valuep()) nodep->valuep()->dumpTree("- varchangei: ");
} }
void visit(AstNodeFTask* nodep) override { void visit(AstNodeFTask* nodep) override {
// Function under the inline cell, need to rename to avoid conflicts // Function under the inline cell, need to rename to avoid conflicts

View File

@ -65,7 +65,7 @@ private:
V3Inst::pinReconnectSimple(nodep, m_cellp, false); V3Inst::pinReconnectSimple(nodep, m_cellp, false);
} }
if (!nodep->exprp()) return; // No-connect if (!nodep->exprp()) return; // No-connect
if (debug() >= 9) nodep->dumpTree(cout, " Pin_oldb: "); if (debug() >= 9) nodep->dumpTree("- Pin_oldb: ");
V3Inst::checkOutputShort(nodep); V3Inst::checkOutputShort(nodep);
// Use user1p on the PIN to indicate we created an assign for this pin // Use user1p on the PIN to indicate we created an assign for this pin
if (!nodep->user1SetOnce()) { if (!nodep->user1SetOnce()) {
@ -89,7 +89,7 @@ private:
m_cellp->name(), VAccess::WRITE}, m_cellp->name(), VAccess::WRITE},
exprp}; exprp};
m_cellp->addNextHere(assp); m_cellp->addNextHere(assp);
if (debug() >= 9) assp->dumpTree(cout, " _new: "); if (debug() >= 9) assp->dumpTree("- _new: ");
} else if (nodep->modVarp()->isIfaceRef() } else if (nodep->modVarp()->isIfaceRef()
|| (VN_IS(nodep->modVarp()->subDTypep(), UnpackArrayDType) || (VN_IS(nodep->modVarp()->subDTypep(), UnpackArrayDType)
&& VN_IS( && VN_IS(
@ -227,7 +227,7 @@ private:
} }
if (prevp) nodep->addNextHere(prevp); if (prevp) nodep->addNextHere(prevp);
if (prevp && debug() == 9) { if (prevp && debug() == 9) {
prevp->dumpTree(cout, "newintf: "); prevp->dumpTree("- newintf: ");
cout << endl; cout << endl;
} }
} }
@ -285,14 +285,14 @@ private:
varNewp->dtypep(ifaceRefp); varNewp->dtypep(ifaceRefp);
newp->addNextHere(varNewp); newp->addNextHere(varNewp);
if (debug() == 9) { if (debug() == 9) {
varNewp->dumpTree(cout, "newintf: "); varNewp->dumpTree("- newintf: ");
cout << endl; cout << endl;
} }
} }
// Fixup pins // Fixup pins
iterateAndNextNull(newp->pinsp()); iterateAndNextNull(newp->pinsp());
if (debug() == 9) { if (debug() == 9) {
newp->dumpTree(cout, "newcell: "); newp->dumpTree("- newcell: ");
cout << endl; cout << endl;
} }
} }
@ -551,7 +551,7 @@ public:
// Done. Constant. // Done. Constant.
} else { } else {
// Make a new temp wire // Make a new temp wire
// if (1 || debug() >= 9) pinp->dumpTree(cout, "-in_pin:"); // if (1 || debug() >= 9) pinp->dumpTree("- in_pin: ");
V3Inst::checkOutputShort(pinp); V3Inst::checkOutputShort(pinp);
AstNodeExpr* const pinexprp = VN_AS(pinp->exprp(), NodeExpr)->unlinkFrBack(); AstNodeExpr* const pinexprp = VN_AS(pinp->exprp(), NodeExpr)->unlinkFrBack();
const string newvarname const string newvarname
@ -583,8 +583,8 @@ public:
pinp->exprp(new AstVarRef{pinexprp->fileline(), newvarp, VAccess::READ}); pinp->exprp(new AstVarRef{pinexprp->fileline(), newvarp, VAccess::READ});
} }
if (assignp) cellp->addNextHere(assignp); if (assignp) cellp->addNextHere(assignp);
// if (debug()) pinp->dumpTree(cout, "- out:"); // if (debug()) pinp->dumpTree("- out: ");
// if (debug()) assignp->dumpTree(cout, "- aout:"); // if (debug()) assignp->dumpTree("- aout: ");
} }
return assignp; return assignp;
} }

View File

@ -150,7 +150,7 @@ public:
// Redundant assignment, in same level block // Redundant assignment, in same level block
// Don't delete it now as it will confuse iteration since it maybe WAY // Don't delete it now as it will confuse iteration since it maybe WAY
// above our current iteration point. // above our current iteration point.
if (debug() > 4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK "); if (debug() > 4) oldassp->dumpTree("- REMOVE/SAMEBLK: ");
entp->complexAssign(); entp->complexAssign();
VL_DO_DANGLING(m_statep->pushUnlinkDeletep(oldassp), oldassp); VL_DO_DANGLING(m_statep->pushUnlinkDeletep(oldassp), oldassp);
++m_statep->m_statAssnDel; ++m_statep->m_statAssnDel;

View File

@ -1741,7 +1741,7 @@ class LinkDotScopeVisitor final : public VNVisitor {
void visit(AstAssignAlias* nodep) override { void visit(AstAssignAlias* nodep) override {
// Track aliases created by V3Inline; if we get a VARXREF(aliased_from) // Track aliases created by V3Inline; if we get a VARXREF(aliased_from)
// we'll need to replace it with a VARXREF(aliased_to) // we'll need to replace it with a VARXREF(aliased_to)
if (debug() >= 9) nodep->dumpTree(cout, "- alias: "); if (debug() >= 9) nodep->dumpTree("- alias: ");
AstVarScope* const fromVscp = VN_AS(nodep->lhsp(), VarRef)->varScopep(); AstVarScope* const fromVscp = VN_AS(nodep->lhsp(), VarRef)->varScopep();
AstVarScope* const toVscp = VN_AS(nodep->rhsp(), VarRef)->varScopep(); AstVarScope* const toVscp = VN_AS(nodep->rhsp(), VarRef)->varScopep();
UASSERT_OBJ(fromVscp && toVscp, nodep, "Bad alias scopes"); UASSERT_OBJ(fromVscp && toVscp, nodep, "Bad alias scopes");
@ -1750,7 +1750,7 @@ class LinkDotScopeVisitor final : public VNVisitor {
} }
void visit(AstAssignVarScope* nodep) override { void visit(AstAssignVarScope* nodep) override {
UINFO(5, "ASSIGNVARSCOPE " << nodep << endl); UINFO(5, "ASSIGNVARSCOPE " << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, "- avs: "); if (debug() >= 9) nodep->dumpTree("- avs: ");
VSymEnt* rhsSymp; VSymEnt* rhsSymp;
{ {
AstVarRef* const refp = VN_CAST(nodep->rhsp(), VarRef); AstVarRef* const refp = VN_CAST(nodep->rhsp(), VarRef);
@ -2142,8 +2142,8 @@ private:
else { else {
m_pinSymp = m_statep->getNodeSym(nodep->modp()); m_pinSymp = m_statep->getNodeSym(nodep->modp());
UINFO(4, "(Backto) Link Cell: " << nodep << endl); UINFO(4, "(Backto) Link Cell: " << nodep << endl);
// if (debug()) nodep->dumpTree(cout, "linkcell:"); // if (debug()) nodep->dumpTree("- linkcell: ");
// if (debug()) nodep->modp()->dumpTree(cout, "linkcemd:"); // if (debug()) nodep->modp()->dumpTree("- linkcemd: ");
iterateChildren(nodep); iterateChildren(nodep);
} }
} }
@ -2162,8 +2162,8 @@ private:
// ClassRef's have pins, so track // ClassRef's have pins, so track
m_pinSymp = m_statep->getNodeSym(nodep->classp()); m_pinSymp = m_statep->getNodeSym(nodep->classp());
UINFO(4, "(Backto) Link ClassRefDType: " << nodep << endl); UINFO(4, "(Backto) Link ClassRefDType: " << nodep << endl);
// if (debug()) nodep->dumpTree(cout, "linkcell:"); // if (debug()) nodep->dumpTree("- linkcell: ");
// if (debug()) nodep->modp()->dumpTree(cout, "linkcemd:"); // if (debug()) nodep->modp()->dumpTree("- linkcemd: ");
iterateChildren(nodep); iterateChildren(nodep);
} }
} }
@ -2221,7 +2221,7 @@ private:
const bool start = (m_ds.m_dotPos == DP_NONE); // Save, as m_dotp will be changed const bool start = (m_ds.m_dotPos == DP_NONE); // Save, as m_dotp will be changed
{ {
if (start) { // Starting dot sequence if (start) { // Starting dot sequence
if (debug() >= 9) nodep->dumpTree("-dot-in: "); if (debug() >= 9) nodep->dumpTree("- dot-in: ");
m_ds.init(m_curSymp); // Start from current point m_ds.init(m_curSymp); // Start from current point
} }
m_ds.m_dotp = nodep; // Always, not just at start m_ds.m_dotp = nodep; // Always, not just at start
@ -2264,7 +2264,7 @@ private:
} else { } else {
m_ds.m_dotPos = DP_SCOPE; m_ds.m_dotPos = DP_SCOPE;
iterateAndNextNull(nodep->lhsp()); iterateAndNextNull(nodep->lhsp());
// if (debug() >= 9) nodep->dumpTree("-dot-lho: "); // if (debug() >= 9) nodep->dumpTree("- dot-lho: ");
} }
if (m_statep->forPrimary() && isParamedClassRef(nodep->lhsp())) { if (m_statep->forPrimary() && isParamedClassRef(nodep->lhsp())) {
// Dots of paramed classes will be linked after deparametrization // Dots of paramed classes will be linked after deparametrization
@ -2281,7 +2281,7 @@ private:
// DOT(DOT(x,*here*),real-rhs) which we consider a RHS // DOT(DOT(x,*here*),real-rhs) which we consider a RHS
if (start && m_ds.m_dotPos == DP_SCOPE) m_ds.m_dotPos = DP_FINAL; if (start && m_ds.m_dotPos == DP_SCOPE) m_ds.m_dotPos = DP_FINAL;
iterateAndNextNull(nodep->rhsp()); iterateAndNextNull(nodep->rhsp());
// if (debug() >= 9) nodep->dumpTree("-dot-rho: "); // if (debug() >= 9) nodep->dumpTree("- dot-rho: ");
} }
if (start) { if (start) {
AstNode* newp; AstNode* newp;
@ -2291,7 +2291,7 @@ private:
// RHS is what we're left with // RHS is what we're left with
newp = nodep->rhsp()->unlinkFrBack(); newp = nodep->rhsp()->unlinkFrBack();
} }
if (debug() >= 9) newp->dumpTree("-dot-out: "); if (debug() >= 9) newp->dumpTree("- dot-out: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { // Dot midpoint } else { // Dot midpoint

View File

@ -70,11 +70,11 @@ private:
void insertBeforeStmt(AstNode* nodep, AstNode* newp) { void insertBeforeStmt(AstNode* nodep, AstNode* newp) {
// Return node that must be visited, if any // Return node that must be visited, if any
// See also AstNode::addBeforeStmt; this predates that function // See also AstNode::addBeforeStmt; this predates that function
if (debug() >= 9) newp->dumpTree(cout, "-newstmt:"); if (debug() >= 9) newp->dumpTree("- newstmt: ");
UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement"); UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement");
if (m_insMode == IM_BEFORE) { if (m_insMode == IM_BEFORE) {
// Add the whole thing before insertAt // Add the whole thing before insertAt
if (debug() >= 9) newp->dumpTree(cout, "-newfunc:"); if (debug() >= 9) newp->dumpTree("- newfunc: ");
m_insStmtp->addHereThisAsNext(newp); m_insStmtp->addHereThisAsNext(newp);
} else if (m_insMode == IM_AFTER) { } else if (m_insMode == IM_AFTER) {
m_insStmtp->addNextHere(newp); m_insStmtp->addNextHere(newp);

View File

@ -289,7 +289,7 @@ private:
break; break;
} }
} }
// if (debug() >= 9) { UINFO(0, "\n"); blockp->dumpTree(cout, " labeli: "); } // if (debug() >= 9) { UINFO(0, "\n"); blockp->dumpTree("- labeli: "); }
if (!blockp) { if (!blockp) {
nodep->v3error("disable isn't underneath a begin with name: " << nodep->prettyNameQ()); nodep->v3error("disable isn't underneath a begin with name: " << nodep->prettyNameQ());
} else if (AstBegin* const beginp = VN_CAST(blockp, Begin)) { } else if (AstBegin* const beginp = VN_CAST(blockp, Begin)) {
@ -301,7 +301,7 @@ private:
} }
nodep->unlinkFrBack(); nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
// if (debug() >= 9) { UINFO(0, "\n"); beginp->dumpTree(cout, " labelo: "); } // if (debug() >= 9) { UINFO(0, "\n"); beginp->dumpTree("- labelo: "); }
} }
void visit(AstVarRef* nodep) override { void visit(AstVarRef* nodep) override {
if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true); if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true);

View File

@ -655,7 +655,7 @@ class ParamProcessor final {
AstConst* const exprp = VN_CAST(pinp->exprp(), Const); AstConst* const exprp = VN_CAST(pinp->exprp(), Const);
const AstConst* const origp = VN_CAST(modvarp->valuep(), Const); const AstConst* const origp = VN_CAST(modvarp->valuep(), Const);
if (!exprp) { if (!exprp) {
if (debug()) pinp->dumpTree(cout, "-nodes: "); if (debug()) pinp->dumpTree("- ");
pinp->v3error("Can't convert defparam value to constant: Param " pinp->v3error("Can't convert defparam value to constant: Param "
<< pinp->prettyNameQ() << " of " << nodep->prettyNameQ()); << pinp->prettyNameQ() << " of " << nodep->prettyNameQ());
pinp->exprp()->replaceWith(new AstConst{ pinp->exprp()->replaceWith(new AstConst{
@ -768,9 +768,9 @@ class ParamProcessor final {
AstPin* pinsp, bool any_overrides) { AstPin* pinsp, bool any_overrides) {
// Make sure constification worked // Make sure constification worked
// Must be a separate loop, as constant conversion may have changed some pointers. // Must be a separate loop, as constant conversion may have changed some pointers.
// if (debug()) nodep->dumpTree(cout, "-cel2: "); // if (debug()) nodep->dumpTree("- cel2: ");
string longname = srcModpr->name() + "_"; string longname = srcModpr->name() + "_";
if (debug() > 8 && paramsp) paramsp->dumpTreeAndNext(cout, "-cellparams: "); if (debug() > 8 && paramsp) paramsp->dumpTreeAndNext(cout, "- cellparams: ");
if (srcModpr->hierBlock()) { if (srcModpr->hierBlock()) {
longname = parameterizedHierBlockName(srcModpr, paramsp); longname = parameterizedHierBlockName(srcModpr, paramsp);
@ -849,7 +849,7 @@ public:
// and remove any recursive references // and remove any recursive references
UINFO(4, "De-parameterize: " << nodep << endl); UINFO(4, "De-parameterize: " << nodep << endl);
// Create new module name with _'s between the constants // Create new module name with _'s between the constants
if (debug() >= 10) nodep->dumpTree(cout, "-cell: "); if (debug() >= 10) nodep->dumpTree("- cell: ");
// Evaluate all module constants // Evaluate all module constants
V3Const::constifyParamsEdit(nodep); V3Const::constifyParamsEdit(nodep);
srcModpr->someInstanceName(someInstanceName + "." + nodep->name()); srcModpr->someInstanceName(someInstanceName + "." + nodep->name());

View File

@ -281,7 +281,7 @@ private:
// else warning // else warning
// Note this code assumes that the expressions after V3Const are fast to compute // 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 // Optimize: we would be better with a binary search tree to reduce ifs that execute
if (debug() >= 9) nodep->dumpTree(cout, "-rcin: "); if (debug() >= 9) nodep->dumpTree("- rcin:: ");
AstNodeDType* const sumDTypep = nodep->findUInt64DType(); AstNodeDType* const sumDTypep = nodep->findUInt64DType();
FileLine* const fl = nodep->fileline(); FileLine* const fl = nodep->fileline();
@ -324,7 +324,7 @@ private:
new AstAdd{fl, new AstConst{fl, AstConst::Unsized64{}, 1}, new AstAdd{fl, new AstConst{fl, AstConst::Unsized64{}, 1},
new AstModDiv{fl, randp, sump}}}); new AstModDiv{fl, randp, sump}}});
newp->addNext(firstIfsp); newp->addNext(firstIfsp);
if (debug() >= 9) newp->dumpTreeAndNext(cout, "-rcnew: "); if (debug() >= 9) newp->dumpTreeAndNext(cout, "- rcnew: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} }

View File

@ -130,8 +130,8 @@ private:
rbitp->replaceWith(m_mgOffset < 0 ? new AstAdd{fl, rvrefp, offsetp} : rvrefp); rbitp->replaceWith(m_mgOffset < 0 ? new AstAdd{fl, rvrefp, offsetp} : rvrefp);
VL_DO_DANGLING(rbitp->deleteTree(), lbitp); VL_DO_DANGLING(rbitp->deleteTree(), lbitp);
} }
if (debug() >= 9) initp->dumpTree(cout, "-new: "); if (debug() >= 9) initp->dumpTree("- new: ");
if (debug() >= 9) whilep->dumpTree(cout, "-new: "); if (debug() >= 9) whilep->dumpTree("- new: ");
// Remove remaining assigns // Remove remaining assigns
for (AstNodeAssign* assp : m_mgAssignps) { for (AstNodeAssign* assp : m_mgAssignps) {

View File

@ -702,7 +702,7 @@ private:
// Values are in the "real" tree under the InitArray so can eventually extract it, // Values are in the "real" tree under the InitArray so can eventually extract it,
// Not in the usual setValue (pointed to by user2/3p) // Not in the usual setValue (pointed to by user2/3p)
initp->addIndexValuep(index, valuep); initp->addIndexValuep(index, valuep);
if (debug() >= 9) initp->dumpTree(cout, "-array-"); if (debug() >= 9) initp->dumpTree("- array: ");
assignOutValue(nodep, vscp, initp); assignOutValue(nodep, vscp, initp);
} }
} }

View File

@ -135,7 +135,7 @@ class SliceVisitor final : public VNVisitor {
if (!nodep->user1() && !VN_IS(nodep, AssignAlias)) { if (!nodep->user1() && !VN_IS(nodep, AssignAlias)) {
nodep->user1(true); nodep->user1(true);
m_assignError = false; m_assignError = false;
if (debug() >= 9) nodep->dumpTree(cout, " Deslice-In: "); if (debug() >= 9) nodep->dumpTree("- Deslice-In: ");
AstNodeDType* const dtp = nodep->lhsp()->dtypep()->skipRefp(); AstNodeDType* const dtp = nodep->lhsp()->dtypep()->skipRefp();
if (const AstUnpackArrayDType* const arrayp = VN_CAST(dtp, UnpackArrayDType)) { if (const AstUnpackArrayDType* const arrayp = VN_CAST(dtp, UnpackArrayDType)) {
// Left and right could have different msb/lsbs/endianness, but #elements is common // Left and right could have different msb/lsbs/endianness, but #elements is common
@ -147,10 +147,10 @@ class SliceVisitor final : public VNVisitor {
AstNodeAssign* const newp AstNodeAssign* const newp
= nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, offset), = nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, offset),
cloneAndSel(nodep->rhsp(), elements, offset)); cloneAndSel(nodep->rhsp(), elements, offset));
if (debug() >= 9) newp->dumpTree(cout, "-new "); if (debug() >= 9) newp->dumpTree("- new: ");
newlistp = AstNode::addNext(newlistp, newp); newlistp = AstNode::addNext(newlistp, newp);
} }
if (debug() >= 9) nodep->dumpTree(cout, " Deslice-Dn: "); if (debug() >= 9) nodep->dumpTree("- Deslice-Dn: ");
nodep->replaceWith(newlistp); nodep->replaceWith(newlistp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
// Normal edit iterator will now iterate on all of the expansion assignments // Normal edit iterator will now iterate on all of the expansion assignments

View File

@ -320,7 +320,7 @@ protected:
if (debug() >= 9) { if (debug() >= 9) {
const SplitVarStdVertex* const stdp = static_cast<SplitVarStdVertex*>(vertexp); const SplitVarStdVertex* const stdp = static_cast<SplitVarStdVertex*>(vertexp);
UINFO(0, "Will prune deps on var " << stdp->nodep() << endl); UINFO(0, "Will prune deps on var " << stdp->nodep() << endl);
stdp->nodep()->dumpTree(cout, "- "); stdp->nodep()->dumpTree("- ");
} }
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) { for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
SplitEdge* const oedgep = dynamic_cast<SplitEdge*>(edgep); SplitEdge* const oedgep = dynamic_cast<SplitEdge*>(edgep);
@ -600,10 +600,10 @@ protected:
void visit(AstAlways* nodep) override { void visit(AstAlways* nodep) override {
UINFO(4, " ALW " << nodep << endl); UINFO(4, " ALW " << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, " alwIn:: "); if (debug() >= 9) nodep->dumpTree("- alwIn:: ");
scoreboardClear(); scoreboardClear();
processBlock(nodep->stmtsp()); processBlock(nodep->stmtsp());
if (debug() >= 9) nodep->dumpTree(cout, " alwOut: "); if (debug() >= 9) nodep->dumpTree("- alwOut: ");
} }
void visit(AstNodeIf* nodep) override { void visit(AstNodeIf* nodep) override {
@ -924,7 +924,7 @@ protected:
const SplitNodeVertex* const nvxp = dynamic_cast<SplitNodeVertex*>(vxp); const SplitNodeVertex* const nvxp = dynamic_cast<SplitNodeVertex*>(vxp);
UINFO(0, "Cannot prune if-node due to edge " UINFO(0, "Cannot prune if-node due to edge "
<< oedgep << " pointing to node " << nvxp->nodep() << endl); << oedgep << " pointing to node " << nvxp->nodep() << endl);
nvxp->nodep()->dumpTree(cout, "- "); nvxp->nodep()->dumpTree("- ");
} }
break; break;

View File

@ -136,18 +136,18 @@ private:
void splitAlways(AstAlways* nodep) { void splitAlways(AstAlways* nodep) {
UINFO(3, "Split " << nodep << endl); UINFO(3, "Split " << nodep << endl);
UINFO(3, " For " << m_splitVscp << endl); UINFO(3, " For " << m_splitVscp << endl);
if (debug() >= 9) nodep->dumpTree(cout, "-in : "); if (debug() >= 9) nodep->dumpTree("- in: ");
// Duplicate it and link in // Duplicate it and link in
AstAlways* const newp = nodep->cloneTree(false); AstAlways* const newp = nodep->cloneTree(false);
newp->user1(true); // So we don't clone it again newp->user1(true); // So we don't clone it again
nodep->addNextHere(newp); nodep->addNextHere(newp);
{ // Delete stuff we don't want in old { // Delete stuff we don't want in old
const SplitAsCleanVisitor visitor{nodep, m_splitVscp, false}; const SplitAsCleanVisitor visitor{nodep, m_splitVscp, false};
if (debug() >= 9) nodep->dumpTree(cout, "-out0: "); if (debug() >= 9) nodep->dumpTree("- out0: ");
} }
{ // Delete stuff we don't want in new { // Delete stuff we don't want in new
const SplitAsCleanVisitor visitor{newp, m_splitVscp, true}; const SplitAsCleanVisitor visitor{newp, m_splitVscp, true};
if (debug() >= 9) newp->dumpTree(cout, "-out1: "); if (debug() >= 9) newp->dumpTree("- out1: ");
} }
} }

View File

@ -288,12 +288,12 @@ private:
if (!hit) iterate(nodep->lhsp()); if (!hit) iterate(nodep->lhsp());
} }
void replaceSubstEtc(AstNode* nodep, AstNodeExpr* substp) { void replaceSubstEtc(AstNode* nodep, AstNodeExpr* substp) {
if (debug() > 5) nodep->dumpTree(cout, " substw_old: "); if (debug() > 5) nodep->dumpTree("- substw_old: ");
AstNodeExpr* newp = substp->cloneTree(true); AstNodeExpr* newp = substp->cloneTree(true);
if (!nodep->isQuad() && newp->isQuad()) { if (!nodep->isQuad() && newp->isQuad()) {
newp = new AstCCast{newp->fileline(), newp, nodep}; newp = new AstCCast{newp->fileline(), newp, nodep};
} }
if (debug() > 5) newp->dumpTree(cout, " w_new: "); if (debug() > 5) newp->dumpTree("- w_new: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
++m_statSubsts; ++m_statSubsts;

View File

@ -277,7 +277,7 @@ private:
// Keep sensitivity list, but delete all else // Keep sensitivity list, but delete all else
nodep->stmtsp()->unlinkFrBackWithNext()->deleteTree(); nodep->stmtsp()->unlinkFrBackWithNext()->deleteTree();
nodep->addStmtsp(stmtsp); nodep->addStmtsp(stmtsp);
if (debug() >= 6) nodep->dumpTree(cout, " table_new: "); if (debug() >= 6) nodep->dumpTree("- table_new: ");
} }
void createTables(AstAlways* nodep, TableBuilder& outputAssignedTableBuilder) { void createTables(AstAlways* nodep, TableBuilder& outputAssignedTableBuilder) {

View File

@ -427,7 +427,7 @@ private:
AstNode* const beginp AstNode* const beginp
= new AstComment{refp->fileline(), string("Function: ") + refp->name(), true}; = new AstComment{refp->fileline(), string("Function: ") + refp->name(), true};
if (newbodysp) beginp->addNext(newbodysp); if (newbodysp) beginp->addNext(newbodysp);
if (debug() >= 9) beginp->dumpTreeAndNext(cout, "-newbegi:"); if (debug() >= 9) beginp->dumpTreeAndNext(cout, "- newbegi: ");
// //
// Create input variables // Create input variables
AstNode::user2ClearTree(); AstNode::user2ClearTree();
@ -530,7 +530,7 @@ private:
// Replace variable refs // Replace variable refs
relink(beginp); relink(beginp);
// //
if (debug() >= 9) beginp->dumpTreeAndNext(cout, "-iotask: "); if (debug() >= 9) beginp->dumpTreeAndNext(cout, "- iotask: ");
return beginp; return beginp;
} }
@ -637,7 +637,7 @@ private:
if (outvscp) ccallp->addArgsp(new AstVarRef{refp->fileline(), outvscp, VAccess::WRITE}); if (outvscp) ccallp->addArgsp(new AstVarRef{refp->fileline(), outvscp, VAccess::WRITE});
if (debug() >= 9) beginp->dumpTreeAndNext(cout, "-nitask: "); if (debug() >= 9) beginp->dumpTreeAndNext(cout, "- nitask: ");
return beginp; return beginp;
} }
@ -1313,7 +1313,7 @@ private:
// Delete rest of cloned task and return new func // Delete rest of cloned task and return new func
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
if (debug() >= 9) cfuncp->dumpTree(cout, "-userFunc: "); if (debug() >= 9) cfuncp->dumpTree("- userFunc: ");
return cfuncp; return cfuncp;
} }
@ -1331,13 +1331,13 @@ private:
AstNode* insertBeforeStmt(AstNode* nodep, AstNode* newp) { AstNode* insertBeforeStmt(AstNode* nodep, AstNode* newp) {
// Return node that must be visited, if any // Return node that must be visited, if any
// See also AstNode::addBeforeStmt; this predates that function // See also AstNode::addBeforeStmt; this predates that function
if (debug() >= 9) nodep->dumpTree(cout, "-newstmt:"); if (debug() >= 9) nodep->dumpTree("- newstmt: ");
UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement"); UASSERT_OBJ(m_insStmtp, nodep, "Function not underneath a statement");
AstNode* visitp = nullptr; AstNode* visitp = nullptr;
if (m_insMode == IM_BEFORE) { if (m_insMode == IM_BEFORE) {
// Add the whole thing before insertAt // Add the whole thing before insertAt
UINFO(5, " IM_Before " << m_insStmtp << endl); UINFO(5, " IM_Before " << m_insStmtp << endl);
if (debug() >= 9) newp->dumpTree(cout, "-newfunc:"); if (debug() >= 9) newp->dumpTree("- newfunc: ");
m_insStmtp->addHereThisAsNext(newp); m_insStmtp->addHereThisAsNext(newp);
} else if (m_insMode == IM_AFTER) { } else if (m_insMode == IM_AFTER) {
UINFO(5, " IM_After " << m_insStmtp << endl); UINFO(5, " IM_After " << m_insStmtp << endl);
@ -1383,7 +1383,7 @@ private:
UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked?"); UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked?");
iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs
UINFO(4, " FTask REF " << nodep << endl); UINFO(4, " FTask REF " << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, "-inlfunc:"); if (debug() >= 9) nodep->dumpTree("- inlfunc: ");
UASSERT_OBJ(m_scopep, nodep, "func ref not under scope"); UASSERT_OBJ(m_scopep, nodep, "func ref not under scope");
const string namePrefix = ((VN_IS(nodep, FuncRef) ? "__Vfunc_" : "__Vtask_") const string namePrefix = ((VN_IS(nodep, FuncRef) ? "__Vfunc_" : "__Vtask_")
+ nodep->taskp()->shortName() + "__" + cvtToStr(m_modNCalls++)); + nodep->taskp()->shortName() + "__" + cvtToStr(m_modNCalls++));
@ -1687,7 +1687,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
} }
if (debug() >= 9) { // LCOV_EXCL_START if (debug() >= 9) { // LCOV_EXCL_START
nodep->dumpTree(cout, "-ftref-out: "); nodep->dumpTree("- ftref-out: ");
for (int i = 0; i < tpinnum; ++i) { for (int i = 0; i < tpinnum; ++i) {
UINFO(0, " pin " << i << " conn=" << cvtToHex(tconnects[i].second) << endl); UINFO(0, " pin " << i << " conn=" << cvtToHex(tconnects[i].second) << endl);
} }

View File

@ -331,7 +331,7 @@ private:
if (TraceTraceVertex* const vtxp = dynamic_cast<TraceTraceVertex*>(itp)) { if (TraceTraceVertex* const vtxp = dynamic_cast<TraceTraceVertex*>(itp)) {
ActCodeSet actSet; ActCodeSet actSet;
UINFO(9, " Add to sort: " << vtxp << endl); UINFO(9, " Add to sort: " << vtxp << endl);
if (debug() >= 9) vtxp->nodep()->dumpTree(cout, "- trnode: "); if (debug() >= 9) vtxp->nodep()->dumpTree("- trnode: ");
for (const V3GraphEdge* edgep = vtxp->inBeginp(); edgep; for (const V3GraphEdge* edgep = vtxp->inBeginp(); edgep;
edgep = edgep->inNextp()) { edgep = edgep->inNextp()) {
const TraceActivityVertex* const cfvertexp const TraceActivityVertex* const cfvertexp

View File

@ -818,7 +818,7 @@ class TristateVisitor final : public TristateBaseVisitor {
if (envarp) { if (envarp) {
AstAssignW* const enAssp = new AstAssignW{ AstAssignW* const enAssp = new AstAssignW{
enp->fileline(), new AstVarRef{envarp->fileline(), envarp, VAccess::WRITE}, enp}; enp->fileline(), new AstVarRef{envarp->fileline(), envarp, VAccess::WRITE}, enp};
if (debug() >= 9) enAssp->dumpTree(cout, "enAssp: "); if (debug() >= 9) enAssp->dumpTree("- enAssp: ");
nodep->addStmtsp(enAssp); nodep->addStmtsp(enAssp);
} }
@ -826,7 +826,7 @@ class TristateVisitor final : public TristateBaseVisitor {
AstNode* const assp = new AstAssignW{ AstNode* const assp = new AstAssignW{
lhsp->fileline(), new AstVarRef{lhsp->fileline(), lhsp, VAccess::WRITE}, orp}; lhsp->fileline(), new AstVarRef{lhsp->fileline(), lhsp, VAccess::WRITE}, orp};
assp->user2(U2_BOTH); // Don't process further; already resolved assp->user2(U2_BOTH); // Don't process further; already resolved
if (debug() >= 9) assp->dumpTree(cout, "-lhsp-eqn: "); if (debug() >= 9) assp->dumpTree("- lhsp-eqn: ");
nodep->addStmtsp(assp); nodep->addStmtsp(assp);
} }
@ -1072,7 +1072,7 @@ class TristateVisitor final : public TristateBaseVisitor {
AstNodeExpr* const newp AstNodeExpr* const newp
= newEnableDeposit(nodep, VN_AS(nodep->user1p(), NodeExpr)); = newEnableDeposit(nodep, VN_AS(nodep->user1p(), NodeExpr));
nodep->fromp()->user1p(newp); // Push to varref (etc) nodep->fromp()->user1p(newp); // Push to varref (etc)
if (debug() >= 9) newp->dumpTree(cout, "-assign-sel; "); if (debug() >= 9) newp->dumpTree("- assign-sel: ");
m_tgraph.didProcess(nodep); m_tgraph.didProcess(nodep);
} }
iterateChildren(nodep); iterateChildren(nodep);
@ -1150,7 +1150,7 @@ class TristateVisitor final : public TristateBaseVisitor {
associateLogic(nodep->rhsp(), nodep); associateLogic(nodep->rhsp(), nodep);
m_tgraph.setTristate(nodep); m_tgraph.setTristate(nodep);
} else { } else {
if (debug() >= 9) nodep->backp()->dumpTree(cout, "-bufif: "); if (debug() >= 9) nodep->backp()->dumpTree("- bufif: ");
if (m_alhs) { if (m_alhs) {
nodep->v3warn(E_UNSUPPORTED, nodep->v3warn(E_UNSUPPORTED,
"Unsupported LHS tristate construct: " << nodep->prettyTypeName()); "Unsupported LHS tristate construct: " << nodep->prettyTypeName());
@ -1252,7 +1252,7 @@ class TristateVisitor final : public TristateBaseVisitor {
nodep->user2(U2_NONGRAPH); nodep->user2(U2_NONGRAPH);
iterateAndNextNull(nodep->rhsp()); iterateAndNextNull(nodep->rhsp());
UINFO(9, dbgState() << nodep << endl); UINFO(9, dbgState() << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, "-assign: "); if (debug() >= 9) nodep->dumpTree("- assign: ");
// if the rhsp of this assign statement has an output enable driver, // if the rhsp of this assign statement has an output enable driver,
// then propagate the corresponding output enable assign statement. // then propagate the corresponding output enable assign statement.
// down the lvalue tree by recursion for eventual attachment to // down the lvalue tree by recursion for eventual attachment to
@ -1322,8 +1322,8 @@ class TristateVisitor final : public TristateBaseVisitor {
new AstEqCase{fl, new AstConst{fl, oneIfEnOne}, rhsp}}; new AstEqCase{fl, new AstConst{fl, oneIfEnOne}, rhsp}};
if (neq) newp = new AstLogNot{fl, newp}; if (neq) newp = new AstLogNot{fl, newp};
UINFO(9, " newceq " << newp << endl); UINFO(9, " newceq " << newp << endl);
if (debug() >= 9) nodep->dumpTree(cout, "-caseeq-old: "); if (debug() >= 9) nodep->dumpTree("- caseeq-old: ");
if (debug() >= 9) newp->dumpTree(cout, "-caseeq-new: "); if (debug() >= 9) newp->dumpTree("- caseeq-new: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (constp && nodep->rhsp()->user1p()) { } else if (constp && nodep->rhsp()->user1p()) {
@ -1338,8 +1338,8 @@ class TristateVisitor final : public TristateBaseVisitor {
if (neq) newp = new AstLogNot{fl, newp}; if (neq) newp = new AstLogNot{fl, newp};
rhsp->user1p(nullptr); rhsp->user1p(nullptr);
UINFO(9, " newceq " << newp << endl); UINFO(9, " newceq " << newp << endl);
if (debug() >= 9) nodep->dumpTree(cout, "-caseeq-old: "); if (debug() >= 9) nodep->dumpTree("- caseeq-old: ");
if (debug() >= 9) newp->dumpTree(cout, "-caseeq-new: "); if (debug() >= 9) newp->dumpTree("- caseeq-new: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { } else {
@ -1419,7 +1419,7 @@ class TristateVisitor final : public TristateBaseVisitor {
} }
newp = new AstAdd{nodep->fileline(), nodep, newp}; newp = new AstAdd{nodep->fileline(), nodep, newp};
} }
if (debug() >= 9) newp->dumpTree(cout, "-countout: "); if (debug() >= 9) newp->dumpTree("- countout: ");
relinkHandle.relink(newp); relinkHandle.relink(newp);
} }
iterateChildren(nodep); iterateChildren(nodep);
@ -1435,7 +1435,7 @@ class TristateVisitor final : public TristateBaseVisitor {
varrefp = VN_AS(VN_AS(nodep->lhsp(), Sel)->fromp(), VarRef); varrefp = VN_AS(VN_AS(nodep->lhsp(), Sel)->fromp(), VarRef);
} }
if (!varrefp) { if (!varrefp) {
if (debug() >= 4) nodep->dumpTree(cout, "- "); if (debug() >= 4) nodep->dumpTree("- ");
nodep->v3warn(E_UNSUPPORTED, "Unsupported pullup/down (weak driver) construct."); nodep->v3warn(E_UNSUPPORTED, "Unsupported pullup/down (weak driver) construct.");
} else { } else {
if (m_graphing) { if (m_graphing) {
@ -1514,7 +1514,7 @@ class TristateVisitor final : public TristateBaseVisitor {
} }
// Tristate exists: // Tristate exists:
UINFO(9, dbgState() << nodep << endl); UINFO(9, dbgState() << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, "-pin-pre: "); if (debug() >= 9) nodep->dumpTree("- pin-pre: ");
// Empty/in-only; need Z to propagate // Empty/in-only; need Z to propagate
const bool inDeclProcessing = (nodep->exprp() const bool inDeclProcessing = (nodep->exprp()
@ -1569,7 +1569,7 @@ class TristateVisitor final : public TristateBaseVisitor {
m_modp->addStmtsp(enVarp); m_modp->addStmtsp(enVarp);
enrefp = new AstVarRef{nodep->fileline(), enVarp, VAccess::READ}; enrefp = new AstVarRef{nodep->fileline(), enVarp, VAccess::READ};
UINFO(9, " newvrf " << enrefp << endl); UINFO(9, " newvrf " << enrefp << endl);
if (debug() >= 9) enpinp->dumpTree(cout, "-pin-ena: "); if (debug() >= 9) enpinp->dumpTree("- pin-ena: ");
} }
// Create new output pin // Create new output pin
const AstAssignW* outAssignp = nullptr; // If reconnected, the related assignment const AstAssignW* outAssignp = nullptr; // If reconnected, the related assignment
@ -1600,11 +1600,11 @@ class TristateVisitor final : public TristateBaseVisitor {
// a VarRef without any ArraySel, etc // a VarRef without any ArraySel, etc
TristatePinVisitor{outexprp, m_tgraph, true}; TristatePinVisitor{outexprp, m_tgraph, true};
} }
if (debug() >= 9) outpinp->dumpTree(cout, "-pin-opr: "); if (debug() >= 9) outpinp->dumpTree("- pin-opr: ");
outAssignp = V3Inst::pinReconnectSimple(outpinp, m_cellp, outAssignp = V3Inst::pinReconnectSimple(outpinp, m_cellp,
true); // Note may change outpinp->exprp() true); // Note may change outpinp->exprp()
if (debug() >= 9) outpinp->dumpTree(cout, "-pin-out: "); if (debug() >= 9) outpinp->dumpTree("- pin-out: ");
if (debug() >= 9 && outAssignp) outAssignp->dumpTree(cout, "-pin-out: "); if (debug() >= 9 && outAssignp) outAssignp->dumpTree("- pin-out: ");
// Must still iterate the outAssignp, as need to build output equation // Must still iterate the outAssignp, as need to build output equation
} }
@ -1612,8 +1612,8 @@ class TristateVisitor final : public TristateBaseVisitor {
const TristatePinVisitor visitor{nodep->exprp(), m_tgraph, false}; const TristatePinVisitor visitor{nodep->exprp(), m_tgraph, false};
const AstNode* const inAssignp = V3Inst::pinReconnectSimple( const AstNode* const inAssignp = V3Inst::pinReconnectSimple(
nodep, m_cellp, true); // Note may change nodep->exprp() nodep, m_cellp, true); // Note may change nodep->exprp()
if (debug() >= 9) nodep->dumpTree(cout, "-pin-in: "); if (debug() >= 9) nodep->dumpTree("- pin-in:: ");
if (debug() >= 9 && inAssignp) inAssignp->dumpTree(cout, "-pin-as: "); if (debug() >= 9 && inAssignp) inAssignp->dumpTree("- pin-as:: ");
// Connect enable to output signal // Connect enable to output signal
AstVarRef* exprrefp; // Tristate variable that the Pin's expression refers to AstVarRef* exprrefp; // Tristate variable that the Pin's expression refers to

View File

@ -135,7 +135,7 @@ private:
fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}))}; fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}))};
newp->branchPred(VBranchPred::BP_LIKELY); newp->branchPred(VBranchPred::BP_LIKELY);
newp->isBoundsCheck(true); newp->isBoundsCheck(true);
if (debug() >= 9) newp->dumpTree(cout, " _new: "); if (debug() >= 9) newp->dumpTree("- _new: ");
abovep->addNextStmt(newp, abovep); abovep->addNextStmt(newp, abovep);
prep->user2p(newp); // Save so we may LogAnd it next time prep->user2p(newp); // Save so we may LogAnd it next time
} }
@ -321,7 +321,7 @@ private:
void visit(AstConst* nodep) override { void visit(AstConst* nodep) override {
if (m_constXCvt && nodep->num().isFourState()) { if (m_constXCvt && nodep->num().isFourState()) {
UINFO(4, " CONST4 " << nodep << endl); UINFO(4, " CONST4 " << nodep << endl);
if (debug() >= 9) nodep->dumpTree(cout, " Const_old: "); if (debug() >= 9) nodep->dumpTree("- Const_old: ");
// CONST(num) -> VARREF(newvarp) // CONST(num) -> VARREF(newvarp)
// -> VAR(newvarp) // -> VAR(newvarp)
// -> INITIAL(VARREF(newvarp, OR(num_No_Xs,AND(random,num_1s_Where_X)) // -> INITIAL(VARREF(newvarp, OR(num_No_Xs,AND(random,num_1s_Where_X))
@ -371,9 +371,9 @@ private:
m_modp->addStmtsp(newvarp); m_modp->addStmtsp(newvarp);
m_modp->addStmtsp(newinitp); m_modp->addStmtsp(newinitp);
m_modp->addStmtsp(afterp); m_modp->addStmtsp(afterp);
if (debug() >= 9) newref1p->dumpTree(cout, " _new: "); if (debug() >= 9) newref1p->dumpTree("- _new: ");
if (debug() >= 9) newvarp->dumpTree(cout, " _new: "); if (debug() >= 9) newvarp->dumpTree("- _new: ");
if (debug() >= 9) newinitp->dumpTree(cout, " _new: "); if (debug() >= 9) newinitp->dumpTree("- _new: ");
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
} }
} }
@ -391,7 +391,7 @@ private:
// Find range of dtype we are selecting from // Find range of dtype we are selecting from
// Similar code in V3Const::warnSelect // Similar code in V3Const::warnSelect
const int maxmsb = nodep->fromp()->dtypep()->width() - 1; const int maxmsb = nodep->fromp()->dtypep()->width() - 1;
if (debug() >= 9) nodep->dumpTree(cout, "sel_old: "); if (debug() >= 9) nodep->dumpTree("- sel_old: ");
// If (maxmsb >= selected), we're in bound // If (maxmsb >= selected), we're in bound
AstNodeExpr* condp AstNodeExpr* condp
@ -413,7 +413,7 @@ private:
xnum.setAllBitsX(); xnum.setAllBitsX();
AstNode* const newp = new AstCondBound{nodep->fileline(), condp, nodep, AstNode* const newp = new AstCondBound{nodep->fileline(), condp, nodep,
new AstConst{nodep->fileline(), xnum}}; new AstConst{nodep->fileline(), xnum}};
if (debug() >= 9) newp->dumpTree(cout, " _new: "); if (debug() >= 9) newp->dumpTree("- _new: ");
// Link in conditional // Link in conditional
replaceHandle.relink(newp); replaceHandle.relink(newp);
// Added X's, tristate them too // Added X's, tristate them too
@ -430,7 +430,7 @@ private:
void visit(AstArraySel* nodep) override { void visit(AstArraySel* nodep) override {
iterateChildren(nodep); iterateChildren(nodep);
if (!nodep->user1SetOnce()) { if (!nodep->user1SetOnce()) {
if (debug() == 9) nodep->dumpTree(cout, "-in: "); if (debug() == 9) nodep->dumpTree("- in: ");
// Guard against reading/writing past end of arrays // Guard against reading/writing past end of arrays
AstNode* const basefromp = AstArraySel::baseFromp(nodep->fromp(), true); AstNode* const basefromp = AstArraySel::baseFromp(nodep->fromp(), true);
bool lvalue = false; bool lvalue = false;
@ -450,7 +450,7 @@ private:
} else { } else {
nodep->v3error("Select from non-array " << dtypep->prettyTypeName()); nodep->v3error("Select from non-array " << dtypep->prettyTypeName());
} }
if (debug() >= 9) nodep->dumpTree(cout, "arraysel_old: "); if (debug() >= 9) nodep->dumpTree("- arraysel_old: ");
// See if the condition is constant true // See if the condition is constant true
AstNodeExpr* condp AstNodeExpr* condp
@ -477,7 +477,7 @@ private:
} }
AstNode* const newp = new AstCondBound{nodep->fileline(), condp, nodep, AstNode* const newp = new AstCondBound{nodep->fileline(), condp, nodep,
new AstConst{nodep->fileline(), xnum}}; new AstConst{nodep->fileline(), xnum}};
if (debug() >= 9) newp->dumpTree(cout, " _new: "); if (debug() >= 9) newp->dumpTree("- _new: ");
// Link in conditional, can blow away temp xor // Link in conditional, can blow away temp xor
replaceHandle.relink(newp); replaceHandle.relink(newp);
// Added X's, tristate them too // Added X's, tristate them too
@ -490,7 +490,7 @@ private:
bitp->fileline(), condp, bitp, bitp->fileline(), condp, bitp,
new AstConst{bitp->fileline(), AstConst::WidthedValue{}, bitp->width(), 0}}; new AstConst{bitp->fileline(), AstConst::WidthedValue{}, bitp->width(), 0}};
// Added X's, tristate them too // Added X's, tristate them too
if (debug() >= 9) newp->dumpTree(cout, " _new: "); if (debug() >= 9) newp->dumpTree("- _new: ");
replaceHandle.relink(newp); replaceHandle.relink(newp);
iterate(newp); iterate(newp);
} else { // lvalue } else { // lvalue

View File

@ -65,7 +65,7 @@ private:
if (m_generate) if (m_generate)
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason); nodep->v3warn(E_UNSUPPORTED, "Unsupported: Can't unroll generate for; " << reason);
UINFO(3, " Can't Unroll: " << reason << " :" << nodep << endl); UINFO(3, " Can't Unroll: " << reason << " :" << nodep << endl);
// if (debug() >= 9) nodep->dumpTree(cout, "-cant-"); // if (debug() >= 9) nodep->dumpTree("- cant: ");
V3Stats::addStatSum(std::string{"Unrolling gave up, "} + reason, 1); V3Stats::addStatSum(std::string{"Unrolling gave up, "} + reason, 1);
return false; return false;
} }
@ -151,7 +151,7 @@ private:
} else { } else {
UINFO(8, " Loop Variable: " << m_forVarp << endl); UINFO(8, " Loop Variable: " << m_forVarp << endl);
} }
if (debug() >= 9) nodep->dumpTree(cout, "- for: "); if (debug() >= 9) nodep->dumpTree("- for: ");
if (!m_generate) { if (!m_generate) {
const AstAssign* const incpAssign = VN_AS(incp, Assign); const AstAssign* const incpAssign = VN_AS(incp, Assign);
@ -213,7 +213,7 @@ private:
simvis.mainParamEmulate(clonep); simvis.mainParamEmulate(clonep);
if (!simvis.optimizable()) { if (!simvis.optimizable()) {
UINFO(3, "Unable to simulate" << endl); UINFO(3, "Unable to simulate" << endl);
if (debug() >= 9) nodep->dumpTree(cout, "- _simtree: "); if (debug() >= 9) nodep->dumpTree("- _simtree: ");
VL_DO_DANGLING(clonep->deleteTree(), clonep); VL_DO_DANGLING(clonep->deleteTree(), clonep);
return false; return false;
} }
@ -368,7 +368,7 @@ private:
if (precondsp) VL_DO_DANGLING(pushDeletep(precondsp), precondsp); if (precondsp) VL_DO_DANGLING(pushDeletep(precondsp), precondsp);
if (initp) VL_DO_DANGLING(pushDeletep(initp), initp); if (initp) VL_DO_DANGLING(pushDeletep(initp), initp);
if (incp && !incp->backp()) VL_DO_DANGLING(pushDeletep(incp), incp); if (incp && !incp->backp()) VL_DO_DANGLING(pushDeletep(incp), incp);
if (debug() >= 9 && newbodysp) newbodysp->dumpTree(cout, "- _new: "); if (debug() >= 9 && newbodysp) newbodysp->dumpTree("- _new: ");
return true; return true;
} }

View File

@ -819,7 +819,7 @@ private:
if (nodep->didWidth()) return; if (nodep->didWidth()) return;
UASSERT_OBJ(m_vup, nodep, "Select under an unexpected context"); UASSERT_OBJ(m_vup, nodep, "Select under an unexpected context");
if (m_vup->prelim()) { if (m_vup->prelim()) {
if (debug() >= 9) nodep->dumpTree(cout, "-selWidth: "); if (debug() >= 9) nodep->dumpTree("- selWidth: ");
userIterateAndNext(nodep->fromp(), WidthVP{CONTEXT_DET, PRELIM}.p()); userIterateAndNext(nodep->fromp(), WidthVP{CONTEXT_DET, PRELIM}.p());
userIterateAndNext(nodep->lsbp(), WidthVP{SELF, PRELIM}.p()); userIterateAndNext(nodep->lsbp(), WidthVP{SELF, PRELIM}.p());
checkCvtUS(nodep->fromp()); checkCvtUS(nodep->fromp());
@ -1838,8 +1838,8 @@ private:
UINFO(9, "CAST " << nodep << endl); UINFO(9, "CAST " << nodep << endl);
nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep()));
if (m_vup->prelim()) { if (m_vup->prelim()) {
// if (debug()) nodep->dumpTree(cout, " CastPre: "); // if (debug()) nodep->dumpTree("- CastPre: ");
// if (debug()) nodep->backp()->dumpTree(cout, " CastPreUpUp: "); // if (debug()) nodep->backp()->dumpTree("- CastPreUpUp: ");
userIterateAndNext(nodep->fromp(), WidthVP{SELF, PRELIM}.p()); userIterateAndNext(nodep->fromp(), WidthVP{SELF, PRELIM}.p());
AstNodeDType* const toDtp = nodep->dtypep()->skipRefToEnump(); AstNodeDType* const toDtp = nodep->dtypep()->skipRefToEnump();
AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump(); AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump();
@ -1914,14 +1914,14 @@ private:
} }
if (!newp) newp = nodep->fromp()->unlinkFrBack(); if (!newp) newp = nodep->fromp()->unlinkFrBack();
nodep->fromp(newp); nodep->fromp(newp);
// if (debug()) nodep->dumpTree(cout, " CastOut: "); // if (debug()) nodep->dumpTree("- CastOut: ");
// if (debug()) nodep->backp()->dumpTree(cout, " CastOutUpUp: "); // if (debug()) nodep->backp()->dumpTree("- CastOutUpUp: ");
} }
if (m_vup->final()) { if (m_vup->final()) {
iterateCheck(nodep, "value", nodep->fromp(), SELF, FINAL, nodep->fromp()->dtypep(), iterateCheck(nodep, "value", nodep->fromp(), SELF, FINAL, nodep->fromp()->dtypep(),
EXTEND_EXP, false); EXTEND_EXP, false);
AstNode* const underp = nodep->fromp()->unlinkFrBack(); AstNode* const underp = nodep->fromp()->unlinkFrBack();
// if (debug()) underp->dumpTree(cout, " CastRep: "); // if (debug()) underp->dumpTree("- CastRep: ");
underp->dtypeFrom(nodep); underp->dtypeFrom(nodep);
nodep->replaceWith(underp); nodep->replaceWith(underp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -1931,7 +1931,7 @@ private:
void visit(AstCastSize* nodep) override { void visit(AstCastSize* nodep) override {
// IEEE: Signedness of result is same as self-determined signedness // 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 // However, the result is same as BITSEL, so we do not sign extend the LHS
// if (debug()) nodep->dumpTree(cout, " CastSizePre: "); // if (debug()) nodep->dumpTree("- CastSizePre: ");
if (m_vup->prelim()) { if (m_vup->prelim()) {
int width = nodep->rhsp()->toSInt(); int width = nodep->rhsp()->toSInt();
if (width < 1) { if (width < 1) {
@ -1948,7 +1948,7 @@ private:
nodep->replaceWith(underp); nodep->replaceWith(underp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} }
// if (debug()) nodep->dumpTree(cout, " CastSizeOut: "); // if (debug()) nodep->dumpTree("- CastSizeOut: ");
} }
void castSized(AstNode* nodep, AstNode* underp, int width) { void castSized(AstNode* nodep, AstNode* underp, int width) {
const AstBasicDType* underDtp = VN_CAST(underp->dtypep(), BasicDType); const AstBasicDType* underDtp = VN_CAST(underp->dtypep(), BasicDType);
@ -1975,7 +1975,7 @@ private:
VL_DANGLING(underp); VL_DANGLING(underp);
underp = nodep->op1p(); // Above asserts that op1 was underp pre-relink underp = nodep->op1p(); // Above asserts that op1 was underp pre-relink
} }
// if (debug()) nodep->dumpTree(cout, " CastSizeClc: "); // if (debug()) nodep->dumpTree("- CastSizeClc: ");
// Next step, make the proper output width // Next step, make the proper output width
{ {
AstNodeDType* const outDtp AstNodeDType* const outDtp
@ -1990,7 +1990,7 @@ private:
} }
} }
void visit(AstVar* nodep) override { void visit(AstVar* nodep) override {
// if (debug()) nodep->dumpTree(cout, " InitPre: "); // if (debug()) nodep->dumpTree("- InitPre: ");
// Must have deterministic constant width // Must have deterministic constant width
// We can't skip this step when width()!=0, as creating a AstVar // 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(). // with non-constant range gets size 1, not size 0. So use didWidth().
@ -2091,13 +2091,13 @@ private:
VL_DANGLING(bdtypep); VL_DANGLING(bdtypep);
} }
if (nodep->valuep() && !didchk) { if (nodep->valuep() && !didchk) {
// if (debug()) nodep->dumpTree(cout, " final: "); // if (debug()) nodep->dumpTree("- final: ");
// AstPattern requires assignments to pass datatype on PRELIM // AstPattern requires assignments to pass datatype on PRELIM
userIterateAndNext(nodep->valuep(), WidthVP{nodep->dtypep(), PRELIM}.p()); userIterateAndNext(nodep->valuep(), WidthVP{nodep->dtypep(), PRELIM}.p());
iterateCheckAssign(nodep, "Initial value", nodep->valuep(), FINAL, nodep->dtypep()); iterateCheckAssign(nodep, "Initial value", nodep->valuep(), FINAL, nodep->dtypep());
} }
UINFO(4, "varWidthed " << nodep << endl); UINFO(4, "varWidthed " << nodep << endl);
// if (debug()) nodep->dumpTree(cout, " InitOut: "); // if (debug()) nodep->dumpTree("- InitOut: ");
nodep->didWidth(true); nodep->didWidth(true);
nodep->doingWidth(false); nodep->doingWidth(false);
} }
@ -2118,14 +2118,14 @@ private:
// Var hasn't been widthed, so make it so. // Var hasn't been widthed, so make it so.
userIterate(nodep->varp(), nullptr); userIterate(nodep->varp(), nullptr);
} }
// if (debug()>=9) { nodep->dumpTree(cout, " VRin "); // if (debug()>=9) { nodep->dumpTree("- VRin:: ");
// nodep->varp()->dumpTree(cout, " forvar "); } // nodep->varp()->dumpTree("- forvar: "); }
// Note genvar's are also entered as integers // Note genvar's are also entered as integers
nodep->dtypeFrom(nodep->varp()); nodep->dtypeFrom(nodep->varp());
if (VN_IS(nodep->backp(), NodeAssign) && nodep->access().isWriteOrRW()) { // On LHS if (VN_IS(nodep->backp(), NodeAssign) && nodep->access().isWriteOrRW()) { // On LHS
UASSERT_OBJ(nodep->dtypep(), nodep, "LHS var should be dtype completed"); UASSERT_OBJ(nodep->dtypep(), nodep, "LHS var should be dtype completed");
} }
// if (debug() >= 9) nodep->dumpTree(cout, " VRout "); // if (debug() >= 9) nodep->dumpTree("- VRout: ");
if (nodep->access().isWriteOrRW() && nodep->varp()->direction() == VDirection::CONSTREF) { if (nodep->access().isWriteOrRW() && nodep->varp()->direction() == VDirection::CONSTREF) {
nodep->v3error("Assigning to const ref variable: " << nodep->prettyNameQ()); nodep->v3error("Assigning to const ref variable: " << nodep->prettyNameQ());
} else if (nodep->access().isWriteOrRW() && nodep->varp()->isConst() && !m_paramsOnly } else if (nodep->access().isWriteOrRW() && nodep->varp()->isConst() && !m_paramsOnly
@ -2156,7 +2156,7 @@ private:
if (itemp->valuep()) { if (itemp->valuep()) {
if (debug() >= 9) { if (debug() >= 9) {
UINFO(0, "EnumInit " << itemp << endl); UINFO(0, "EnumInit " << itemp << endl);
itemp->valuep()->dumpTree(cout, "-EnumInit: "); itemp->valuep()->dumpTree("- EnumInit: ");
} }
V3Const::constifyParamsEdit(itemp->valuep()); // itemp may change V3Const::constifyParamsEdit(itemp->valuep()); // itemp may change
if (!VN_IS(itemp->valuep(), Const)) { if (!VN_IS(itemp->valuep(), Const)) {
@ -2390,7 +2390,7 @@ private:
iterateCheck(nodep, "Inside Item", itemp, CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP); iterateCheck(nodep, "Inside Item", itemp, CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP);
} }
nodep->dtypeSetBit(); nodep->dtypeSetBit();
if (debug() >= 9) nodep->dumpTree(cout, "-inside-in: "); if (debug() >= 9) nodep->dumpTree("- inside-in: ");
// Now rip out the inside and replace with simple math // Now rip out the inside and replace with simple math
AstNodeExpr* newp = nullptr; AstNodeExpr* newp = nullptr;
for (AstNodeExpr *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) { for (AstNodeExpr *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) {
@ -2423,7 +2423,7 @@ private:
} }
} }
if (!newp) newp = new AstConst{nodep->fileline(), AstConst::BitFalse{}}; if (!newp) newp = new AstConst{nodep->fileline(), AstConst::BitFalse{}};
if (debug() >= 9) newp->dumpTree(cout, "-inside-out: "); if (debug() >= 9) newp->dumpTree("- inside-out: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} }
@ -2445,7 +2445,7 @@ private:
void visit(AstNodeUOrStructDType* nodep) override { void visit(AstNodeUOrStructDType* nodep) override {
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
UINFO(5, " NODECLASS " << nodep << endl); UINFO(5, " NODECLASS " << nodep << endl);
// if (debug() >= 9) nodep->dumpTree("-class-in--"); // if (debug() >= 9) nodep->dumpTree("- class-in: ");
if (!nodep->packed()) { if (!nodep->packed()) {
nodep->v3warn(UNPACKED, "Unsupported: Unpacked struct/union"); nodep->v3warn(UNPACKED, "Unsupported: Unpacked struct/union");
if (!v3Global.opt.structsPacked()) { if (!v3Global.opt.structsPacked()) {
@ -2475,7 +2475,7 @@ private:
} }
} }
nodep->widthForce(width, width); // Signing stays as-is, as parsed from declaration nodep->widthForce(width, width); // Signing stays as-is, as parsed from declaration
// if (debug() >= 9) nodep->dumpTree("-class-out-"); // if (debug() >= 9) nodep->dumpTree("- class-out: ");
} }
void visit(AstClass* nodep) override { void visit(AstClass* nodep) override {
if (nodep->didWidthAndSet()) return; if (nodep->didWidthAndSet()) return;
@ -2521,9 +2521,9 @@ private:
} }
void visit(AstMemberSel* nodep) override { void visit(AstMemberSel* nodep) override {
UINFO(5, " MEMBERSEL " << nodep << endl); UINFO(5, " MEMBERSEL " << nodep << endl);
if (debug() >= 9) nodep->dumpTree("-mbs-in: "); if (debug() >= 9) nodep->dumpTree("- mbs-in: ");
userIterateChildren(nodep, WidthVP{SELF, BOTH}.p()); userIterateChildren(nodep, WidthVP{SELF, BOTH}.p());
if (debug() >= 9) nodep->dumpTree("-mbs-ic: "); if (debug() >= 9) nodep->dumpTree("- mbs-ic: ");
// Find the fromp dtype - should be a class // Find the fromp dtype - should be a class
if (!nodep->fromp()->dtypep()) nodep->fromp()->v3fatalSrc("Unlinked data type"); if (!nodep->fromp()->dtypep()) nodep->fromp()->v3fatalSrc("Unlinked data type");
AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump(); AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefToEnump();
@ -2664,7 +2664,7 @@ private:
void visit(AstMethodCall* nodep) override { void visit(AstMethodCall* nodep) override {
UINFO(5, " METHODCALL " << nodep << endl); UINFO(5, " METHODCALL " << nodep << endl);
if (nodep->didWidth()) return; if (nodep->didWidth()) return;
if (debug() >= 9) nodep->dumpTree("-mts-in: "); if (debug() >= 9) nodep->dumpTree("- mts-in: ");
// Should check types the method requires, but at present we don't do much // Should check types the method requires, but at present we don't do much
userIterate(nodep->fromp(), WidthVP{SELF, BOTH}.p()); userIterate(nodep->fromp(), WidthVP{SELF, BOTH}.p());
// Any AstWith is checked later when know types, in methodWithArgument // Any AstWith is checked later when know types, in methodWithArgument
@ -3879,7 +3879,7 @@ private:
} else { } else {
nodep->v3error("Assignment pattern with no members"); nodep->v3error("Assignment pattern with no members");
} }
// if (debug() >= 9) newp->dumpTree("-apat-out: "); // if (debug() >= 9) newp->dumpTree("- apat-out: ");
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
} }
void patternAssoc(AstPattern* nodep, AstAssocArrayDType* arrayDtp, AstPatMember* defaultp) { void patternAssoc(AstPattern* nodep, AstAssocArrayDType* arrayDtp, AstPatMember* defaultp) {
@ -3898,7 +3898,7 @@ private:
newp = newap; newp = newap;
} }
nodep->replaceWith(newp); nodep->replaceWith(newp);
// if (debug() >= 9) newp->dumpTree("-apat-out: "); // if (debug() >= 9) newp->dumpTree("- apat-out: ");
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
} }
void patternWildcard(AstPattern* nodep, AstWildcardArrayDType* arrayDtp, void patternWildcard(AstPattern* nodep, AstWildcardArrayDType* arrayDtp,
@ -3918,7 +3918,7 @@ private:
newp = newap; newp = newap;
} }
nodep->replaceWith(newp); nodep->replaceWith(newp);
// if (debug() >= 9) newp->dumpTree("-apat-out: "); // if (debug() >= 9) newp->dumpTree("- apat-out: ");
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
} }
void patternDynArray(AstPattern* nodep, AstDynArrayDType* arrayp, AstPatMember*) { void patternDynArray(AstPattern* nodep, AstDynArrayDType* arrayp, AstPatMember*) {
@ -3933,7 +3933,7 @@ private:
newp = newap; newp = newap;
} }
nodep->replaceWith(newp); nodep->replaceWith(newp);
// if (debug() >= 9) newp->dumpTree("-apat-out: "); // if (debug() >= 9) newp->dumpTree("- apat-out: ");
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
} }
void patternQueue(AstPattern* nodep, AstQueueDType* arrayp, AstPatMember*) { void patternQueue(AstPattern* nodep, AstQueueDType* arrayp, AstPatMember*) {
@ -3948,7 +3948,7 @@ private:
newp = newap; newp = newap;
} }
nodep->replaceWith(newp); nodep->replaceWith(newp);
// if (debug() >= 9) newp->dumpTree("-apat-out: "); // if (debug() >= 9) newp->dumpTree("- apat-out: ");
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
} }
void patternBasic(AstPattern* nodep, AstNodeDType* vdtypep, AstPatMember* defaultp) { void patternBasic(AstPattern* nodep, AstNodeDType* vdtypep, AstPatMember* defaultp) {
@ -3997,7 +3997,7 @@ private:
} else { } else {
nodep->v3error("Assignment pattern with no members"); nodep->v3error("Assignment pattern with no members");
} }
// if (debug() >= 9) newp->dumpTree("-apat-out: "); // if (debug() >= 9) newp->dumpTree("- apat-out: ");
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
} }
AstNodeExpr* patternMemberValueIterate(AstPatMember* patp) { AstNodeExpr* patternMemberValueIterate(AstPatMember* patp) {
@ -4153,13 +4153,13 @@ private:
} }
void visit(AstNodeIf* nodep) override { void visit(AstNodeIf* nodep) override {
assertAtStatement(nodep); assertAtStatement(nodep);
// if (debug()) nodep->dumpTree(cout, " IfPre: "); // if (debug()) nodep->dumpTree("- IfPre: ");
if (!VN_IS(nodep, GenIf)) { // for m_paramsOnly if (!VN_IS(nodep, GenIf)) { // for m_paramsOnly
userIterateAndNext(nodep->thensp(), nullptr); userIterateAndNext(nodep->thensp(), nullptr);
userIterateAndNext(nodep->elsesp(), nullptr); userIterateAndNext(nodep->elsesp(), nullptr);
} }
iterateCheckBool(nodep, "If", nodep->condp(), BOTH); // it's like an if() condition. iterateCheckBool(nodep, "If", nodep->condp(), BOTH); // it's like an if() condition.
// if (debug()) nodep->dumpTree(cout, " IfOut: "); // if (debug()) nodep->dumpTree("- IfOut: ");
} }
void visit(AstExprStmt* nodep) override { void visit(AstExprStmt* nodep) override {
userIterateAndNext(nodep->stmtsp(), nullptr); userIterateAndNext(nodep->stmtsp(), nullptr);
@ -4170,7 +4170,7 @@ private:
void visit(AstForeach* nodep) override { void visit(AstForeach* nodep) override {
const AstSelLoopVars* const loopsp = VN_CAST(nodep->arrayp(), SelLoopVars); const AstSelLoopVars* const loopsp = VN_CAST(nodep->arrayp(), SelLoopVars);
UASSERT_OBJ(loopsp, nodep, "No loop variables under foreach"); UASSERT_OBJ(loopsp, nodep, "No loop variables under foreach");
// if (debug()) nodep->dumpTree(cout, "-foreach-old: "); // if (debug()) nodep->dumpTree("- foreach-old: ");
userIterateAndNext(loopsp->fromp(), WidthVP{SELF, BOTH}.p()); userIterateAndNext(loopsp->fromp(), WidthVP{SELF, BOTH}.p());
AstNodeExpr* const fromp = loopsp->fromp(); AstNodeExpr* const fromp = loopsp->fromp();
UASSERT_OBJ(fromp->dtypep(), fromp, "Missing data type"); UASSERT_OBJ(fromp->dtypep(), fromp, "Missing data type");
@ -4308,7 +4308,7 @@ private:
} else { } else {
lastBodyPointp->unlinkFrBack(); lastBodyPointp->unlinkFrBack();
} }
// if (debug()) newp->dumpTreeAndNext(cout, "-foreach-new: "); // if (debug()) newp->dumpTreeAndNext(cout, "- foreach-new: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(lastBodyPointp->deleteTree(), lastBodyPointp); VL_DO_DANGLING(lastBodyPointp->deleteTree(), lastBodyPointp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -4352,9 +4352,9 @@ private:
// handled in each visitor. // handled in each visitor.
// Then LHS sign-extends only if *RHS* is signed // Then LHS sign-extends only if *RHS* is signed
assertAtStatement(nodep); assertAtStatement(nodep);
// if (debug()) nodep->dumpTree(cout, " AssignPre: "); // if (debug()) nodep->dumpTree("- AssignPre: ");
{ {
// if (debug()) nodep->dumpTree(cout, "- assin: "); // if (debug()) nodep->dumpTree("- assin:: ");
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, BOTH}.p()); userIterateAndNext(nodep->lhsp(), WidthVP{SELF, BOTH}.p());
UASSERT_OBJ(nodep->lhsp()->dtypep(), nodep, "How can LHS be untyped?"); UASSERT_OBJ(nodep->lhsp()->dtypep(), nodep, "How can LHS be untyped?");
UASSERT_OBJ(nodep->lhsp()->dtypep()->widthSized(), nodep, "How can LHS be unsized?"); UASSERT_OBJ(nodep->lhsp()->dtypep()->widthSized(), nodep, "How can LHS be unsized?");
@ -4363,11 +4363,11 @@ private:
// AstPattern needs to know the proposed data type of the lhs, so pass on the prelim // AstPattern needs to know the proposed data type of the lhs, so pass on the prelim
userIterateAndNext(nodep->rhsp(), WidthVP{nodep->dtypep(), PRELIM}.p()); userIterateAndNext(nodep->rhsp(), WidthVP{nodep->dtypep(), PRELIM}.p());
// //
// if (debug()) nodep->dumpTree(cout, "- assign: "); // if (debug()) nodep->dumpTree("- assign: ");
AstNodeDType* const lhsDTypep AstNodeDType* const lhsDTypep
= nodep->lhsp()->dtypep(); // Note we use rhsp for context determined = nodep->lhsp()->dtypep(); // Note we use rhsp for context determined
iterateCheckAssign(nodep, "Assign RHS", nodep->rhsp(), FINAL, lhsDTypep); iterateCheckAssign(nodep, "Assign RHS", nodep->rhsp(), FINAL, lhsDTypep);
// if (debug()) nodep->dumpTree(cout, " AssignOut: "); // if (debug()) nodep->dumpTree("- AssignOut: ");
} }
if (const AstBasicDType* const basicp = nodep->rhsp()->dtypep()->basicp()) { if (const AstBasicDType* const basicp = nodep->rhsp()->dtypep()->basicp()) {
if (basicp->isEvent()) { if (basicp->isEvent()) {
@ -4797,7 +4797,7 @@ private:
iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition.
} }
void visit(AstPin* nodep) override { void visit(AstPin* nodep) override {
// if (debug()) nodep->dumpTree(cout, "- PinPre: "); // if (debug()) nodep->dumpTree("- PinPre: ");
// TOP LEVEL NODE // TOP LEVEL NODE
if (nodep->modVarp() && nodep->modVarp()->isGParam()) { if (nodep->modVarp() && nodep->modVarp()->isGParam()) {
// Widthing handled as special init() case // Widthing handled as special init() case
@ -4926,7 +4926,7 @@ private:
iterateCheckAssign(nodep, "pin connection", nodep->exprp(), FINAL, subDTypep); iterateCheckAssign(nodep, "pin connection", nodep->exprp(), FINAL, subDTypep);
} }
} }
// if (debug()) nodep->dumpTree(cout, "- PinOut: "); // if (debug()) nodep->dumpTree("- PinOut: ");
} }
void visit(AstCell* nodep) override { void visit(AstCell* nodep) override {
VL_RESTORER(m_cellp); VL_RESTORER(m_cellp);
@ -5066,7 +5066,7 @@ private:
void visit(AstFuncRef* nodep) override { void visit(AstFuncRef* nodep) override {
visit(static_cast<AstNodeFTaskRef*>(nodep)); visit(static_cast<AstNodeFTaskRef*>(nodep));
nodep->dtypeFrom(nodep->taskp()); nodep->dtypeFrom(nodep->taskp());
// if (debug()) nodep->dumpTree(cout, " FuncOut: "); // if (debug()) nodep->dumpTree("- FuncOut: ");
} }
// Returns true if dtypep0 and dtypep1 have same dimensions // Returns true if dtypep0 and dtypep1 have same dimensions
static bool areSameSize(AstUnpackArrayDType* dtypep0, AstUnpackArrayDType* dtypep1) { static bool areSameSize(AstUnpackArrayDType* dtypep0, AstUnpackArrayDType* dtypep1) {
@ -5726,7 +5726,7 @@ private:
// because the rhs could be larger, and we need to have proper editing to get the widths // because the rhs could be larger, and we need to have proper editing to get the widths
// to be the same for our operations. // to be the same for our operations.
// //
// if (debug() >= 9) { UINFO(0,"-rus "<<m_vup<<endl); nodep->dumpTree(cout, "-rusin-"); } // if (debug() >= 9) { UINFO(0,"rus "<<m_vup<<endl); nodep->dumpTree("- rusin: "); }
if (m_vup->prelim()) { // First stage evaluation if (m_vup->prelim()) { // First stage evaluation
// Determine expression widths only relying on what's in the subops // Determine expression widths only relying on what's in the subops
userIterateAndNext(nodep->lhsp(), WidthVP{CONTEXT_DET, PRELIM}.p()); userIterateAndNext(nodep->lhsp(), WidthVP{CONTEXT_DET, PRELIM}.p());
@ -5782,7 +5782,7 @@ private:
iterateCheck(nodep, "RHS", nodep->rhsp(), CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP, iterateCheck(nodep, "RHS", nodep->rhsp(), CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP,
rhsWarn); rhsWarn);
} }
// if (debug() >= 9) nodep->dumpTree(cout, "-rusou-"); // if (debug() >= 9) nodep->dumpTree("- rusou: ");
} }
void visit_real_add_sub(AstNodeBiop* nodep) { void visit_real_add_sub(AstNodeBiop* nodep) {
// CALLER: AddD, MulD, ... // CALLER: AddD, MulD, ...
@ -5925,8 +5925,8 @@ private:
num.opRepl(constp->num(), expWidth); // {width{'1}} num.opRepl(constp->num(), expWidth); // {width{'1}}
AstNodeExpr* const newp = new AstConst{constp->fileline(), num}; AstNodeExpr* const newp = new AstConst{constp->fileline(), num};
// Spec says always unsigned with proper width // Spec says always unsigned with proper width
if (debug() > 4) constp->dumpTree(cout, " fixAutoExtend_old: "); if (debug() > 4) constp->dumpTree("- fixAutoExtend_old: ");
if (debug() > 4) newp->dumpTree(cout, " _new: "); if (debug() > 4) newp->dumpTree("- _new: ");
constp->replaceWith(newp); constp->replaceWith(newp);
VL_DO_DANGLING(constp->deleteTree(), constp); VL_DO_DANGLING(constp->deleteTree(), constp);
// Tell caller the new constp, and that we changed it. // Tell caller the new constp, and that we changed it.
@ -5943,8 +5943,8 @@ private:
num.opExtendXZ(constp->num(), constp->width()); num.opExtendXZ(constp->num(), constp->width());
AstNodeExpr* const newp = new AstConst{constp->fileline(), num}; AstNodeExpr* const newp = new AstConst{constp->fileline(), num};
// Spec says always unsigned with proper width // Spec says always unsigned with proper width
if (debug() > 4) constp->dumpTree(cout, " fixUnszExtend_old: "); if (debug() > 4) constp->dumpTree("- fixUnszExtend_old: ");
if (debug() > 4) newp->dumpTree(cout, " _new: "); if (debug() > 4) newp->dumpTree("- _new: ");
constp->replaceWith(newp); constp->replaceWith(newp);
VL_DO_DANGLING(constp->deleteTree(), constp); VL_DO_DANGLING(constp->deleteTree(), constp);
// Tell caller the new constp, and that we changed it. // Tell caller the new constp, and that we changed it.
@ -6043,7 +6043,7 @@ private:
void iterateCheckAssign(AstNode* nodep, const char* side, AstNode* rhsp, Stage stage, void iterateCheckAssign(AstNode* nodep, const char* side, AstNode* rhsp, Stage stage,
AstNodeDType* lhsDTypep) { AstNodeDType* lhsDTypep) {
// Check using assignment-like context rules // Check using assignment-like context rules
// if (debug()) nodep->dumpTree(cout, "-checkass: "); // if (debug()) nodep->dumpTree("- checkass: ");
UASSERT_OBJ(stage == FINAL, nodep, "Bad width call"); UASSERT_OBJ(stage == FINAL, nodep, "Bad width call");
// We iterate and size the RHS based on the result of RHS evaluation // We iterate and size the RHS based on the result of RHS evaluation
checkClassAssign(nodep, side, rhsp, lhsDTypep); checkClassAssign(nodep, side, rhsp, lhsDTypep);
@ -6051,7 +6051,7 @@ private:
= (VN_IS(nodep, NodeAssign) && VN_IS(VN_AS(nodep, NodeAssign)->lhsp(), NodeStream)); = (VN_IS(nodep, NodeAssign) && VN_IS(VN_AS(nodep, NodeAssign)->lhsp(), NodeStream));
rhsp = iterateCheck(nodep, side, rhsp, ASSIGN, FINAL, lhsDTypep, rhsp = iterateCheck(nodep, side, rhsp, ASSIGN, FINAL, lhsDTypep,
lhsStream ? EXTEND_OFF : EXTEND_LHS); lhsStream ? EXTEND_OFF : EXTEND_LHS);
// if (debug()) nodep->dumpTree(cout, "-checkout: "); // if (debug()) nodep->dumpTree("- checkout: ");
if (rhsp) {} // cppcheck if (rhsp) {} // cppcheck
} }
@ -6092,7 +6092,7 @@ private:
const bool bad = widthBad(underp, nodep->findBitDType()); const bool bad = widthBad(underp, nodep->findBitDType());
if (bad) { if (bad) {
{ // if (warnOn), but not needed here { // if (warnOn), but not needed here
if (debug() > 4) nodep->backp()->dumpTree(cout, " back: "); if (debug() > 4) nodep->backp()->dumpTree("- back: ");
nodep->v3warn(WIDTH, "Logical operator " nodep->v3warn(WIDTH, "Logical operator "
<< nodep->prettyTypeName() << " expects 1 bit on the " << nodep->prettyTypeName() << " expects 1 bit on the "
<< side << ", but " << side << "'s " << side << ", but " << side << "'s "
@ -6157,7 +6157,7 @@ private:
<< " (IEEE 1800-2017 6.19.3)\n" << " (IEEE 1800-2017 6.19.3)\n"
<< nodep->warnMore() << nodep->warnMore()
<< "... Suggest use enum's mnemonic, or static cast"); << "... Suggest use enum's mnemonic, or static cast");
if (debug()) nodep->backp()->dumpTree(cout, "- back: "); if (debug()) nodep->backp()->dumpTree("- back: ");
} }
} }
AstNodeDType* subDTypep = expDTypep; AstNodeDType* subDTypep = expDTypep;
@ -6273,7 +6273,7 @@ private:
warnOn = false; warnOn = false;
} }
if (bad && warnOn) { if (bad && warnOn) {
if (debug() > 4) nodep->backp()->dumpTree(cout, " back: "); if (debug() > 4) nodep->backp()->dumpTree("- back: ");
nodep->v3warn( nodep->v3warn(
WIDTH, ucfirst(nodep->prettyOperatorName()) WIDTH, ucfirst(nodep->prettyOperatorName())
<< " expects " << expWidth << " expects " << expWidth

View File

@ -171,8 +171,8 @@ private:
nodep->replaceWith(newp); nodep->replaceWith(newp);
AstNode* const oldp = nodep; AstNode* const oldp = nodep;
nodep = newp; nodep = newp;
// if (debug() > 4) oldp->dumpTree(cout, " fixConstSize_old: "); // if (debug() > 4) oldp->dumpTree("- fixConstSize_old: ");
// if (debug() > 4) newp->dumpTree(cout, " _new: "); // if (debug() > 4) newp->dumpTree("- _new: ");
VL_DO_DANGLING(pushDeletep(oldp), oldp); VL_DO_DANGLING(pushDeletep(oldp), oldp);
} }
editDType(nodep); editDType(nodep);

View File

@ -204,11 +204,11 @@ private:
// Select of a non-width specified part of an array, i.e. "array[2]" // 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) // This select style has a lsb and msb (no user specified width)
UINFO(6, "SELBIT " << nodep << endl); UINFO(6, "SELBIT " << nodep << endl);
if (debug() >= 9) nodep->backp()->dumpTree(cout, "--SELBT0: "); if (debug() >= 9) nodep->backp()->dumpTree("- SELBT0: ");
// lhsp/rhsp do not need to be constant // lhsp/rhsp do not need to be constant
AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack(); AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack(); // bit we're extracting AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack(); // bit we're extracting
if (debug() >= 9) nodep->dumpTree(cout, "--SELBT2: "); if (debug() >= 9) nodep->dumpTree("- SELBT2: ");
const FromData fromdata = fromDataForArray(nodep, fromp); const FromData fromdata = fromDataForArray(nodep, fromp);
AstNodeDType* const ddtypep = fromdata.m_dtypep; AstNodeDType* const ddtypep = fromdata.m_dtypep;
const VNumRange fromRange = fromdata.m_fromRange; const VNumRange fromRange = fromdata.m_fromRange;
@ -221,7 +221,7 @@ private:
} }
AstArraySel* const newp = new AstArraySel{nodep->fileline(), fromp, subp}; AstArraySel* const newp = new AstArraySel{nodep->fileline(), fromp, subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); if (debug() >= 9) newp->dumpTree("- SELBTn: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (const AstPackArrayDType* const adtypep = VN_CAST(ddtypep, PackArrayDType)) { } else if (const AstPackArrayDType* const adtypep = VN_CAST(ddtypep, PackArrayDType)) {
@ -245,7 +245,7 @@ private:
newp->declRange(fromRange); newp->declRange(fromRange);
newp->declElWidth(elwidth); newp->declElWidth(elwidth);
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); if (debug() >= 9) newp->dumpTree("- SELBTn: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (const AstAssocArrayDType* const adtypep = VN_CAST(ddtypep, AssocArrayDType)) { } else if (const AstAssocArrayDType* const adtypep = VN_CAST(ddtypep, AssocArrayDType)) {
@ -253,7 +253,7 @@ private:
AstNodeExpr* const subp = rhsp; AstNodeExpr* const subp = rhsp;
AstAssocSel* const newp = new AstAssocSel{nodep->fileline(), fromp, subp}; AstAssocSel* const newp = new AstAssocSel{nodep->fileline(), fromp, subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); if (debug() >= 9) newp->dumpTree("- SELBTn: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (const AstWildcardArrayDType* const adtypep } else if (const AstWildcardArrayDType* const adtypep
@ -262,7 +262,7 @@ private:
AstNodeExpr* const subp = rhsp; AstNodeExpr* const subp = rhsp;
AstWildcardSel* const newp = new AstWildcardSel{nodep->fileline(), fromp, subp}; AstWildcardSel* const newp = new AstWildcardSel{nodep->fileline(), fromp, subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); if (debug() >= 9) newp->dumpTree("- SELBTn: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (const AstDynArrayDType* const adtypep = VN_CAST(ddtypep, DynArrayDType)) { } else if (const AstDynArrayDType* const adtypep = VN_CAST(ddtypep, DynArrayDType)) {
@ -270,7 +270,7 @@ private:
AstNodeExpr* const subp = rhsp; AstNodeExpr* const subp = rhsp;
AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, "at", subp}; AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, "at", subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTq: "); if (debug() >= 9) newp->dumpTree("- SELBTq: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (const AstQueueDType* const adtypep = VN_CAST(ddtypep, QueueDType)) { } else if (const AstQueueDType* const adtypep = VN_CAST(ddtypep, QueueDType)) {
@ -278,7 +278,7 @@ private:
AstNodeExpr* const subp = rhsp; AstNodeExpr* const subp = rhsp;
AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, "at", subp}; AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, "at", subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTq: "); if (debug() >= 9) newp->dumpTree("- SELBTq: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(ddtypep, BasicDType) && ddtypep->isString()) { } else if (VN_IS(ddtypep, BasicDType) && ddtypep->isString()) {
@ -305,7 +305,7 @@ private:
new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1}}; new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1}};
newp->declRange(fromRange); newp->declRange(fromRange);
UINFO(6, " new " << newp << endl); UINFO(6, " new " << newp << endl);
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); if (debug() >= 9) newp->dumpTree("- SELBTn: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(ddtypep, NodeUOrStructDType)) { // A bit from the packed struct } else if (VN_IS(ddtypep, NodeUOrStructDType)) { // A bit from the packed struct
@ -316,7 +316,7 @@ private:
new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1}}; new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1}};
newp->declRange(fromRange); newp->declRange(fromRange);
UINFO(6, " new " << newp << endl); UINFO(6, " new " << newp << endl);
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: "); if (debug() >= 9) newp->dumpTree("- SELBTn: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { // nullptr=bad extract, or unknown node type } else { // nullptr=bad extract, or unknown node type
@ -333,11 +333,11 @@ private:
// SELEXTRACT(from,msb,lsb) -> SEL(from, lsb, 1+msb-lsb) // SELEXTRACT(from,msb,lsb) -> SEL(from, lsb, 1+msb-lsb)
// This select style has a (msb or lsb) and width // This select style has a (msb or lsb) and width
UINFO(6, "SELEXTRACT " << nodep << endl); UINFO(6, "SELEXTRACT " << nodep << endl);
// if (debug() >= 9) nodep->dumpTree(cout, "--SELEX0: "); // if (debug() >= 9) nodep->dumpTree("- SELEX0: ");
// Below 2 lines may change nodep->widthp() // Below 2 lines may change nodep->widthp()
V3Const::constifyParamsEdit(nodep->leftp()); // May relink pointed to node V3Const::constifyParamsEdit(nodep->leftp()); // May relink pointed to node
V3Const::constifyParamsEdit(nodep->rightp()); // May relink pointed to node V3Const::constifyParamsEdit(nodep->rightp()); // May relink pointed to node
// if (debug() >= 9) nodep->dumpTree(cout, "--SELEX3: "); // if (debug() >= 9) nodep->dumpTree("- SELEX3: ");
checkConstantOrReplace(nodep->leftp(), checkConstantOrReplace(nodep->leftp(),
"First value of [a:b] isn't a constant, maybe you want +: or -:"); "First value of [a:b] isn't a constant, maybe you want +: or -:");
checkConstantOrReplace(nodep->rightp(), checkConstantOrReplace(nodep->rightp(),
@ -400,7 +400,7 @@ private:
newp->declRange(fromRange); newp->declRange(fromRange);
newp->declElWidth(elwidth); newp->declElWidth(elwidth);
newp->dtypeFrom(sliceDType(adtypep, msb, lsb)); newp->dtypeFrom(sliceDType(adtypep, msb, lsb));
// if (debug() >= 9) newp->dumpTree(cout, "--EXTBTn: "); // if (debug() >= 9) newp->dumpTree("- EXTBTn: ");
UASSERT_OBJ(newp->widthMin() == newp->widthConst(), nodep, "Width mismatch"); UASSERT_OBJ(newp->widthMin() == newp->widthConst(), nodep, "Width mismatch");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -428,7 +428,7 @@ private:
= new AstSel{nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp}; = new AstSel{nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp};
newp->declRange(fromRange); newp->declRange(fromRange);
UINFO(6, " new " << newp << endl); UINFO(6, " new " << newp << endl);
// if (debug() >= 9) newp->dumpTree(cout, "--SELEXnew: "); // if (debug() >= 9) newp->dumpTree("- SELEXnew: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(ddtypep, NodeUOrStructDType)) { } else if (VN_IS(ddtypep, NodeUOrStructDType)) {
@ -450,7 +450,7 @@ private:
= new AstSel{nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp}; = new AstSel{nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp};
newp->declRange(fromRange); newp->declRange(fromRange);
UINFO(6, " new " << newp << endl); UINFO(6, " new " << newp << endl);
// if (debug() >= 9) newp->dumpTree(cout, "--SELEXnew: "); // if (debug() >= 9) newp->dumpTree("- SELEXnew: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(ddtypep, QueueDType)) { } else if (VN_IS(ddtypep, QueueDType)) {
@ -481,12 +481,12 @@ private:
// This select style has a lsb and width // This select style has a lsb and width
UINFO(6, "SELPLUS/MINUS " << nodep << endl); UINFO(6, "SELPLUS/MINUS " << nodep << endl);
// Below 2 lines may change nodep->widthp() // Below 2 lines may change nodep->widthp()
if (debug() >= 9) nodep->dumpTree(cout, "--SELPM0: "); if (debug() >= 9) nodep->dumpTree("- SELPM0: ");
V3Width::widthParamsEdit(nodep->rhsp()); // constifyEdit doesn't ensure widths finished V3Width::widthParamsEdit(nodep->rhsp()); // constifyEdit doesn't ensure widths finished
V3Const::constifyEdit(nodep->rhsp()); // May relink pointed to node, ok if not const V3Const::constifyEdit(nodep->rhsp()); // May relink pointed to node, ok if not const
V3Const::constifyParamsEdit(nodep->thsp()); // May relink pointed to node V3Const::constifyParamsEdit(nodep->thsp()); // May relink pointed to node
checkConstantOrReplace(nodep->thsp(), "Width of :+ or :- bit extract isn't a constant"); checkConstantOrReplace(nodep->thsp(), "Width of :+ or :- bit extract isn't a constant");
if (debug() >= 9) nodep->dumpTree(cout, "--SELPM3: "); if (debug() >= 9) nodep->dumpTree("- SELPM3: ");
// Now replace it with an AstSel // Now replace it with an AstSel
AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack(); AstNodeExpr* const fromp = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack(); AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack();
@ -565,7 +565,7 @@ private:
newp->declRange(fromRange); newp->declRange(fromRange);
newp->declElWidth(elwidth); newp->declElWidth(elwidth);
UINFO(6, " new " << newp << endl); UINFO(6, " new " << newp << endl);
if (debug() >= 9) newp->dumpTree(cout, "--SELNEW: "); if (debug() >= 9) newp->dumpTree("- SELNEW: ");
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { // nullptr=bad extract, or unknown node type } else { // nullptr=bad extract, or unknown node type