Internals: Add missing VL_DO_DANGLING. No functional change intended.
This commit is contained in:
parent
2a9f29912c
commit
1cc37ad6ce
|
|
@ -68,7 +68,7 @@ class ActiveTopVisitor final : public VNVisitor {
|
||||||
UINFO(4, " ACTIVE " << nodep << endl);
|
UINFO(4, " ACTIVE " << nodep << endl);
|
||||||
// Remove duplicate clocks and such; sensesp() may change!
|
// Remove duplicate clocks and such; sensesp() may change!
|
||||||
V3Const::constifyExpensiveEdit(nodep);
|
V3Const::constifyExpensiveEdit(nodep);
|
||||||
AstSenTree* const sensesp = nodep->sensesp();
|
AstSenTree* sensesp = nodep->sensesp();
|
||||||
UASSERT_OBJ(sensesp, nodep, "nullptr");
|
UASSERT_OBJ(sensesp, nodep, "nullptr");
|
||||||
if (sensesp->sensesp() && sensesp->sensesp()->isNever()) {
|
if (sensesp->sensesp() && sensesp->sensesp()->isNever()) {
|
||||||
// Never executing. Kill it.
|
// Never executing. Kill it.
|
||||||
|
|
@ -106,7 +106,7 @@ class ActiveTopVisitor final : public VNVisitor {
|
||||||
// There may be other references to same sense tree,
|
// There may be other references to same sense tree,
|
||||||
// we'll be removing all references when we get to them,
|
// we'll be removing all references when we get to them,
|
||||||
// but don't dangle our pointer yet!
|
// but don't dangle our pointer yet!
|
||||||
pushDeletep(sensesp);
|
VL_DO_DANGLING(pushDeletep(sensesp), sensesp);
|
||||||
}
|
}
|
||||||
nodep->sensesp(wantp);
|
nodep->sensesp(wantp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ class AssertVisitor final : public VNVisitor {
|
||||||
checkifp->isBoundsCheck(true); // To avoid LATCH warning
|
checkifp->isBoundsCheck(true); // To avoid LATCH warning
|
||||||
checkifp->branchPred(VBranchPred::BP_UNLIKELY);
|
checkifp->branchPred(VBranchPred::BP_UNLIKELY);
|
||||||
nodep->replaceWith(checkifp);
|
nodep->replaceWith(checkifp);
|
||||||
pushDeletep(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else {
|
} else {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->v3fatal("Invalid direction");
|
nodep->v3fatal("Invalid direction");
|
||||||
}
|
}
|
||||||
pushDeletep(nodep->unlinkFrBack());
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
}
|
}
|
||||||
void visit(AstDelay* nodep) override {
|
void visit(AstDelay* nodep) override {
|
||||||
// Only cycle delays are relevant in this stage; also only process once
|
// Only cycle delays are relevant in this stage; also only process once
|
||||||
|
|
|
||||||
|
|
@ -762,7 +762,7 @@ class DelayedVisitor final : public VNVisitor {
|
||||||
callp->dtypeSetVoid();
|
callp->dtypeSetVoid();
|
||||||
nodep->replaceWith(callp->makeStmt());
|
nodep->replaceWith(callp->makeStmt());
|
||||||
}
|
}
|
||||||
nodep->deleteTree();
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre/Post logic are created here and their content need no further changes, so ignore.
|
// Pre/Post logic are created here and their content need no further changes, so ignore.
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,7 @@ class DescopeVisitor final : public VNVisitor {
|
||||||
}
|
}
|
||||||
void visit(AstVarScope* nodep) override {
|
void visit(AstVarScope* nodep) override {
|
||||||
// Delete the varscope when we're finished
|
// Delete the varscope when we're finished
|
||||||
nodep->unlinkFrBack();
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
pushDeletep(nodep);
|
|
||||||
}
|
}
|
||||||
void visit(AstNodeVarRef* nodep) override {
|
void visit(AstNodeVarRef* nodep) override {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
|
||||||
|
|
@ -173,13 +173,12 @@ class ForceConvertVisitor final : public VNVisitor {
|
||||||
|
|
||||||
void visit(AstAssignForce* nodep) override {
|
void visit(AstAssignForce* nodep) override {
|
||||||
// The AstAssignForce node will be removed for sure
|
// The AstAssignForce node will be removed for sure
|
||||||
VNRelinker relinker;
|
|
||||||
nodep->unlinkFrBack(&relinker);
|
|
||||||
pushDeletep(nodep);
|
|
||||||
|
|
||||||
FileLine* const flp = nodep->fileline();
|
FileLine* const flp = nodep->fileline();
|
||||||
AstNodeExpr* const lhsp = nodep->lhsp(); // The LValue we are forcing
|
AstNodeExpr* const lhsp = nodep->lhsp(); // The LValue we are forcing
|
||||||
AstNodeExpr* const rhsp = nodep->rhsp(); // The value we are forcing it to
|
AstNodeExpr* const rhsp = nodep->rhsp(); // The value we are forcing it to
|
||||||
|
VNRelinker relinker;
|
||||||
|
nodep->unlinkFrBack(&relinker);
|
||||||
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
|
|
||||||
// Set corresponding enable signals to ones
|
// Set corresponding enable signals to ones
|
||||||
V3Number ones{lhsp, isRangedDType(lhsp) ? lhsp->width() : 1};
|
V3Number ones{lhsp, isRangedDType(lhsp) ? lhsp->width() : 1};
|
||||||
|
|
@ -208,13 +207,12 @@ class ForceConvertVisitor final : public VNVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(AstRelease* nodep) override {
|
void visit(AstRelease* nodep) override {
|
||||||
|
FileLine* const flp = nodep->fileline();
|
||||||
|
AstNodeExpr* const lhsp = nodep->lhsp(); // The LValue we are releasing
|
||||||
// The AstRelease node will be removed for sure
|
// The AstRelease node will be removed for sure
|
||||||
VNRelinker relinker;
|
VNRelinker relinker;
|
||||||
nodep->unlinkFrBack(&relinker);
|
nodep->unlinkFrBack(&relinker);
|
||||||
pushDeletep(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
|
|
||||||
FileLine* const flp = nodep->fileline();
|
|
||||||
AstNodeExpr* const lhsp = nodep->lhsp(); // The LValue we are releasing
|
|
||||||
|
|
||||||
// Set corresponding enable signals to zero
|
// Set corresponding enable signals to zero
|
||||||
V3Number zero{lhsp, isRangedDType(lhsp) ? lhsp->width() : 1};
|
V3Number zero{lhsp, isRangedDType(lhsp) ? lhsp->width() : 1};
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ private:
|
||||||
pushDeletep(pinVarp);
|
pushDeletep(pinVarp);
|
||||||
} // else pinVarp already unlinked when another instance did this step
|
} // else pinVarp already unlinked when another instance did this step
|
||||||
nodep->replaceWith(prevPinp);
|
nodep->replaceWith(prevPinp);
|
||||||
pushDeletep(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,7 @@ public:
|
||||||
~LifeState() {
|
~LifeState() {
|
||||||
V3Stats::addStatSum("Optimizations, Lifetime assign deletions", m_statAssnDel);
|
V3Stats::addStatSum("Optimizations, Lifetime assign deletions", m_statAssnDel);
|
||||||
V3Stats::addStatSum("Optimizations, Lifetime constant prop", m_statAssnCon);
|
V3Stats::addStatSum("Optimizations, Lifetime constant prop", m_statAssnCon);
|
||||||
for (AstNode* ip : m_unlinkps) {
|
for (AstNode* ip : m_unlinkps) VL_DO_DANGLING(ip->unlinkFrBack()->deleteTree(), ip);
|
||||||
ip->unlinkFrBack();
|
|
||||||
ip->deleteTree();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// METHODS
|
// METHODS
|
||||||
void pushUnlinkDeletep(AstNode* nodep) { m_unlinkps.push_back(nodep); }
|
void pushUnlinkDeletep(AstNode* nodep) { m_unlinkps.push_back(nodep); }
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ class LinkCellsVisitor final : public VNVisitor {
|
||||||
iterateAndNextNull(cellsp);
|
iterateAndNextNull(cellsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushDeletep(nodep->unlinkFrBack());
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(AstCell* nodep) override {
|
void visit(AstCell* nodep) override {
|
||||||
|
|
|
||||||
|
|
@ -874,7 +874,7 @@ class LinkParseVisitor final : public VNVisitor {
|
||||||
itemp->v3fatalSrc("Incorrect direction");
|
itemp->v3fatalSrc("Incorrect direction");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushDeletep(itemp->unlinkFrBack());
|
VL_DO_DANGLING(pushDeletep(itemp->unlinkFrBack()), itemp);
|
||||||
}
|
}
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class PremitVisitor final : public VNVisitor {
|
||||||
// Extract into constant pool.
|
// Extract into constant pool.
|
||||||
const bool merge = v3Global.opt.fMergeConstPool();
|
const bool merge = v3Global.opt.fMergeConstPool();
|
||||||
varp = v3Global.rootp()->constPoolp()->findConst(constp, merge)->varp();
|
varp = v3Global.rootp()->constPoolp()->findConst(constp, merge)->varp();
|
||||||
nodep->deleteTree();
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
++m_extractedToConstPool;
|
++m_extractedToConstPool;
|
||||||
} else {
|
} else {
|
||||||
// Keep as local temporary.
|
// Keep as local temporary.
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ private:
|
||||||
nodep->replaceWith(postp);
|
nodep->replaceWith(postp);
|
||||||
postp->addStmtsp(
|
postp->addStmtsp(
|
||||||
new AstAssign{flp, nodep->lhsp()->unlinkFrBack(), nodep->rhsp()->unlinkFrBack()});
|
new AstAssign{flp, nodep->lhsp()->unlinkFrBack(), nodep->rhsp()->unlinkFrBack()});
|
||||||
nodep->deleteTree();
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void visit(AstNodeIf* nodep) override {
|
void visit(AstNodeIf* nodep) override {
|
||||||
|
|
|
||||||
|
|
@ -819,7 +819,7 @@ class RemovePlaceholdersVisitor final : public VNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (emptyOrCommentOnly) {
|
if (emptyOrCommentOnly) {
|
||||||
pushDeletep(nodep->unlinkFrBack());
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
++m_emptyAlways;
|
++m_emptyAlways;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,7 @@ class SplitAsCleanVisitor final : public VNVisitor {
|
||||||
m_keepStmt = true;
|
m_keepStmt = true;
|
||||||
} else {
|
} else {
|
||||||
UINFO(6, " Delete STMT " << nodep << endl);
|
UINFO(6, " Delete STMT " << nodep << endl);
|
||||||
nodep->unlinkFrBack();
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
pushDeletep(nodep);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If something below matches, the upper statement remains too.
|
// If something below matches, the upper statement remains too.
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public:
|
||||||
: m_fl{fl} {}
|
: m_fl{fl} {}
|
||||||
|
|
||||||
~TableBuilder() {
|
~TableBuilder() {
|
||||||
if (m_initp) m_initp->deleteTree();
|
if (m_initp) VL_DO_DANGLING(m_initp->deleteTree(), m_initp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTableSize(AstNodeDType* elemDType, unsigned size) {
|
void setTableSize(AstNodeDType* elemDType, unsigned size) {
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,7 @@ class UnrollVisitor final : public VNVisitor {
|
||||||
iterateAndNextNull(tempp->stmtsp());
|
iterateAndNextNull(tempp->stmtsp());
|
||||||
m_varModeReplace = false;
|
m_varModeReplace = false;
|
||||||
clonep = tempp->stmtsp()->unlinkFrBackWithNext();
|
clonep = tempp->stmtsp()->unlinkFrBackWithNext();
|
||||||
tempp->deleteTree();
|
VL_DO_CLEAR(tempp->deleteTree(), tempp = nullptr);
|
||||||
tempp = nullptr;
|
|
||||||
VL_DO_CLEAR(pushDeletep(m_varValuep), m_varValuep = nullptr);
|
VL_DO_CLEAR(pushDeletep(m_varValuep), m_varValuep = nullptr);
|
||||||
}
|
}
|
||||||
SimulateVisitor simvis;
|
SimulateVisitor simvis;
|
||||||
|
|
@ -456,7 +455,7 @@ class UnrollVisitor final : public VNVisitor {
|
||||||
&& nodep->access().isReadOnly()) {
|
&& nodep->access().isReadOnly()) {
|
||||||
AstNode* const newconstp = m_varValuep->cloneTree(false);
|
AstNode* const newconstp = m_varValuep->cloneTree(false);
|
||||||
nodep->replaceWith(newconstp);
|
nodep->replaceWith(newconstp);
|
||||||
pushDeletep(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue