Internals: Create VL_DO_DANGLING. No functional change intended.

This commit is contained in:
Wilson Snyder
2020-01-16 20:17:11 -05:00
parent 023526ad4b
commit 623c4ec103
72 changed files with 519 additions and 508 deletions
+10 -10
View File
@@ -250,7 +250,7 @@ private:
if (m_valueItem[a] != m_valueItem[b]) { same = false; break; }
}
if (same) {
tree1p->deleteTree(); VL_DANGLING(tree1p);
VL_DO_DANGLING(tree1p->deleteTree(), tree1p);
return tree0p;
}
@@ -299,8 +299,8 @@ private:
if (ifrootp) nodep->replaceWith(ifrootp);
else nodep->unlinkFrBack();
nodep->deleteTree(); VL_DANGLING(nodep);
cexprp->deleteTree(); VL_DANGLING(cexprp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
VL_DO_DANGLING(cexprp->deleteTree(), cexprp);
if (debug()>=9) ifrootp->dumpTree(cout, " _simp: ");
}
@@ -331,7 +331,7 @@ private:
AstConst* iconstp = VN_CAST(icondp, Const);
if (iconstp && neverItem(nodep, iconstp)) {
// X in casez can't ever be executed
icondp->deleteTree(); VL_DANGLING(icondp); VL_DANGLING(iconstp);
VL_DO_DANGLING(icondp->deleteTree(), icondp); VL_DANGLING(iconstp);
// For simplicity, make expression that is not equal, and let later
// optimizations remove it
condp = new AstConst(itemp->fileline(), AstConst::LogicFalse());
@@ -357,7 +357,7 @@ private:
AstNode* and2p = new AstAnd(itemp->fileline(),
new AstConst(itemp->fileline(), numval),
new AstConst(itemp->fileline(), nummask));
icondp->deleteTree(); VL_DANGLING(icondp); VL_DANGLING(iconstp);
VL_DO_DANGLING(icondp->deleteTree(), icondp); VL_DANGLING(iconstp);
condp = AstEq::newTyped(itemp->fileline(), and1p, and2p);
} else {
// Not a caseX mask, we can simply build CASEEQ(cexpr icond)
@@ -375,7 +375,7 @@ private:
itemp->condsp(ifexprp);
}
}
cexprp->deleteTree(); VL_DANGLING(cexprp);
VL_DO_DANGLING(cexprp->deleteTree(), cexprp);
if (!hadDefault) {
// If there was no default, add a empty one, this greatly simplifies below code
// and constant propagation will just eliminate it for us later.
@@ -418,7 +418,7 @@ private:
{ // Make the new lower IF and attach in the tree
AstNode* itemexprp = ifexprp; VL_DANGLING(ifexprp);
if (depth == (CASE_ENCODER_GROUP_DEPTH)) { // End of group - can skip the condition
itemexprp->deleteTree(); VL_DANGLING(itemexprp);
VL_DO_DANGLING(itemexprp->deleteTree(), itemexprp);
itemexprp = new AstConst(itemp->fileline(), AstConst::LogicTrue());
}
AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, NULL);
@@ -434,7 +434,7 @@ private:
if (debug()>=9 && grouprootp) grouprootp->dumpTree(cout, " _new: ");
if (grouprootp) nodep->replaceWith(grouprootp);
else nodep->unlinkFrBack();
nodep->deleteTree(); VL_DANGLING(nodep);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
void replaceCaseParallel(AstCase* nodep, bool noOverlapsAllCovered) {
@@ -468,10 +468,10 @@ private:
// It's a simple priority encoder or complete statement
// we can make a tree of statements to avoid extra comparisons
++m_statCaseFast;
replaceCaseFast(nodep); VL_DANGLING(nodep);
VL_DO_DANGLING(replaceCaseFast(nodep), nodep);
} else {
++m_statCaseSlow;
replaceCaseComplicated(nodep); VL_DANGLING(nodep);
VL_DO_DANGLING(replaceCaseComplicated(nodep), nodep);
}
}
//--------------------