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