Internals: Create VL_DO_DANGLING. No functional change intended.
This commit is contained in:
parent
023526ad4b
commit
623c4ec103
|
|
@ -222,7 +222,7 @@ private:
|
||||||
void clearGuts() VL_REQUIRES(m_mutex) {
|
void clearGuts() VL_REQUIRES(m_mutex) {
|
||||||
for (ItemList::const_iterator it=m_items.begin(); it!=m_items.end(); ++it) {
|
for (ItemList::const_iterator it=m_items.begin(); it!=m_items.end(); ++it) {
|
||||||
VerilatedCovImpItem* itemp = *(it);
|
VerilatedCovImpItem* itemp = *(it);
|
||||||
delete itemp;
|
VL_DO_DANGLING(delete itemp, itemp);
|
||||||
}
|
}
|
||||||
m_items.clear();
|
m_items.clear();
|
||||||
m_indexValues.clear();
|
m_indexValues.clear();
|
||||||
|
|
@ -244,7 +244,7 @@ public:
|
||||||
for (ItemList::iterator it=m_items.begin(); it!=m_items.end(); ++it) {
|
for (ItemList::iterator it=m_items.begin(); it!=m_items.end(); ++it) {
|
||||||
VerilatedCovImpItem* itemp = *(it);
|
VerilatedCovImpItem* itemp = *(it);
|
||||||
if (!itemMatchesString(itemp, matchp)) {
|
if (!itemMatchesString(itemp, matchp)) {
|
||||||
delete itemp;
|
VL_DO_DANGLING(delete itemp, itemp);
|
||||||
} else {
|
} else {
|
||||||
newlist.push_back(itemp);
|
newlist.push_back(itemp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~vl_unordered_set() {
|
~vl_unordered_set() {
|
||||||
delete [] m_bucketsp; VL_DANGLING(m_bucketsp);
|
VL_DO_DANGLING(delete [] m_bucketsp, m_bucketsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
vl_unordered_set& operator=(const vl_unordered_set& other) {
|
vl_unordered_set& operator=(const vl_unordered_set& other) {
|
||||||
|
|
|
||||||
|
|
@ -2008,7 +2008,7 @@ PLI_INT32 vpi_release_handle(vpiHandle object) {
|
||||||
_VL_VPI_ERROR_RESET();
|
_VL_VPI_ERROR_RESET();
|
||||||
if (VL_UNLIKELY(!vop)) return 0;
|
if (VL_UNLIKELY(!vop)) return 0;
|
||||||
vpi_remove_cb(object); // May not be a callback, but that's ok
|
vpi_remove_cb(object); // May not be a callback, but that's ok
|
||||||
delete vop;
|
VL_DO_DANGLING(delete vop, vop);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,11 +154,15 @@
|
||||||
#define VL_UL(c) (static_cast<IData>(c##UL)) ///< Add appropriate suffix to 32-bit constant
|
#define VL_UL(c) (static_cast<IData>(c##UL)) ///< Add appropriate suffix to 32-bit constant
|
||||||
|
|
||||||
#if defined(VL_CPPCHECK) || defined(__clang_analyzer__)
|
#if defined(VL_CPPCHECK) || defined(__clang_analyzer__)
|
||||||
# define VL_DANGLING(v)
|
# define VL_DANGLING(var)
|
||||||
#else
|
#else
|
||||||
# define VL_DANGLING(v) do { (v) = NULL; } while(0) ///< After e.g. delete, set variable to NULL to indicate must not use later
|
///< After e.g. delete, set variable to NULL to indicate must not use later
|
||||||
|
# define VL_DANGLING(var) do { (var) = NULL; } while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
///< Perform an e.g. delete, then set variable to NULL to indicate must not use later
|
||||||
|
#define VL_DO_DANGLING(stmt, var) do { do { stmt; } while(0); VL_DANGLING(var); } while(0)
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// C++-2011
|
// C++-2011
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ private:
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
// Simplify sensitivity list
|
// Simplify sensitivity list
|
||||||
V3Const::constifyExpensiveEdit(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(V3Const::constifyExpensiveEdit(nodep), nodep);
|
||||||
}
|
}
|
||||||
// Empty visitors, speed things up
|
// Empty visitors, speed things up
|
||||||
virtual void visit(AstNodeStmt* nodep) { }
|
virtual void visit(AstNodeStmt* nodep) { }
|
||||||
|
|
@ -181,7 +181,7 @@ private:
|
||||||
nodep->lhsp()->unlinkFrBack(),
|
nodep->lhsp()->unlinkFrBack(),
|
||||||
nodep->rhsp()->unlinkFrBack());
|
nodep->rhsp()->unlinkFrBack());
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssign* nodep) {
|
virtual void visit(AstAssign* nodep) {
|
||||||
|
|
@ -284,7 +284,7 @@ private:
|
||||||
// Relink to CFUNC for the final
|
// Relink to CFUNC for the final
|
||||||
UINFO(4," FINAL "<<nodep<<endl);
|
UINFO(4," FINAL "<<nodep<<endl);
|
||||||
if (!nodep->bodysp()) { // Empty, Kill it.
|
if (!nodep->bodysp()) { // Empty, Kill it.
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_INITIAL);
|
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_INITIAL);
|
||||||
|
|
@ -303,7 +303,7 @@ private:
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
m_scopeFinalp->addStmtsp(new AstComment(nodep->fileline(), nodep->typeName(), true));
|
m_scopeFinalp->addStmtsp(new AstComment(nodep->fileline(), nodep->typeName(), true));
|
||||||
m_scopeFinalp->addStmtsp(nodep->bodysp()->unlinkFrBackWithNext());
|
m_scopeFinalp->addStmtsp(nodep->bodysp()->unlinkFrBackWithNext());
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
@ -316,7 +316,7 @@ private:
|
||||||
// Never executing. Kill it.
|
// Never executing. Kill it.
|
||||||
UASSERT_OBJ(!oldsensesp->sensesp()->nextp(), nodep,
|
UASSERT_OBJ(!oldsensesp->sensesp()->nextp(), nodep,
|
||||||
"Never senitem should be alone, else the never should be eliminated.");
|
"Never senitem should be alone, else the never should be eliminated.");
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ private:
|
||||||
|
|
||||||
// Delete sensitivity list
|
// Delete sensitivity list
|
||||||
if (oldsensesp) {
|
if (oldsensesp) {
|
||||||
oldsensesp->unlinkFrBackWithNext()->deleteTree(); VL_DANGLING(oldsensesp);
|
VL_DO_DANGLING(oldsensesp->unlinkFrBackWithNext()->deleteTree(), oldsensesp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move node to new active
|
// Move node to new active
|
||||||
|
|
@ -379,7 +379,7 @@ private:
|
||||||
|
|
||||||
if (!nodep->bodysp()) {
|
if (!nodep->bodysp()) {
|
||||||
// Empty always. Kill it.
|
// Empty always. Kill it.
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
visitAlways(nodep, nodep->sensesp(), nodep->keyword());
|
visitAlways(nodep, nodep->sensesp(), nodep->keyword());
|
||||||
|
|
@ -403,7 +403,7 @@ private:
|
||||||
m_itemCombo = true;
|
m_itemCombo = true;
|
||||||
// Delete the sensitivity
|
// Delete the sensitivity
|
||||||
// We'll add it as a generic COMBO SenItem in a moment.
|
// We'll add it as a generic COMBO SenItem in a moment.
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else if (nodep->varrefp()) {
|
} else if (nodep->varrefp()) {
|
||||||
// V3LinkResolve should have cleaned most of these up
|
// V3LinkResolve should have cleaned most of these up
|
||||||
if (!nodep->varrefp()->width1()) {
|
if (!nodep->varrefp()->width1()) {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ private:
|
||||||
// Never executing. Kill it.
|
// Never executing. Kill it.
|
||||||
UASSERT_OBJ(!sensesp->sensesp()->nextp(), nodep,
|
UASSERT_OBJ(!sensesp->sensesp()->nextp(), nodep,
|
||||||
"Never senitem should be alone, else the never should be eliminated.");
|
"Never senitem should be alone, else the never should be eliminated.");
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Copy combo tree to settlement tree with duplicated statements
|
// Copy combo tree to settlement tree with duplicated statements
|
||||||
|
|
|
||||||
|
|
@ -164,13 +164,13 @@ private:
|
||||||
if (selfDestruct) {
|
if (selfDestruct) {
|
||||||
// Delete it after making the tree. This way we can tell the user
|
// Delete it after making the tree. This way we can tell the user
|
||||||
// if it wasn't constructed nicely or has other errors without needing --coverage.
|
// if it wasn't constructed nicely or has other errors without needing --coverage.
|
||||||
newp->deleteTree();
|
VL_DO_DANGLING(newp->deleteTree(), newp);
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
} else {
|
} else {
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
}
|
}
|
||||||
// Bye
|
// Bye
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
|
|
@ -352,7 +352,7 @@ private:
|
||||||
virtual void visit(AstRestrict* nodep) {
|
virtual void visit(AstRestrict* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
// IEEE says simulator ignores these
|
// IEEE says simulator ignores these
|
||||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
}
|
}
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
iterateAndNextNull(nodep->sensesp());
|
iterateAndNextNull(nodep->sensesp());
|
||||||
|
|
@ -130,7 +130,7 @@ private:
|
||||||
// Unlink and just keep a pointer to it, convert to sentree as needed
|
// Unlink and just keep a pointer to it, convert to sentree as needed
|
||||||
m_senip = nodep->sensesp();
|
m_senip = nodep->sensesp();
|
||||||
nodep->replaceWith(blockp);
|
nodep->replaceWith(blockp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
|
||||||
|
|
@ -865,10 +865,10 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) {
|
||||||
// track, then delete it on completion
|
// track, then delete it on completion
|
||||||
AstBegin* tempp = new AstBegin(nodep->fileline(), "[EditWrapper]", nodep);
|
AstBegin* tempp = new AstBegin(nodep->fileline(), "[EditWrapper]", nodep);
|
||||||
{
|
{
|
||||||
tempp->stmtsp()->accept(v); VL_DANGLING(nodep); // nodep to null as may be replaced
|
VL_DO_DANGLING(tempp->stmtsp()->accept(v), nodep); // nodep to null as may be replaced
|
||||||
}
|
}
|
||||||
nodep = tempp->stmtsp()->unlinkFrBackWithNext();
|
nodep = tempp->stmtsp()->unlinkFrBackWithNext();
|
||||||
tempp->deleteTree(); VL_DANGLING(tempp);
|
VL_DO_DANGLING(tempp->deleteTree(), tempp);
|
||||||
} else {
|
} else {
|
||||||
// Use back to determine who's pointing at us (IE assume new node
|
// Use back to determine who's pointing at us (IE assume new node
|
||||||
// grafts into same place as old one)
|
// grafts into same place as old one)
|
||||||
|
|
@ -880,7 +880,7 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) {
|
||||||
else if (this->m_backp->m_nextp == this) nextnodepp = &(this->m_backp->m_nextp);
|
else if (this->m_backp->m_nextp == this) nextnodepp = &(this->m_backp->m_nextp);
|
||||||
UASSERT_OBJ(nextnodepp, this, "Node's back doesn't point to forward to node itself");
|
UASSERT_OBJ(nextnodepp, this, "Node's back doesn't point to forward to node itself");
|
||||||
{
|
{
|
||||||
nodep->accept(v); VL_DANGLING(nodep); // nodep to null as may be replaced
|
VL_DO_DANGLING(nodep->accept(v), nodep); // nodep to null as may be replaced
|
||||||
}
|
}
|
||||||
nodep = *nextnodepp; // Grab new node from point where old was connected
|
nodep = *nextnodepp; // Grab new node from point where old was connected
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ AstExecGraph::AstExecGraph(FileLine* fileline)
|
||||||
m_depGraphp = new V3Graph;
|
m_depGraphp = new V3Graph;
|
||||||
}
|
}
|
||||||
AstExecGraph::~AstExecGraph() {
|
AstExecGraph::~AstExecGraph() {
|
||||||
delete m_depGraphp; VL_DANGLING(m_depGraphp);
|
VL_DO_DANGLING(delete m_depGraphp, m_depGraphp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AstVar::isSigPublic() const {
|
bool AstVar::isSigPublic() const {
|
||||||
|
|
@ -798,7 +798,7 @@ AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd)
|
||||||
// check the detailed map for this same node
|
// check the detailed map for this same node
|
||||||
// Also adds this new node to the detailed map
|
// Also adds this new node to the detailed map
|
||||||
AstBasicDType* newp = findInsertSameDType(new1p);
|
AstBasicDType* newp = findInsertSameDType(new1p);
|
||||||
if (newp != new1p) new1p->deleteTree();
|
if (newp != new1p) VL_DO_DANGLING(new1p->deleteTree(), new1p);
|
||||||
else addTypesp(newp);
|
else addTypesp(newp);
|
||||||
//
|
//
|
||||||
m_basicps[kwd] = newp;
|
m_basicps[kwd] = newp;
|
||||||
|
|
@ -809,7 +809,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kw
|
||||||
int width, int widthMin, AstNumeric numeric) {
|
int width, int widthMin, AstNumeric numeric) {
|
||||||
AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, width, widthMin);
|
AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, width, widthMin);
|
||||||
AstBasicDType* newp = findInsertSameDType(new1p);
|
AstBasicDType* newp = findInsertSameDType(new1p);
|
||||||
if (newp != new1p) new1p->deleteTree();
|
if (newp != new1p) VL_DO_DANGLING(new1p->deleteTree(), new1p);
|
||||||
else addTypesp(newp);
|
else addTypesp(newp);
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
|
|
@ -818,7 +818,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kw
|
||||||
VNumRange range, int widthMin, AstNumeric numeric) {
|
VNumRange range, int widthMin, AstNumeric numeric) {
|
||||||
AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, range, widthMin);
|
AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, range, widthMin);
|
||||||
AstBasicDType* newp = findInsertSameDType(new1p);
|
AstBasicDType* newp = findInsertSameDType(new1p);
|
||||||
if (newp != new1p) new1p->deleteTree();
|
if (newp != new1p) VL_DO_DANGLING(new1p->deleteTree(), new1p);
|
||||||
else addTypesp(newp);
|
else addTypesp(newp);
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
}
|
}
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep) {
|
virtual void visit(AstVar* nodep) {
|
||||||
if (m_unnamedScope != "") {
|
if (m_unnamedScope != "") {
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ private:
|
||||||
if (m_valueItem[a] != m_valueItem[b]) { same = false; break; }
|
if (m_valueItem[a] != m_valueItem[b]) { same = false; break; }
|
||||||
}
|
}
|
||||||
if (same) {
|
if (same) {
|
||||||
tree1p->deleteTree(); VL_DANGLING(tree1p);
|
VL_DO_DANGLING(tree1p->deleteTree(), tree1p);
|
||||||
return tree0p;
|
return tree0p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -299,8 +299,8 @@ private:
|
||||||
|
|
||||||
if (ifrootp) nodep->replaceWith(ifrootp);
|
if (ifrootp) nodep->replaceWith(ifrootp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
cexprp->deleteTree(); VL_DANGLING(cexprp);
|
VL_DO_DANGLING(cexprp->deleteTree(), cexprp);
|
||||||
if (debug()>=9) ifrootp->dumpTree(cout, " _simp: ");
|
if (debug()>=9) ifrootp->dumpTree(cout, " _simp: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,7 +331,7 @@ private:
|
||||||
AstConst* iconstp = VN_CAST(icondp, Const);
|
AstConst* iconstp = VN_CAST(icondp, Const);
|
||||||
if (iconstp && neverItem(nodep, iconstp)) {
|
if (iconstp && neverItem(nodep, iconstp)) {
|
||||||
// X in casez can't ever be executed
|
// 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
|
// For simplicity, make expression that is not equal, and let later
|
||||||
// optimizations remove it
|
// optimizations remove it
|
||||||
condp = new AstConst(itemp->fileline(), AstConst::LogicFalse());
|
condp = new AstConst(itemp->fileline(), AstConst::LogicFalse());
|
||||||
|
|
@ -357,7 +357,7 @@ private:
|
||||||
AstNode* and2p = new AstAnd(itemp->fileline(),
|
AstNode* and2p = new AstAnd(itemp->fileline(),
|
||||||
new AstConst(itemp->fileline(), numval),
|
new AstConst(itemp->fileline(), numval),
|
||||||
new AstConst(itemp->fileline(), nummask));
|
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);
|
condp = AstEq::newTyped(itemp->fileline(), and1p, and2p);
|
||||||
} else {
|
} else {
|
||||||
// Not a caseX mask, we can simply build CASEEQ(cexpr icond)
|
// Not a caseX mask, we can simply build CASEEQ(cexpr icond)
|
||||||
|
|
@ -375,7 +375,7 @@ private:
|
||||||
itemp->condsp(ifexprp);
|
itemp->condsp(ifexprp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cexprp->deleteTree(); VL_DANGLING(cexprp);
|
VL_DO_DANGLING(cexprp->deleteTree(), cexprp);
|
||||||
if (!hadDefault) {
|
if (!hadDefault) {
|
||||||
// If there was no default, add a empty one, this greatly simplifies below code
|
// If there was no default, add a empty one, this greatly simplifies below code
|
||||||
// and constant propagation will just eliminate it for us later.
|
// 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
|
{ // Make the new lower IF and attach in the tree
|
||||||
AstNode* itemexprp = ifexprp; VL_DANGLING(ifexprp);
|
AstNode* itemexprp = ifexprp; VL_DANGLING(ifexprp);
|
||||||
if (depth == (CASE_ENCODER_GROUP_DEPTH)) { // End of group - can skip the condition
|
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());
|
itemexprp = new AstConst(itemp->fileline(), AstConst::LogicTrue());
|
||||||
}
|
}
|
||||||
AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, NULL);
|
AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, NULL);
|
||||||
|
|
@ -434,7 +434,7 @@ private:
|
||||||
if (debug()>=9 && grouprootp) grouprootp->dumpTree(cout, " _new: ");
|
if (debug()>=9 && grouprootp) grouprootp->dumpTree(cout, " _new: ");
|
||||||
if (grouprootp) nodep->replaceWith(grouprootp);
|
if (grouprootp) nodep->replaceWith(grouprootp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceCaseParallel(AstCase* nodep, bool noOverlapsAllCovered) {
|
void replaceCaseParallel(AstCase* nodep, bool noOverlapsAllCovered) {
|
||||||
|
|
@ -468,10 +468,10 @@ private:
|
||||||
// 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
|
||||||
++m_statCaseFast;
|
++m_statCaseFast;
|
||||||
replaceCaseFast(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceCaseFast(nodep), nodep);
|
||||||
} else {
|
} else {
|
||||||
++m_statCaseSlow;
|
++m_statCaseSlow;
|
||||||
replaceCaseComplicated(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceCaseComplicated(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public:
|
||||||
new AstLogOr(m_scopetopp->fileline(), callp,
|
new AstLogOr(m_scopetopp->fileline(), callp,
|
||||||
returnp->lhsp()->unlinkFrBack()));
|
returnp->lhsp()->unlinkFrBack()));
|
||||||
returnp->replaceWith(newp);
|
returnp->replaceWith(newp);
|
||||||
returnp->deleteTree(); VL_DANGLING(returnp);
|
VL_DO_DANGLING(returnp->deleteTree(), returnp);
|
||||||
}
|
}
|
||||||
m_numStmts = 0;
|
m_numStmts = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ private:
|
||||||
stmtsp->unlinkFrBackWithNext();
|
stmtsp->unlinkFrBackWithNext();
|
||||||
cmtp->addNextHere(stmtsp);
|
cmtp->addNextHere(stmtsp);
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPost* nodep) {
|
virtual void visit(AstAlwaysPost* nodep) {
|
||||||
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
|
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
|
||||||
|
|
@ -287,7 +287,7 @@ private:
|
||||||
stmtsp->unlinkFrBackWithNext();
|
stmtsp->unlinkFrBackWithNext();
|
||||||
cmtp->addNextHere(stmtsp);
|
cmtp->addNextHere(stmtsp);
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
//nodep->dumpTree(cout, "ct:");
|
//nodep->dumpTree(cout, "ct:");
|
||||||
|
|
@ -307,7 +307,7 @@ private:
|
||||||
newp->addIfsp(new AstAssign(nodep->fileline(),
|
newp->addIfsp(new AstAssign(nodep->fileline(),
|
||||||
changep->cloneTree(false),
|
changep->cloneTree(false),
|
||||||
origp->cloneTree(false)));
|
origp->cloneTree(false)));
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
|
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName(), true);
|
||||||
|
|
@ -316,7 +316,7 @@ private:
|
||||||
stmtsp->unlinkFrBackWithNext();
|
stmtsp->unlinkFrBackWithNext();
|
||||||
cmtp->addNextHere(stmtsp);
|
cmtp->addNextHere(stmtsp);
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -349,7 +349,7 @@ private:
|
||||||
// Not at the top or empty block...
|
// Not at the top or empty block...
|
||||||
// Only empty blocks should be leftover on the non-top. Killem.
|
// Only empty blocks should be leftover on the non-top. Killem.
|
||||||
UASSERT_OBJ(!nodep->stmtsp(), nodep, "Non-empty lower active");
|
UASSERT_OBJ(!nodep->stmtsp(), nodep, "Non-empty lower active");
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else if (m_mtaskBodyp) {
|
} else if (m_mtaskBodyp) {
|
||||||
UINFO(4," TR ACTIVE "<<nodep<<endl);
|
UINFO(4," TR ACTIVE "<<nodep<<endl);
|
||||||
AstNode* stmtsp = nodep->stmtsp()->unlinkFrBackWithNext();
|
AstNode* stmtsp = nodep->stmtsp()->unlinkFrBackWithNext();
|
||||||
|
|
@ -374,7 +374,7 @@ private:
|
||||||
clearLastSen();
|
clearLastSen();
|
||||||
m_mtaskBodyp->addStmtsp(stmtsp);
|
m_mtaskBodyp->addStmtsp(stmtsp);
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
UINFO(4," ACTIVE "<<nodep<<endl);
|
UINFO(4," ACTIVE "<<nodep<<endl);
|
||||||
AstNode* stmtsp = nodep->stmtsp()->unlinkFrBackWithNext();
|
AstNode* stmtsp = nodep->stmtsp()->unlinkFrBackWithNext();
|
||||||
|
|
@ -407,7 +407,7 @@ private:
|
||||||
// Move statements to function
|
// Move statements to function
|
||||||
addToEvalLoop(stmtsp);
|
addToEvalLoop(stmtsp);
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstExecGraph* nodep) {
|
virtual void visit(AstExecGraph* nodep) {
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public:
|
||||||
callp->unlinkFrBack();
|
callp->unlinkFrBack();
|
||||||
}
|
}
|
||||||
callp->user3(true); // Dead now
|
callp->user3(true); // Dead now
|
||||||
pushDeletep(callp); VL_DANGLING(callp);
|
VL_DO_DANGLING(pushDeletep(callp), callp);
|
||||||
m_callMmap.erase(eqit); // Fix the table
|
m_callMmap.erase(eqit); // Fix the table
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +228,7 @@ private:
|
||||||
CombMarkVisitor visitor(oldfuncp);
|
CombMarkVisitor visitor(oldfuncp);
|
||||||
m_call.replaceFunc(oldfuncp, NULL);
|
m_call.replaceFunc(oldfuncp, NULL);
|
||||||
oldfuncp->unlinkFrBack();
|
oldfuncp->unlinkFrBack();
|
||||||
pushDeletep(oldfuncp); VL_DANGLING(oldfuncp);
|
VL_DO_DANGLING(pushDeletep(oldfuncp), oldfuncp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ private:
|
||||||
CombMarkVisitor visitor(oldfuncp);
|
CombMarkVisitor visitor(oldfuncp);
|
||||||
m_call.replaceFunc(oldfuncp, newfuncp);
|
m_call.replaceFunc(oldfuncp, newfuncp);
|
||||||
oldfuncp->unlinkFrBack();
|
oldfuncp->unlinkFrBack();
|
||||||
pushDeletep(oldfuncp); VL_DANGLING(oldfuncp);
|
VL_DO_DANGLING(pushDeletep(oldfuncp), oldfuncp);
|
||||||
}
|
}
|
||||||
void replaceOnlyCallFunc(AstCCall* nodep) {
|
void replaceOnlyCallFunc(AstCCall* nodep) {
|
||||||
if (AstCFunc* oldfuncp = VN_CAST(nodep->backp(), CFunc)) {
|
if (AstCFunc* oldfuncp = VN_CAST(nodep->backp(), CFunc)) {
|
||||||
|
|
@ -272,7 +272,7 @@ private:
|
||||||
UINFO(9," Function only has call "<<oldfuncp<<endl);
|
UINFO(9," Function only has call "<<oldfuncp<<endl);
|
||||||
m_call.deleteCall(nodep);
|
m_call.deleteCall(nodep);
|
||||||
CombMarkVisitor visitor(oldfuncp);
|
CombMarkVisitor visitor(oldfuncp);
|
||||||
replaceFuncWFunc(oldfuncp, nodep->funcp()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceFuncWFunc(oldfuncp, nodep->funcp()), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,8 +384,8 @@ private:
|
||||||
m_call.addCall(call2p);
|
m_call.addCall(call2p);
|
||||||
// If either new statement makes a func with only a single call, replace
|
// If either new statement makes a func with only a single call, replace
|
||||||
// the above callers to call it directly
|
// the above callers to call it directly
|
||||||
replaceOnlyCallFunc(call1p); VL_DANGLING(call1p);
|
VL_DO_DANGLING(replaceOnlyCallFunc(call1p), call1p);
|
||||||
replaceOnlyCallFunc(call2p); VL_DANGLING(call2p);
|
VL_DO_DANGLING(replaceOnlyCallFunc(call2p), call2p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
|
|
|
||||||
189
src/V3Const.cpp
189
src/V3Const.cpp
|
|
@ -212,7 +212,7 @@ private:
|
||||||
if (!operandsSame(ap, bp)) return false;
|
if (!operandsSame(ap, bp)) return false;
|
||||||
// Do it
|
// Do it
|
||||||
cp->unlinkFrBack();
|
cp->unlinkFrBack();
|
||||||
andp->unlinkFrBack()->deleteTree(); VL_DANGLING(andp); VL_DANGLING(notp);
|
VL_DO_DANGLING(andp->unlinkFrBack()->deleteTree(), andp); VL_DANGLING(notp);
|
||||||
// Replace whichever branch is now dangling
|
// Replace whichever branch is now dangling
|
||||||
if (nodep->rhsp()) nodep->lhsp(cp);
|
if (nodep->rhsp()) nodep->lhsp(cp);
|
||||||
else nodep->rhsp(cp);
|
else nodep->rhsp(cp);
|
||||||
|
|
@ -240,7 +240,7 @@ private:
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
newp->expr1p()->dtypeFrom(nodep); // As And might have been to change widths
|
newp->expr1p()->dtypeFrom(nodep); // As And might have been to change widths
|
||||||
newp->expr2p()->dtypeFrom(nodep);
|
newp->expr2p()->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static bool operandShiftSame(const AstNode* nodep) {
|
static bool operandShiftSame(const AstNode* nodep) {
|
||||||
|
|
@ -343,7 +343,7 @@ private:
|
||||||
&& nodep->lsbConst()==0
|
&& nodep->lsbConst()==0
|
||||||
&& static_cast<int>(nodep->widthConst()) == extendp->lhsp()->width()
|
&& static_cast<int>(nodep->widthConst()) == extendp->lhsp()->width()
|
||||||
)) return false;
|
)) return false;
|
||||||
replaceWChild(nodep, extendp->lhsp()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWChild(nodep, extendp->lhsp()), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operandSelBiLower(AstSel* nodep) {
|
bool operandSelBiLower(AstSel* nodep) {
|
||||||
|
|
@ -362,7 +362,7 @@ private:
|
||||||
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(cout, "SEL(BI)-ou:");
|
||||||
replaceWChild(nodep, bip); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWChild(nodep, bip), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operandSelShiftLower(AstSel* nodep) {
|
bool operandSelShiftLower(AstSel* nodep) {
|
||||||
|
|
@ -390,7 +390,7 @@ private:
|
||||||
newLsb, nodep->widthConst());
|
newLsb, nodep->widthConst());
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
if (debug()>=9) newp->dumpTree(cout, "SEL(SH)-ou:");
|
if (debug()>=9) newp->dumpTree(cout, "SEL(SH)-ou:");
|
||||||
nodep->replaceWith(newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->replaceWith(newp), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,14 +409,14 @@ private:
|
||||||
//
|
//
|
||||||
if (debug()>=9) nodep->dumpTree(cout, "BI(EXTEND)-in:");
|
if (debug()>=9) nodep->dumpTree(cout, "BI(EXTEND)-in:");
|
||||||
smallerp->unlinkFrBack();
|
smallerp->unlinkFrBack();
|
||||||
extendp->unlinkFrBack()->deleteTree(); // aka nodep->lhsp.
|
VL_DO_DANGLING(extendp->unlinkFrBack()->deleteTree(), extendp); // aka nodep->lhsp.
|
||||||
nodep->rhsp(smallerp);
|
nodep->rhsp(smallerp);
|
||||||
|
|
||||||
constp->unlinkFrBack();
|
constp->unlinkFrBack();
|
||||||
V3Number num (constp, subsize);
|
V3Number num (constp, subsize);
|
||||||
num.opAssign(constp->num());
|
num.opAssign(constp->num());
|
||||||
nodep->lhsp(new AstConst(constp->fileline(), num));
|
nodep->lhsp(new AstConst(constp->fileline(), num));
|
||||||
constp->deleteTree(); VL_DANGLING(constp);
|
VL_DO_DANGLING(constp->deleteTree(), constp);
|
||||||
if (debug()>=9) nodep->dumpTree(cout, "BI(EXTEND)-ou:");
|
if (debug()>=9) nodep->dumpTree(cout, "BI(EXTEND)-ou:");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -622,11 +622,11 @@ private:
|
||||||
if (debug()>5) oldp->dumpTree(cout, " const_old: ");
|
if (debug()>5) oldp->dumpTree(cout, " const_old: ");
|
||||||
if (debug()>5) newp->dumpTree(cout, " _new: ");
|
if (debug()>5) newp->dumpTree(cout, " _new: ");
|
||||||
oldp->replaceWith(newp);
|
oldp->replaceWith(newp);
|
||||||
oldp->deleteTree(); VL_DANGLING(oldp);
|
VL_DO_DANGLING(oldp->deleteTree(), oldp);
|
||||||
}
|
}
|
||||||
void replaceNum(AstNode* nodep, uint32_t val) {
|
void replaceNum(AstNode* nodep, uint32_t val) {
|
||||||
V3Number num (nodep, nodep->width(), val);
|
V3Number num (nodep, nodep->width(), val);
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
}
|
}
|
||||||
void replaceNumSigned(AstNodeBiop* nodep, uint32_t val) {
|
void replaceNumSigned(AstNodeBiop* nodep, uint32_t val) {
|
||||||
// We allow both sides to be constant, as one may have come from
|
// We allow both sides to be constant, as one may have come from
|
||||||
|
|
@ -634,48 +634,48 @@ private:
|
||||||
if (m_warn && !(VN_IS(nodep->lhsp(), Const) && VN_IS(nodep->rhsp(), Const))) {
|
if (m_warn && !(VN_IS(nodep->lhsp(), Const) && VN_IS(nodep->rhsp(), Const))) {
|
||||||
nodep->v3warn(UNSIGNED, "Comparison is constant due to unsigned arithmetic");
|
nodep->v3warn(UNSIGNED, "Comparison is constant due to unsigned arithmetic");
|
||||||
}
|
}
|
||||||
replaceNum(nodep, val); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, val), nodep);
|
||||||
}
|
}
|
||||||
void replaceNumLimited(AstNodeBiop* nodep, uint32_t val) {
|
void replaceNumLimited(AstNodeBiop* nodep, uint32_t val) {
|
||||||
// Avoids gcc warning about same
|
// Avoids gcc warning about same
|
||||||
if (m_warn) nodep->v3warn(CMPCONST, "Comparison is constant due to limited range");
|
if (m_warn) nodep->v3warn(CMPCONST, "Comparison is constant due to limited range");
|
||||||
replaceNum(nodep, val); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, val), nodep);
|
||||||
}
|
}
|
||||||
void replaceZero(AstNode* nodep) {
|
void replaceZero(AstNode* nodep) {
|
||||||
replaceNum(nodep, 0); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, 0), nodep);
|
||||||
}
|
}
|
||||||
void replaceZeroChkPure(AstNode* nodep, AstNode* checkp) {
|
void replaceZeroChkPure(AstNode* nodep, AstNode* checkp) {
|
||||||
// For example, "0 * n" -> 0 if n has no side effects
|
// For example, "0 * n" -> 0 if n has no side effects
|
||||||
// Else strength reduce it to 0 & n.
|
// Else strength reduce it to 0 & n.
|
||||||
// If ever change the operation note AstAnd rule specially ignores this created pattern
|
// If ever change the operation note AstAnd rule specially ignores this created pattern
|
||||||
if (isTPure(checkp)) {
|
if (isTPure(checkp)) {
|
||||||
replaceNum(nodep, 0); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, 0), nodep);
|
||||||
} else {
|
} else {
|
||||||
AstNode* newp = new AstAnd(nodep->fileline(),
|
AstNode* newp = new AstAnd(nodep->fileline(),
|
||||||
new AstConst(nodep->fileline(), 0),
|
new AstConst(nodep->fileline(), 0),
|
||||||
checkp->unlinkFrBack());
|
checkp->unlinkFrBack());
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void replaceAllOnes(AstNode* nodep) {
|
void replaceAllOnes(AstNode* nodep) {
|
||||||
V3Number ones (nodep, nodep->width(), 0);
|
V3Number ones (nodep, nodep->width(), 0);
|
||||||
ones.setMask(nodep->width());
|
ones.setMask(nodep->width());
|
||||||
replaceNum(nodep, ones); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, ones), nodep);
|
||||||
}
|
}
|
||||||
void replaceConst(AstNodeUniop* nodep) {
|
void replaceConst(AstNodeUniop* nodep) {
|
||||||
V3Number num (nodep, nodep->width());
|
V3Number num (nodep, nodep->width());
|
||||||
nodep->numberOperate(num, VN_CAST(nodep->lhsp(), Const)->num());
|
nodep->numberOperate(num, VN_CAST(nodep->lhsp(), Const)->num());
|
||||||
UINFO(4,"UNICONST -> "<<num<<endl);
|
UINFO(4,"UNICONST -> "<<num<<endl);
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
}
|
}
|
||||||
void replaceConst(AstNodeBiop* nodep) {
|
void replaceConst(AstNodeBiop* nodep) {
|
||||||
V3Number num (nodep, nodep->width());
|
V3Number num (nodep, nodep->width());
|
||||||
nodep->numberOperate(num, VN_CAST(nodep->lhsp(), Const)->num(),
|
nodep->numberOperate(num, VN_CAST(nodep->lhsp(), Const)->num(),
|
||||||
VN_CAST(nodep->rhsp(), Const)->num());
|
VN_CAST(nodep->rhsp(), Const)->num());
|
||||||
UINFO(4,"BICONST -> "<<num<<endl);
|
UINFO(4,"BICONST -> "<<num<<endl);
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
}
|
}
|
||||||
void replaceConst(AstNodeTriop* nodep) {
|
void replaceConst(AstNodeTriop* nodep) {
|
||||||
V3Number num (nodep, nodep->width());
|
V3Number num (nodep, nodep->width());
|
||||||
|
|
@ -683,7 +683,7 @@ private:
|
||||||
VN_CAST(nodep->rhsp(), Const)->num(),
|
VN_CAST(nodep->rhsp(), Const)->num(),
|
||||||
VN_CAST(nodep->thsp(), Const)->num());
|
VN_CAST(nodep->thsp(), Const)->num());
|
||||||
UINFO(4,"TRICONST -> "<<num<<endl);
|
UINFO(4,"TRICONST -> "<<num<<endl);
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceConstString(AstNode* oldp, const string& num) {
|
void replaceConstString(AstNode* oldp, const string& num) {
|
||||||
|
|
@ -693,7 +693,7 @@ private:
|
||||||
if (debug()>5) oldp->dumpTree(cout, " const_old: ");
|
if (debug()>5) oldp->dumpTree(cout, " const_old: ");
|
||||||
if (debug()>5) newp->dumpTree(cout, " _new: ");
|
if (debug()>5) newp->dumpTree(cout, " _new: ");
|
||||||
oldp->replaceWith(newp);
|
oldp->replaceWith(newp);
|
||||||
oldp->deleteTree(); VL_DANGLING(oldp);
|
VL_DO_DANGLING(oldp->deleteTree(), oldp);
|
||||||
}
|
}
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
// Replacement functions.
|
// Replacement functions.
|
||||||
|
|
@ -706,7 +706,7 @@ private:
|
||||||
// This may adversely affect the operation of the node being replaced.
|
// This may adversely affect the operation of the node being replaced.
|
||||||
childp->dtypeFrom(nodep);
|
childp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(childp);
|
nodep->replaceWith(childp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Replace a ternary node with its RHS after iterating
|
//! Replace a ternary node with its RHS after iterating
|
||||||
|
|
@ -794,15 +794,15 @@ private:
|
||||||
lp->rhsp(nodep);
|
lp->rhsp(nodep);
|
||||||
nodep->lhsp(lrp);
|
nodep->lhsp(lrp);
|
||||||
nodep->rhsp(rrp);
|
nodep->rhsp(rrp);
|
||||||
rp->deleteTree();
|
VL_DO_DANGLING(rp->deleteTree(), rp);
|
||||||
rlp->deleteTree();
|
VL_DO_DANGLING(rlp->deleteTree(), rlp);
|
||||||
} else if (operandsSame(lrp, rrp)) {
|
} else if (operandsSame(lrp, rrp)) {
|
||||||
lp->lhsp(nodep);
|
lp->lhsp(nodep);
|
||||||
lp->rhsp(rrp);
|
lp->rhsp(rrp);
|
||||||
nodep->lhsp(llp);
|
nodep->lhsp(llp);
|
||||||
nodep->rhsp(rlp);
|
nodep->rhsp(rlp);
|
||||||
rp->deleteTree();
|
VL_DO_DANGLING(rp->deleteTree(), rp);
|
||||||
lrp->deleteTree();
|
VL_DO_DANGLING(lrp->deleteTree(), lrp);
|
||||||
} else {
|
} else {
|
||||||
nodep->v3fatalSrc("replaceAndOr on something operandAndOrSame shouldn't have matched");
|
nodep->v3fatalSrc("replaceAndOr on something operandAndOrSame shouldn't have matched");
|
||||||
}
|
}
|
||||||
|
|
@ -822,8 +822,8 @@ private:
|
||||||
lp->rhsp(lrp);
|
lp->rhsp(lrp);
|
||||||
nodep->lhsp(llp);
|
nodep->lhsp(llp);
|
||||||
nodep->rhsp(rlp);
|
nodep->rhsp(rlp);
|
||||||
rp->deleteTree();
|
VL_DO_DANGLING(rp->deleteTree(), rp);
|
||||||
rrp->deleteTree();
|
VL_DO_DANGLING(rrp->deleteTree(), rrp);
|
||||||
//nodep->dumpTree(cout, " repShiftSame_new: ");
|
//nodep->dumpTree(cout, " repShiftSame_new: ");
|
||||||
}
|
}
|
||||||
void replaceConcatSel(AstConcat* nodep) {
|
void replaceConcatSel(AstConcat* nodep) {
|
||||||
|
|
@ -842,9 +842,9 @@ private:
|
||||||
UINFO(5, "merged two adjacent sel "<<lselp <<" and "<<rselp<< " to one "<<newselp<<endl);
|
UINFO(5, "merged two adjacent sel "<<lselp <<" and "<<rselp<< " to one "<<newselp<<endl);
|
||||||
|
|
||||||
nodep->replaceWith(newselp);
|
nodep->replaceWith(newselp);
|
||||||
lselp->deleteTree(); VL_DANGLING(lselp);
|
VL_DO_DANGLING(lselp->deleteTree(), lselp);
|
||||||
rselp->deleteTree(); VL_DANGLING(rselp);
|
VL_DO_DANGLING(rselp->deleteTree(), rselp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replaceConcatMerge(AstConcat* nodep) {
|
void replaceConcatMerge(AstConcat* nodep) {
|
||||||
AstNodeBiop* lp = VN_CAST(nodep->lhsp(), NodeBiop);
|
AstNodeBiop* lp = VN_CAST(nodep->lhsp(), NodeBiop);
|
||||||
|
|
@ -861,8 +861,8 @@ private:
|
||||||
lp->rhsp()->replaceWith(newrp);
|
lp->rhsp()->replaceWith(newrp);
|
||||||
lp->dtypeChgWidthSigned(newlp->width(), newlp->width(), AstNumeric::UNSIGNED);
|
lp->dtypeChgWidthSigned(newlp->width(), newlp->width(), AstNumeric::UNSIGNED);
|
||||||
UINFO(5, "merged "<< nodep <<endl);
|
UINFO(5, "merged "<< nodep <<endl);
|
||||||
rp->unlinkFrBack()->deleteTree(); VL_DANGLING(rp);
|
VL_DO_DANGLING(rp->unlinkFrBack()->deleteTree(), rp);
|
||||||
nodep->replaceWith(lp->unlinkFrBack()); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(lp->unlinkFrBack()); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
iterate(lp->lhsp());
|
iterate(lp->lhsp());
|
||||||
iterate(lp->rhsp());
|
iterate(lp->rhsp());
|
||||||
} else nodep->v3fatalSrc("tried to merge two Concat which are not adjacent");
|
} else nodep->v3fatalSrc("tried to merge two Concat which are not adjacent");
|
||||||
|
|
@ -875,7 +875,7 @@ private:
|
||||||
? static_cast<AstNode*>(new AstExtendS(nodep->fileline(), arg0p))
|
? static_cast<AstNode*>(new AstExtendS(nodep->fileline(), arg0p))
|
||||||
: static_cast<AstNode*>(new AstExtend (nodep->fileline(), arg0p)));
|
: static_cast<AstNode*>(new AstExtend (nodep->fileline(), arg0p)));
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replacePowShift(AstNodeBiop* nodep) { // Pow or PowS
|
void replacePowShift(AstNodeBiop* nodep) { // Pow or PowS
|
||||||
UINFO(5,"POW(2,b)->SHIFTL(1,b) "<<nodep<<endl);
|
UINFO(5,"POW(2,b)->SHIFTL(1,b) "<<nodep<<endl);
|
||||||
|
|
@ -885,7 +885,7 @@ private:
|
||||||
rhsp);
|
rhsp);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
newp->lhsp()->dtypeFrom(nodep);
|
newp->lhsp()->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replaceMulShift(AstMul* nodep) { // Mul, but not MulS as not simple shift
|
void replaceMulShift(AstMul* nodep) { // Mul, but not MulS as not simple shift
|
||||||
UINFO(5,"MUL(2^n,b)->SHIFTL(b,n) "<<nodep<<endl);
|
UINFO(5,"MUL(2^n,b)->SHIFTL(b,n) "<<nodep<<endl);
|
||||||
|
|
@ -894,7 +894,7 @@ private:
|
||||||
AstShiftL* newp = new AstShiftL(nodep->fileline(),
|
AstShiftL* newp = new AstShiftL(nodep->fileline(),
|
||||||
opp, new AstConst(nodep->fileline(), amount));
|
opp, new AstConst(nodep->fileline(), amount));
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replaceDivShift(AstDiv* nodep) { // Mul, but not MulS as not simple shift
|
void replaceDivShift(AstDiv* nodep) { // Mul, but not MulS as not simple shift
|
||||||
UINFO(5,"DIV(b,2^n)->SHIFTR(b,n) "<<nodep<<endl);
|
UINFO(5,"DIV(b,2^n)->SHIFTR(b,n) "<<nodep<<endl);
|
||||||
|
|
@ -903,7 +903,7 @@ private:
|
||||||
AstShiftR* newp = new AstShiftR(nodep->fileline(),
|
AstShiftR* newp = new AstShiftR(nodep->fileline(),
|
||||||
opp, new AstConst(nodep->fileline(), amount));
|
opp, new AstConst(nodep->fileline(), amount));
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replaceModAnd(AstModDiv* nodep) { // Mod, but not ModS as not simple shift
|
void replaceModAnd(AstModDiv* nodep) { // Mod, but not ModS as not simple shift
|
||||||
UINFO(5,"MOD(b,2^n)->AND(b,2^n-1) "<<nodep<<endl);
|
UINFO(5,"MOD(b,2^n)->AND(b,2^n-1) "<<nodep<<endl);
|
||||||
|
|
@ -914,7 +914,7 @@ private:
|
||||||
AstAnd* newp = new AstAnd(nodep->fileline(),
|
AstAnd* newp = new AstAnd(nodep->fileline(),
|
||||||
opp, new AstConst(nodep->fileline(), mask));
|
opp, new AstConst(nodep->fileline(), mask));
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replaceShiftOp(AstNodeBiop* nodep) {
|
void replaceShiftOp(AstNodeBiop* nodep) {
|
||||||
UINFO(5,"SHIFT(AND(a,b),CONST)->AND(SHIFT(a,CONST),SHIFT(b,CONST)) "<<nodep<<endl);
|
UINFO(5,"SHIFT(AND(a,b),CONST)->AND(SHIFT(a,CONST),SHIFT(b,CONST)) "<<nodep<<endl);
|
||||||
|
|
@ -946,8 +946,8 @@ private:
|
||||||
int shift1 = VN_CAST(shift1p, Const)->toUInt();
|
int shift1 = VN_CAST(shift1p, Const)->toUInt();
|
||||||
int shift2 = VN_CAST(shift2p, Const)->toUInt();
|
int shift2 = VN_CAST(shift2p, Const)->toUInt();
|
||||||
int newshift = shift1+shift2;
|
int newshift = shift1+shift2;
|
||||||
shift1p->deleteTree(); VL_DANGLING(shift1p);
|
VL_DO_DANGLING(shift1p->deleteTree(), shift1p);
|
||||||
shift2p->deleteTree(); VL_DANGLING(shift2p);
|
VL_DO_DANGLING(shift2p->deleteTree(), shift2p);
|
||||||
nodep->lhsp(ap);
|
nodep->lhsp(ap);
|
||||||
nodep->rhsp(new AstConst(nodep->fileline(), newshift));
|
nodep->rhsp(new AstConst(nodep->fileline(), newshift));
|
||||||
iterate(nodep); // Further reduce, either node may have more reductions.
|
iterate(nodep); // Further reduce, either node may have more reductions.
|
||||||
|
|
@ -958,8 +958,8 @@ private:
|
||||||
int shift2 = VN_CAST(shift2p, Const)->toUInt();
|
int shift2 = VN_CAST(shift2p, Const)->toUInt();
|
||||||
if (VN_IS(nodep, ShiftR)) shift2=-shift2;
|
if (VN_IS(nodep, ShiftR)) shift2=-shift2;
|
||||||
int newshift = shift1+shift2;
|
int newshift = shift1+shift2;
|
||||||
shift1p->deleteTree(); VL_DANGLING(shift1p);
|
VL_DO_DANGLING(shift1p->deleteTree(), shift1p);
|
||||||
shift2p->deleteTree(); VL_DANGLING(shift2p);
|
VL_DO_DANGLING(shift2p->deleteTree(), shift2p);
|
||||||
AstNode* newp;
|
AstNode* newp;
|
||||||
V3Number mask1 (nodep, nodep->width());
|
V3Number mask1 (nodep, nodep->width());
|
||||||
V3Number ones (nodep, nodep->width());
|
V3Number ones (nodep, nodep->width());
|
||||||
|
|
@ -987,11 +987,11 @@ private:
|
||||||
newp,
|
newp,
|
||||||
new AstConst(nodep->fileline(), mask));
|
new AstConst(nodep->fileline(), mask));
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
//newp->dumpTree(cout, " repShiftShift_new: ");
|
//newp->dumpTree(cout, " repShiftShift_new: ");
|
||||||
iterate(newp); // Further reduce, either node may have more reductions.
|
iterate(newp); // Further reduce, either node may have more reductions.
|
||||||
}
|
}
|
||||||
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
VL_DO_DANGLING(lhsp->deleteTree(), lhsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool replaceAssignMultiSel(AstNodeAssign* nodep) {
|
bool replaceAssignMultiSel(AstNodeAssign* nodep) {
|
||||||
|
|
@ -1033,8 +1033,9 @@ private:
|
||||||
new AstConcat(rhs1p->fileline(), rhs1p, rhs2p));
|
new AstConcat(rhs1p->fileline(), rhs1p, rhs2p));
|
||||||
}
|
}
|
||||||
//pnewp->dumpTree(cout, "conew: ");
|
//pnewp->dumpTree(cout, "conew: ");
|
||||||
nodep->replaceWith(newp); nodep->deleteTree();
|
nodep->replaceWith(newp);
|
||||||
nextp->unlinkFrBack()->deleteTree();
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
|
VL_DO_DANGLING(nextp->unlinkFrBack()->deleteTree(), nextp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1062,7 +1063,7 @@ private:
|
||||||
nodep->v3error("Wire inputs its own output, creating circular logic (wire x=x)");
|
nodep->v3error("Wire inputs its own output, creating circular logic (wire x=x)");
|
||||||
return false; // Don't delete the assign, or V3Gate will freak out
|
return false; // Don't delete the assign, or V3Gate will freak out
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1156,8 +1157,8 @@ private:
|
||||||
if (debug()>=9 && newp) newp->dumpTreeAndNext(cout, " _new: ");
|
if (debug()>=9 && newp) newp->dumpTreeAndNext(cout, " _new: ");
|
||||||
nodep->addNextHere(newp);
|
nodep->addNextHere(newp);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
conp->deleteTree(); VL_DANGLING(conp);
|
VL_DO_DANGLING(conp->deleteTree(), conp);
|
||||||
// Further reduce, either node may have more reductions.
|
// Further reduce, either node may have more reductions.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1170,8 +1171,8 @@ private:
|
||||||
AstNode* streamp = VN_CAST(nodep->rhsp(), StreamR)->unlinkFrBack();
|
AstNode* streamp = VN_CAST(nodep->rhsp(), StreamR)->unlinkFrBack();
|
||||||
nodep->rhsp(srcp);
|
nodep->rhsp(srcp);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
sizep->deleteTree(); VL_DANGLING(sizep);
|
VL_DO_DANGLING(sizep->deleteTree(), sizep);
|
||||||
streamp->deleteTree(); VL_DANGLING(streamp);
|
VL_DO_DANGLING(streamp->deleteTree(), streamp);
|
||||||
// Further reduce, any of the nodes may have more reductions.
|
// Further reduce, any of the nodes may have more reductions.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1213,8 +1214,8 @@ private:
|
||||||
nodep->lhsp(dstp);
|
nodep->lhsp(dstp);
|
||||||
nodep->rhsp(srcp);
|
nodep->rhsp(srcp);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
sizep->deleteTree(); VL_DANGLING(sizep);
|
VL_DO_DANGLING(sizep->deleteTree(), sizep);
|
||||||
streamp->deleteTree(); VL_DANGLING(streamp);
|
VL_DO_DANGLING(streamp->deleteTree(), streamp);
|
||||||
// Further reduce, any of the nodes may have more reductions.
|
// Further reduce, any of the nodes may have more reductions.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1250,7 +1251,7 @@ private:
|
||||||
// widthMin no longer applicable if different C-expanded width
|
// widthMin no longer applicable if different C-expanded width
|
||||||
newp->dtypeSetLogicSized(nodep->width(), AstNumeric::UNSIGNED);
|
newp->dtypeSetLogicSized(nodep->width(), AstNumeric::UNSIGNED);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
if (debug()>=9) newp->dumpTree(cout, " _new: ");
|
if (debug()>=9) newp->dumpTree(cout, " _new: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1264,7 +1265,7 @@ private:
|
||||||
<<nodep->prettyTypeName()<<endl
|
<<nodep->prettyTypeName()<<endl
|
||||||
<<errorp->warnOther()<<"... Location of non-constant "
|
<<errorp->warnOther()<<"... Location of non-constant "
|
||||||
<<errorp->prettyTypeName()<<": "<<simvis.whyNotMessage());
|
<<errorp->prettyTypeName()<<": "<<simvis.whyNotMessage());
|
||||||
replaceZero(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceZero(nodep), nodep);
|
||||||
} else {
|
} else {
|
||||||
// Fetch the result
|
// Fetch the result
|
||||||
AstNode* valuep = simvis.fetchValueNull(nodep); // valuep is owned by Simulate
|
AstNode* valuep = simvis.fetchValueNull(nodep); // valuep is owned by Simulate
|
||||||
|
|
@ -1274,7 +1275,7 @@ private:
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
newp->fileline(nodep->fileline());
|
newp->fileline(nodep->fileline());
|
||||||
UINFO(4, "Simulate->"<<newp<<endl);
|
UINFO(4, "Simulate->"<<newp<<endl);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1354,7 +1355,7 @@ private:
|
||||||
// If bp was a concat, then we have this exact same form again!
|
// If bp was a concat, then we have this exact same form again!
|
||||||
// Recurse rather then calling node->iterate to prevent 2^n recursion!
|
// Recurse rather then calling node->iterate to prevent 2^n recursion!
|
||||||
if (operandConcatMove(abConcp)) moveConcat(abConcp);
|
if (operandConcatMove(abConcp)) moveConcat(abConcp);
|
||||||
bcConcp->deleteTree(); VL_DANGLING(bcConcp);
|
VL_DO_DANGLING(bcConcp->deleteTree(), bcConcp);
|
||||||
} else {
|
} else {
|
||||||
AstConcat* abConcp = VN_CAST(nodep->lhsp(), Concat); abConcp->unlinkFrBack();
|
AstConcat* abConcp = VN_CAST(nodep->lhsp(), Concat); abConcp->unlinkFrBack();
|
||||||
AstNode* ap = abConcp->lhsp()->unlinkFrBack();
|
AstNode* ap = abConcp->lhsp()->unlinkFrBack();
|
||||||
|
|
@ -1365,7 +1366,7 @@ private:
|
||||||
nodep->lhsp(ap);
|
nodep->lhsp(ap);
|
||||||
nodep->rhsp(bcConcp);
|
nodep->rhsp(bcConcp);
|
||||||
if (operandConcatMove(bcConcp)) moveConcat(bcConcp);
|
if (operandConcatMove(bcConcp)) moveConcat(bcConcp);
|
||||||
abConcp->deleteTree(); VL_DANGLING(abConcp);
|
VL_DO_DANGLING(abConcp->deleteTree(), abConcp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1397,7 +1398,7 @@ private:
|
||||||
rhsp->cloneTree(false)),
|
rhsp->cloneTree(false)),
|
||||||
lhsp->cloneTree(false)));
|
lhsp->cloneTree(false)));
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceSelSel(AstSel* nodep) {
|
void replaceSelSel(AstSel* nodep) {
|
||||||
|
|
@ -1414,8 +1415,8 @@ private:
|
||||||
newlsbp = new AstConst(lsb1p->fileline(),
|
newlsbp = new AstConst(lsb1p->fileline(),
|
||||||
VN_CAST(lsb1p, Const)->toUInt()
|
VN_CAST(lsb1p, Const)->toUInt()
|
||||||
+ VN_CAST(lsb2p, Const)->toUInt());
|
+ VN_CAST(lsb2p, Const)->toUInt());
|
||||||
lsb1p->deleteTree(); VL_DANGLING(lsb1p);
|
VL_DO_DANGLING(lsb1p->deleteTree(), lsb1p);
|
||||||
lsb2p->deleteTree(); VL_DANGLING(lsb2p);
|
VL_DO_DANGLING(lsb2p->deleteTree(), lsb2p);
|
||||||
} else {
|
} else {
|
||||||
// Width is important, we need the width of the fromp's
|
// Width is important, we need the width of the fromp's
|
||||||
// expression, not the potentially smaller lsb1p's width
|
// expression, not the potentially smaller lsb1p's width
|
||||||
|
|
@ -1429,7 +1430,7 @@ private:
|
||||||
newlsbp,
|
newlsbp,
|
||||||
widthp);
|
widthp);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceSelConcat(AstSel* nodep) {
|
void replaceSelConcat(AstSel* nodep) {
|
||||||
|
|
@ -1469,7 +1470,7 @@ private:
|
||||||
conRhsp->width()-nodep->lsbConst()));
|
conRhsp->width()-nodep->lsbConst()));
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
bool operandSelReplicate(AstSel* nodep) {
|
bool operandSelReplicate(AstSel* nodep) {
|
||||||
// SEL(REPLICATE(from,rep),lsb,width) => SEL(from,0,width) as long
|
// SEL(REPLICATE(from,rep),lsb,width) => SEL(from,0,width) as long
|
||||||
|
|
@ -1489,7 +1490,7 @@ private:
|
||||||
new AstConst(lsbp->fileline(), lsbp->toUInt() % fromp->width()),
|
new AstConst(lsbp->fileline(), lsbp->toUInt() % fromp->width()),
|
||||||
widthp);
|
widthp);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operandRepRep(AstReplicate* nodep) {
|
bool operandRepRep(AstReplicate* nodep) {
|
||||||
|
|
@ -1505,7 +1506,7 @@ private:
|
||||||
AstReplicate* newp = new AstReplicate(nodep->fileline(),
|
AstReplicate* newp = new AstReplicate(nodep->fileline(),
|
||||||
from2p, cnt1p->toUInt()*cnt2p->toUInt());
|
from2p, cnt1p->toUInt()*cnt2p->toUInt());
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operandConcatSame(AstConcat* nodep) {
|
bool operandConcatSame(AstConcat* nodep) {
|
||||||
|
|
@ -1532,7 +1533,7 @@ private:
|
||||||
from1p->unlinkFrBack();
|
from1p->unlinkFrBack();
|
||||||
AstReplicate* newp = new AstReplicate(nodep->fileline(), from1p, cnt1+cnt2);
|
AstReplicate* newp = new AstReplicate(nodep->fileline(), from1p, cnt1+cnt2);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void replaceSelIntoBiop(AstSel* nodep) {
|
void replaceSelIntoBiop(AstSel* nodep) {
|
||||||
|
|
@ -1550,7 +1551,7 @@ private:
|
||||||
fromp->rhsp(new AstSel(nodep->fileline(),
|
fromp->rhsp(new AstSel(nodep->fileline(),
|
||||||
birhsp, lsbp, widthp));
|
birhsp, lsbp, widthp));
|
||||||
fromp->dtypeFrom(nodep);
|
fromp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(fromp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void replaceSelIntoUniop(AstSel* nodep) {
|
void replaceSelIntoUniop(AstSel* nodep) {
|
||||||
// SEL(NOT(a),1,bit) => NOT(SEL(a,bit))
|
// SEL(NOT(a),1,bit) => NOT(SEL(a,bit))
|
||||||
|
|
@ -1564,7 +1565,7 @@ private:
|
||||||
fromp->lhsp(new AstSel(nodep->fileline(),
|
fromp->lhsp(new AstSel(nodep->fileline(),
|
||||||
bilhsp, lsbp, widthp));
|
bilhsp, lsbp, widthp));
|
||||||
fromp->dtypeFrom(nodep);
|
fromp->dtypeFrom(nodep);
|
||||||
nodep->replaceWith(fromp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAttrOf* nodep) {
|
virtual void visit(AstAttrOf* nodep) {
|
||||||
|
|
@ -1595,7 +1596,7 @@ private:
|
||||||
fromp->dtypeFrom(VN_CAST(fromp->dtypep()->skipRefp(),
|
fromp->dtypeFrom(VN_CAST(fromp->dtypep()->skipRefp(),
|
||||||
NodeArrayDType)->subDTypep());
|
NodeArrayDType)->subDTypep());
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_selp = NULL;
|
m_selp = NULL;
|
||||||
|
|
@ -1621,7 +1622,7 @@ private:
|
||||||
if (operandConst(valuep)) {
|
if (operandConst(valuep)) {
|
||||||
const V3Number& num = VN_CAST(valuep, Const)->num();
|
const V3Number& num = VN_CAST(valuep, Const)->num();
|
||||||
//UINFO(2,"constVisit "<<cvtToHex(valuep)<<" "<<num<<endl);
|
//UINFO(2,"constVisit "<<cvtToHex(valuep)<<" "<<num<<endl);
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
did = true;
|
did = true;
|
||||||
}
|
}
|
||||||
else if (m_selp && VN_IS(valuep, InitArray)) {
|
else if (m_selp && VN_IS(valuep, InitArray)) {
|
||||||
|
|
@ -1631,7 +1632,7 @@ private:
|
||||||
if (VN_IS(itemp, Const)) {
|
if (VN_IS(itemp, Const)) {
|
||||||
const V3Number& num = VN_CAST(itemp, Const)->num();
|
const V3Number& num = VN_CAST(itemp, Const)->num();
|
||||||
//UINFO(2,"constVisit "<<cvtToHex(valuep)<<" "<<num<<endl);
|
//UINFO(2,"constVisit "<<cvtToHex(valuep)<<" "<<num<<endl);
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
did = true;
|
did = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1641,7 +1642,7 @@ private:
|
||||||
// This exception is fairly fragile, i.e. doesn't
|
// This exception is fairly fragile, i.e. doesn't
|
||||||
// support arrays of arrays or other stuff
|
// support arrays of arrays or other stuff
|
||||||
AstNode* newp = valuep->cloneTree(false);
|
AstNode* newp = valuep->cloneTree(false);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
did = true;
|
did = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1666,7 +1667,7 @@ private:
|
||||||
}
|
}
|
||||||
if (AstConst* valuep = VN_CAST(nodep->itemp()->valuep(), Const)) {
|
if (AstConst* valuep = VN_CAST(nodep->itemp()->valuep(), Const)) {
|
||||||
const V3Number& num = valuep->num();
|
const V3Number& num = valuep->num();
|
||||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
|
||||||
did = true;
|
did = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1694,13 +1695,13 @@ private:
|
||||||
if (nodep->isClocked()) { // A constant can never get a pos/negedge
|
if (nodep->isClocked()) { // A constant can never get a pos/negedge
|
||||||
if (onlySenItemInSenTree(nodep)) {
|
if (onlySenItemInSenTree(nodep)) {
|
||||||
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Never()));
|
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Never()));
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
} else { // Otherwise it may compute a result that needs to settle out
|
} else { // Otherwise it may compute a result that needs to settle out
|
||||||
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Combo()));
|
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Combo()));
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
} else if (m_doNConst && VN_IS(nodep->sensp(), Not)) {
|
} else if (m_doNConst && VN_IS(nodep->sensp(), Not)) {
|
||||||
// V3Gate may propagate NOTs into clocks... Just deal with it
|
// V3Gate may propagate NOTs into clocks... Just deal with it
|
||||||
|
|
@ -1716,7 +1717,7 @@ private:
|
||||||
AstNodeVarRef* senvarp = VN_CAST(lastSensp->unlinkFrBack(), NodeVarRef);
|
AstNodeVarRef* senvarp = VN_CAST(lastSensp->unlinkFrBack(), NodeVarRef);
|
||||||
UASSERT_OBJ(senvarp, sensp, "Non-varref sensitivity variable");
|
UASSERT_OBJ(senvarp, sensp, "Non-varref sensitivity variable");
|
||||||
sensp->replaceWith(senvarp);
|
sensp->replaceWith(senvarp);
|
||||||
sensp->deleteTree(); VL_DANGLING(sensp);
|
VL_DO_DANGLING(sensp->deleteTree(), sensp);
|
||||||
} else if (!m_doNConst // Deal with later when doNConst missing
|
} else if (!m_doNConst // Deal with later when doNConst missing
|
||||||
&& (VN_IS(nodep->sensp(), EnumItemRef)
|
&& (VN_IS(nodep->sensp(), EnumItemRef)
|
||||||
|| VN_IS(nodep->sensp(), Const))) {
|
|| VN_IS(nodep->sensp(), Const))) {
|
||||||
|
|
@ -1733,15 +1734,15 @@ private:
|
||||||
UINFO(4,"SENGATE(...,0)->NEVER"<<endl);
|
UINFO(4,"SENGATE(...,0)->NEVER"<<endl);
|
||||||
if (onlySenItemInSenTree(nodep)) {
|
if (onlySenItemInSenTree(nodep)) {
|
||||||
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Never()));
|
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Never()));
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UINFO(4,"SENGATE(SENITEM,0)->ALWAYS SENITEM"<<endl);
|
UINFO(4,"SENGATE(SENITEM,0)->ALWAYS SENITEM"<<endl);
|
||||||
AstNode* senitemp = nodep->sensesp()->unlinkFrBack();
|
AstNode* senitemp = nodep->sensesp()->unlinkFrBack();
|
||||||
nodep->replaceWith(senitemp);
|
nodep->replaceWith(senitemp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1813,7 +1814,8 @@ private:
|
||||||
// Found, push this item up to the top
|
// Found, push this item up to the top
|
||||||
itemp->unlinkFrBack();
|
itemp->unlinkFrBack();
|
||||||
nodep->addSensesp(itemp);
|
nodep->addSensesp(itemp);
|
||||||
gatep->unlinkFrBack()->deleteTree(); VL_DANGLING(gatep); VL_DANGLING(senp);
|
VL_DO_DANGLING(gatep->unlinkFrBack()->deleteTree(), gatep);
|
||||||
|
VL_DANGLING(senp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1874,7 +1876,8 @@ private:
|
||||||
&& ritemp->edgeType() == VEdgeType::ET_NEGEDGE)
|
&& ritemp->edgeType() == VEdgeType::ET_NEGEDGE)
|
||||||
litemp->edgeType(VEdgeType::ET_BOTHEDGE);
|
litemp->edgeType(VEdgeType::ET_BOTHEDGE);
|
||||||
// Remove redundant node
|
// Remove redundant node
|
||||||
ritemp->unlinkFrBack()->deleteTree(); VL_DANGLING(ritemp); VL_DANGLING(cmpp);
|
VL_DO_DANGLING(ritemp->unlinkFrBack()->deleteTree(), ritemp);
|
||||||
|
VL_DANGLING(cmpp);
|
||||||
// Try to collapse again
|
// Try to collapse again
|
||||||
nextp = litemp;
|
nextp = litemp;
|
||||||
}
|
}
|
||||||
|
|
@ -1917,7 +1920,7 @@ private:
|
||||||
new AstAssign(nodep->fileline(),
|
new AstAssign(nodep->fileline(),
|
||||||
varrefp, exprp));
|
varrefp, exprp));
|
||||||
m_modp->addStmtp(newinitp);
|
m_modp->addStmtp(newinitp);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
// Set the initial value right in the variable so we can constant propagate
|
// Set the initial value right in the variable so we can constant propagate
|
||||||
AstNode* initvaluep = exprp->cloneTree(false);
|
AstNode* initvaluep = exprp->cloneTree(false);
|
||||||
varrefp->varp()->valuep(initvaluep);
|
varrefp->varp()->valuep(initvaluep);
|
||||||
|
|
@ -1942,13 +1945,13 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (!afterComment(nodep->ifsp()) && !afterComment(nodep->elsesp())) {
|
else if (!afterComment(nodep->ifsp()) && !afterComment(nodep->elsesp())) {
|
||||||
// Empty block, remove it
|
// Empty block, remove it
|
||||||
// Note if we support more C++ then there might be side
|
// Note if we support more C++ then there might be side
|
||||||
// effects in the condition itself
|
// effects in the condition itself
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (!afterComment(nodep->ifsp())) {
|
else if (!afterComment(nodep->ifsp())) {
|
||||||
UINFO(4,"IF({x}) NULL {...} => IF(NOT{x}}: "<<nodep<<endl);
|
UINFO(4,"IF({x}) NULL {...} => IF(NOT{x}}: "<<nodep<<endl);
|
||||||
|
|
@ -1970,7 +1973,7 @@ private:
|
||||||
AstIf* ifp = new AstIf(nodep->fileline(), condp, elsesp, ifsp);
|
AstIf* ifp = new AstIf(nodep->fileline(), condp, elsesp, ifsp);
|
||||||
ifp->branchPred(nodep->branchPred().invert());
|
ifp->branchPred(nodep->branchPred().invert());
|
||||||
nodep->replaceWith(ifp);
|
nodep->replaceWith(ifp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (ifSameAssign(nodep)) {
|
else if (ifSameAssign(nodep)) {
|
||||||
UINFO(4,"IF({a}) ASSIGN({b},{c}) else ASSIGN({b},{d}) => ASSIGN({b}, {a}?{c}:{d})"<<endl);
|
UINFO(4,"IF({a}) ASSIGN({b},{c}) else ASSIGN({b},{d}) => ASSIGN({b}, {a}?{c}:{d})"<<endl);
|
||||||
|
|
@ -1983,7 +1986,7 @@ private:
|
||||||
ifp->rhsp(new AstCond(truep->fileline(),
|
ifp->rhsp(new AstCond(truep->fileline(),
|
||||||
condp, truep, falsep));
|
condp, truep, falsep));
|
||||||
nodep->replaceWith(ifp);
|
nodep->replaceWith(ifp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (0 // Disabled, as vpm assertions are faster without due to short-circuiting
|
else if (0 // Disabled, as vpm assertions are faster without due to short-circuiting
|
||||||
&& operandIfIf(nodep)) {
|
&& operandIfIf(nodep)) {
|
||||||
|
|
@ -1995,7 +1998,7 @@ private:
|
||||||
nodep->condp(new AstLogAnd(lowerIfp->fileline(),
|
nodep->condp(new AstLogAnd(lowerIfp->fileline(),
|
||||||
condp, lowerCondp));
|
condp, lowerCondp));
|
||||||
lowerIfp->replaceWith(lowerIfsp);
|
lowerIfp->replaceWith(lowerIfsp);
|
||||||
lowerIfp->deleteTree(); VL_DANGLING(lowerIfp);
|
VL_DO_DANGLING(lowerIfp->deleteTree(), lowerIfp);
|
||||||
}
|
}
|
||||||
else if (operandBoolShift(nodep->condp())) {
|
else if (operandBoolShift(nodep->condp())) {
|
||||||
replaceBoolShift(nodep->condp());
|
replaceBoolShift(nodep->condp());
|
||||||
|
|
@ -2045,7 +2048,7 @@ private:
|
||||||
if (!prevp->addNewline() && nodep->addNewline()) {
|
if (!prevp->addNewline() && nodep->addNewline()) {
|
||||||
pformatp->text(pformatp->text()+"\n");
|
pformatp->text(pformatp->text()+"\n");
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormatF* nodep) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
|
|
@ -2087,7 +2090,7 @@ private:
|
||||||
<<" for "<<argp<<endl);
|
<<" for "<<argp<<endl);
|
||||||
// fmt = out w/ replace % with %% as it must be literal.
|
// fmt = out w/ replace % with %% as it must be literal.
|
||||||
fmt = VString::quotePercent(out);
|
fmt = VString::quotePercent(out);
|
||||||
argp->unlinkFrBack()->deleteTree(); VL_DANGLING(argp);
|
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
|
||||||
}
|
}
|
||||||
argp = nextp;
|
argp = nextp;
|
||||||
}
|
}
|
||||||
|
|
@ -2107,7 +2110,7 @@ private:
|
||||||
&& nodep->name().find('%') == string::npos
|
&& nodep->name().find('%') == string::npos
|
||||||
&& !nodep->hidden()) {
|
&& !nodep->hidden()) {
|
||||||
// Just a simple constant string - the formatting is pointless
|
// Just a simple constant string - the formatting is pointless
|
||||||
replaceConstString(nodep, nodep->name()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceConstString(nodep, nodep->name()), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2134,7 +2137,7 @@ private:
|
||||||
UINFO(4,"WHILE(0) => nop "<<nodep<<endl);
|
UINFO(4,"WHILE(0) => nop "<<nodep<<endl);
|
||||||
if (nodep->precondsp()) nodep->replaceWith(nodep->precondsp());
|
if (nodep->precondsp()) nodep->replaceWith(nodep->precondsp());
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->condp()->isNeqZero()) {
|
else if (nodep->condp()->isNeqZero()) {
|
||||||
if (!thisWhileHasJumpGo) {
|
if (!thisWhileHasJumpGo) {
|
||||||
|
|
@ -2162,7 +2165,7 @@ private:
|
||||||
virtual void visit(AstSysIgnore* nodep) {
|
virtual void visit(AstSysIgnore* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
if (m_doNConst) {
|
if (m_doNConst) {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2185,7 +2188,7 @@ private:
|
||||||
if (AstJumpLabel* aboveLabelp = VN_CAST(nodep->abovep(), JumpLabel)) {
|
if (AstJumpLabel* aboveLabelp = VN_CAST(nodep->abovep(), JumpLabel)) {
|
||||||
if (aboveLabelp == nodep->labelp()) {
|
if (aboveLabelp == nodep->labelp()) {
|
||||||
UINFO(4, "JUMPGO => last remove "<<nodep<<endl);
|
UINFO(4, "JUMPGO => last remove "<<nodep<<endl);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2206,7 +2209,7 @@ private:
|
||||||
if (nodep->stmtsp()) underp = nodep->stmtsp()->unlinkFrBackWithNext();
|
if (nodep->stmtsp()) underp = nodep->stmtsp()->unlinkFrBackWithNext();
|
||||||
if (underp) nodep->replaceWith(underp);
|
if (underp) nodep->replaceWith(underp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ private:
|
||||||
// Skip all NEXT nodes under this block, and skip this if/case branch
|
// Skip all NEXT nodes under this block, and skip this if/case branch
|
||||||
UINFO(4," OFF: "<<nodep<<endl);
|
UINFO(4," OFF: "<<nodep<<endl);
|
||||||
m_checkBlock = false;
|
m_checkBlock = false;
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
if (m_checkBlock) iterateChildren(nodep);
|
if (m_checkBlock) iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ private:
|
||||||
UINFO(8," new "<<removep->incp()->declp()<<endl);
|
UINFO(8," new "<<removep->incp()->declp()<<endl);
|
||||||
// Mark the found node as a duplicate of the first node
|
// Mark the found node as a duplicate of the first node
|
||||||
// (Not vice-versa as we have the iterator for the found node)
|
// (Not vice-versa as we have the iterator for the found node)
|
||||||
removep->unlinkFrBack(); pushDeletep(removep); VL_DANGLING(removep);
|
removep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(removep), removep);
|
||||||
// Remove node from comparison so don't hit it again
|
// Remove node from comparison so don't hit it again
|
||||||
hashed.erase(dupit);
|
hashed.erase(dupit);
|
||||||
++m_statToggleJoins;
|
++m_statToggleJoins;
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ private:
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
if (m_elimCells) {
|
if (m_elimCells) {
|
||||||
if (!nodep->varsp()) {
|
if (!nodep->varsp()) {
|
||||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -221,7 +221,7 @@ private:
|
||||||
virtual void visit(AstTypedef* nodep) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
if (m_elimCells && !nodep->attrPublic()) {
|
if (m_elimCells && !nodep->attrPublic()) {
|
||||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
|
|
@ -289,7 +289,7 @@ private:
|
||||||
if (!modp->dead()) { // If was dead didn't increment user1's
|
if (!modp->dead()) { // If was dead didn't increment user1's
|
||||||
DeadModVisitor visitor(modp);
|
DeadModVisitor visitor(modp);
|
||||||
}
|
}
|
||||||
modp->unlinkFrBack()->deleteTree(); VL_DANGLING(modp);
|
VL_DO_DANGLING(modp->unlinkFrBack()->deleteTree(), modp);
|
||||||
retry = true;
|
retry = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +317,7 @@ private:
|
||||||
if (scp->dtypep()) {
|
if (scp->dtypep()) {
|
||||||
scp->dtypep()->user1Inc(-1);
|
scp->dtypep()->user1Inc(-1);
|
||||||
}
|
}
|
||||||
scp->unlinkFrBack()->deleteTree(); VL_DANGLING(scp);
|
VL_DO_DANGLING(scp->unlinkFrBack()->deleteTree(), scp);
|
||||||
*it = NULL;
|
*it = NULL;
|
||||||
retry = true;
|
retry = true;
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +330,7 @@ private:
|
||||||
AstCell* cellp = *it;
|
AstCell* cellp = *it;
|
||||||
if (cellp->user1() == 0 && !cellp->modp()->stmtsp()) {
|
if (cellp->user1() == 0 && !cellp->modp()->stmtsp()) {
|
||||||
cellp->modp()->user1Inc(-1);
|
cellp->modp()->user1Inc(-1);
|
||||||
cellp->unlinkFrBack()->deleteTree(); VL_DANGLING(cellp);
|
VL_DO_DANGLING(cellp->unlinkFrBack()->deleteTree(), cellp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -347,11 +347,11 @@ private:
|
||||||
AstNodeAssign* assp = itr->second;
|
AstNodeAssign* assp = itr->second;
|
||||||
UINFO(4," Dead assign "<<assp<<endl);
|
UINFO(4," Dead assign "<<assp<<endl);
|
||||||
assp->dtypep()->user1Inc(-1);
|
assp->dtypep()->user1Inc(-1);
|
||||||
assp->unlinkFrBack()->deleteTree(); VL_DANGLING(assp);
|
VL_DO_DANGLING(assp->unlinkFrBack()->deleteTree(), assp);
|
||||||
}
|
}
|
||||||
if (vscp->scopep()) vscp->scopep()->user1Inc(-1);
|
if (vscp->scopep()) vscp->scopep()->user1Inc(-1);
|
||||||
vscp->dtypep()->user1Inc(-1);
|
vscp->dtypep()->user1Inc(-1);
|
||||||
vscp->unlinkFrBack()->deleteTree(); VL_DANGLING(vscp);
|
VL_DO_DANGLING(vscp->unlinkFrBack()->deleteTree(), vscp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (bool retry=true; retry; ) {
|
for (bool retry=true; retry; ) {
|
||||||
|
|
@ -365,7 +365,7 @@ private:
|
||||||
if (varp->dtypep()) {
|
if (varp->dtypep()) {
|
||||||
varp->dtypep()->user1Inc(-1);
|
varp->dtypep()->user1Inc(-1);
|
||||||
}
|
}
|
||||||
varp->unlinkFrBack()->deleteTree(); VL_DANGLING(varp);
|
VL_DO_DANGLING(varp->unlinkFrBack()->deleteTree(), varp);
|
||||||
*it = NULL;
|
*it = NULL;
|
||||||
retry = true;
|
retry = true;
|
||||||
}
|
}
|
||||||
|
|
@ -389,7 +389,7 @@ private:
|
||||||
if (!cont)
|
if (!cont)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(*it)->unlinkFrBack()->deleteTree(); VL_DANGLING(*it);
|
VL_DO_DANGLING((*it)->unlinkFrBack()->deleteTree(), *it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -384,9 +384,9 @@ private:
|
||||||
if (newlhsp) {
|
if (newlhsp) {
|
||||||
nodep->lhsp(newlhsp);
|
nodep->lhsp(newlhsp);
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
VL_DO_DANGLING(lhsp->deleteTree(), lhsp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -432,7 +432,7 @@ private:
|
||||||
}
|
}
|
||||||
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), dlyvscp, true);
|
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), dlyvscp, true);
|
||||||
newrefp->user2(true); // No reason to do it again
|
newrefp->user2(true); // No reason to do it again
|
||||||
nodep->replaceWith(newrefp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newrefp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (!m_inDly && nodep->lvalue()) {
|
else if (!m_inDly && nodep->lvalue()) {
|
||||||
//UINFO(9,"NBA "<<nodep<<endl);
|
//UINFO(9,"NBA "<<nodep<<endl);
|
||||||
|
|
|
||||||
|
|
@ -2388,7 +2388,7 @@ void EmitCStmts::emitVarSort(const VarSortMap& vmap, VarVec* sortedp) {
|
||||||
sortedp->push_back(*kt);
|
sortedp->push_back(*kt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete statep; VL_DANGLING(statep);
|
VL_DO_DANGLING(delete statep, statep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ private:
|
||||||
void replaceWithDelete(AstNode* nodep, AstNode* newp) {
|
void replaceWithDelete(AstNode* nodep, AstNode* newp) {
|
||||||
newp->user1(1); // Already processed, don't need to re-iterate
|
newp->user1(1); // Already processed, don't need to re-iterate
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
AstNode* newWordAssign(AstNodeAssign* placep, int word, AstNode* lhsp, AstNode* rhsp) {
|
AstNode* newWordAssign(AstNodeAssign* placep, int word, AstNode* lhsp, AstNode* rhsp) {
|
||||||
AstAssign* newp = new AstAssign(placep->fileline(),
|
AstAssign* newp = new AstAssign(placep->fileline(),
|
||||||
|
|
@ -328,7 +328,7 @@ private:
|
||||||
"extending larger thing into smaller?");
|
"extending larger thing into smaller?");
|
||||||
lhsp->dtypeFrom(nodep); // Just mark it, else nop
|
lhsp->dtypeFrom(nodep); // Just mark it, else nop
|
||||||
}
|
}
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool expandWide(AstNodeAssign* nodep, AstExtend* rhsp) {
|
bool expandWide(AstNodeAssign* nodep, AstExtend* rhsp) {
|
||||||
|
|
@ -443,7 +443,7 @@ private:
|
||||||
if (midp) newp = new AstOr(nodep->fileline(), midp, newp);
|
if (midp) newp = new AstOr(nodep->fileline(), midp, newp);
|
||||||
if (hip) newp = new AstOr(nodep->fileline(), hip, newp);
|
if (hip) newp = new AstOr(nodep->fileline(), hip, newp);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
else { // Long/Quad from Long/Quad
|
else { // Long/Quad from Long/Quad
|
||||||
UINFO(8," SEL->SHIFT "<<nodep<<endl);
|
UINFO(8," SEL->SHIFT "<<nodep<<endl);
|
||||||
|
|
@ -461,7 +461,7 @@ private:
|
||||||
newp = new AstCCast(newp->fileline(), newp, nodep);
|
newp = new AstCCast(newp->fileline(), newp, nodep);
|
||||||
}
|
}
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -553,8 +553,8 @@ private:
|
||||||
rhsp, lsb)));
|
rhsp, lsb)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
VL_DO_DANGLING(rhsp->deleteTree(), rhsp);
|
||||||
destp->deleteTree(); VL_DANGLING(destp);
|
VL_DO_DANGLING(destp->deleteTree(), destp);
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," ASSIGNSEL(const,narrow) "<<nodep<<endl);
|
UINFO(8," ASSIGNSEL(const,narrow) "<<nodep<<endl);
|
||||||
if (destp->isQuad() && !rhsp->isQuad()) {
|
if (destp->isQuad() && !rhsp->isQuad()) {
|
||||||
|
|
@ -693,7 +693,7 @@ private:
|
||||||
nodep->width()),
|
nodep->width()),
|
||||||
rhsp);
|
rhsp);
|
||||||
newp->dtypeFrom(nodep); // Unsigned
|
newp->dtypeFrom(nodep); // Unsigned
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool expandWide(AstNodeAssign* nodep, AstConcat* rhsp) {
|
bool expandWide(AstNodeAssign* nodep, AstConcat* rhsp) {
|
||||||
|
|
@ -746,10 +746,10 @@ private:
|
||||||
newp);
|
newp);
|
||||||
newp->dtypeFrom(nodep); // Unsigned
|
newp->dtypeFrom(nodep); // Unsigned
|
||||||
}
|
}
|
||||||
lhsp->deleteTree(); // Never used
|
VL_DO_DANGLING(lhsp->deleteTree(), lhsp); // Never used
|
||||||
}
|
}
|
||||||
newp->dtypeFrom(nodep); // Unsigned
|
newp->dtypeFrom(nodep); // Unsigned
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool expandWide(AstNodeAssign* nodep, AstReplicate* rhsp) {
|
bool expandWide(AstNodeAssign* nodep, AstReplicate* rhsp) {
|
||||||
|
|
@ -791,7 +791,7 @@ private:
|
||||||
newAstWordSelClone(nodep->rhsp(), w));
|
newAstWordSelClone(nodep->rhsp(), w));
|
||||||
newp = (newp==NULL) ? eqp : (new AstOr(nodep->fileline(), newp, eqp));
|
newp = (newp==NULL) ? eqp : (new AstOr(nodep->fileline(), newp, eqp));
|
||||||
}
|
}
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void visitEqNeq(AstNodeBiop* nodep) {
|
void visitEqNeq(AstNodeBiop* nodep) {
|
||||||
|
|
@ -816,7 +816,7 @@ private:
|
||||||
new AstConst(nodep->fileline(), AstConst::SizedEData(), 0),
|
new AstConst(nodep->fileline(), AstConst::SizedEData(), 0),
|
||||||
newp);
|
newp);
|
||||||
}
|
}
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEq* nodep) { visitEqNeq(nodep); }
|
virtual void visit(AstEq* nodep) { visitEqNeq(nodep); }
|
||||||
|
|
@ -836,7 +836,7 @@ private:
|
||||||
newp = new AstNeq(nodep->fileline(),
|
newp = new AstNeq(nodep->fileline(),
|
||||||
new AstConst(nodep->fileline(), AstConst::SizedEData(), 0),
|
new AstConst(nodep->fileline(), AstConst::SizedEData(), 0),
|
||||||
newp);
|
newp);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," REDOR->EQ "<<nodep<<endl);
|
UINFO(8," REDOR->EQ "<<nodep<<endl);
|
||||||
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
||||||
|
|
@ -844,7 +844,7 @@ private:
|
||||||
new AstConst(nodep->fileline(), AstConst::WidthedValue(),
|
new AstConst(nodep->fileline(), AstConst::WidthedValue(),
|
||||||
longOrQuadWidth(nodep), 0),
|
longOrQuadWidth(nodep), 0),
|
||||||
lhsp);
|
lhsp);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedAnd* nodep) {
|
virtual void visit(AstRedAnd* nodep) {
|
||||||
|
|
@ -870,14 +870,14 @@ private:
|
||||||
newp = new AstEq(nodep->fileline(),
|
newp = new AstEq(nodep->fileline(),
|
||||||
new AstConst(nodep->fileline(), AstConst::SizedEData(),
|
new AstConst(nodep->fileline(), AstConst::SizedEData(),
|
||||||
~VL_MASK_E(0)), newp);
|
~VL_MASK_E(0)), newp);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," REDAND->EQ "<<nodep<<endl);
|
UINFO(8," REDAND->EQ "<<nodep<<endl);
|
||||||
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
||||||
AstNode* newp = new AstEq(nodep->fileline(),
|
AstNode* newp = new AstEq(nodep->fileline(),
|
||||||
new AstConst(nodep->fileline(), wordMask(lhsp)),
|
new AstConst(nodep->fileline(), wordMask(lhsp)),
|
||||||
lhsp);
|
lhsp);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXor* nodep) {
|
virtual void visit(AstRedXor* nodep) {
|
||||||
|
|
@ -893,7 +893,7 @@ private:
|
||||||
}
|
}
|
||||||
newp = new AstRedXor(nodep->fileline(), newp);
|
newp = new AstRedXor(nodep->fileline(), newp);
|
||||||
UINFO(8," Wordize REDXORnew "<<newp<<endl);
|
UINFO(8," Wordize REDXORnew "<<newp<<endl);
|
||||||
replaceWithDelete(nodep, newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
|
||||||
}
|
}
|
||||||
// We don't reduce non-wide XORs, as its more efficient to use a temp register,
|
// We don't reduce non-wide XORs, as its more efficient to use a temp register,
|
||||||
// which the inlined function does nicely.
|
// which the inlined function does nicely.
|
||||||
|
|
@ -948,7 +948,7 @@ private:
|
||||||
}
|
}
|
||||||
// Cleanup common code
|
// Cleanup common code
|
||||||
if (did) {
|
if (did) {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
|
||||||
varvertexp->propagateAttrClocksFrom(vvertexp);
|
varvertexp->propagateAttrClocksFrom(vvertexp);
|
||||||
}
|
}
|
||||||
// Remove the edge
|
// Remove the edge
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
++m_statRefs;
|
++m_statRefs;
|
||||||
edgep = vvertexp->outBeginp();
|
edgep = vvertexp->outBeginp();
|
||||||
}
|
}
|
||||||
|
|
@ -674,7 +674,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
|
||||||
if (removedAllUsages) {
|
if (removedAllUsages) {
|
||||||
// Remove input links
|
// Remove input links
|
||||||
while (V3GraphEdge* edgep = vvertexp->inBeginp()) {
|
while (V3GraphEdge* edgep = vvertexp->inBeginp()) {
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
}
|
}
|
||||||
// Clone tree so we remember it for tracing, and keep the pointer
|
// Clone tree so we remember it for tracing, and keep the pointer
|
||||||
// to the "ALWAYS" part of the tree as part of this statement
|
// to the "ALWAYS" part of the tree as part of this statement
|
||||||
|
|
@ -731,25 +731,25 @@ void GateVisitor::replaceAssigns() {
|
||||||
if (vscp->valuep() && !VN_IS(vscp->valuep(), NodeMath)) {
|
if (vscp->valuep() && !VN_IS(vscp->valuep(), NodeMath)) {
|
||||||
//if (debug()>9) vscp->dumpTree(cout, "-vscPre: ");
|
//if (debug()>9) vscp->dumpTree(cout, "-vscPre: ");
|
||||||
while (AstNode* delp = VN_CAST(vscp->valuep(), Comment)) {
|
while (AstNode* delp = VN_CAST(vscp->valuep(), Comment)) {
|
||||||
delp->unlinkFrBack()->deleteTree(); VL_DANGLING(delp);
|
VL_DO_DANGLING(delp->unlinkFrBack()->deleteTree(), delp);
|
||||||
}
|
}
|
||||||
if (AstInitial* delp = VN_CAST(vscp->valuep(), Initial)) {
|
if (AstInitial* delp = VN_CAST(vscp->valuep(), Initial)) {
|
||||||
AstNode* bodyp = delp->bodysp();
|
AstNode* bodyp = delp->bodysp();
|
||||||
bodyp->unlinkFrBackWithNext();
|
bodyp->unlinkFrBackWithNext();
|
||||||
delp->replaceWith(bodyp);
|
delp->replaceWith(bodyp);
|
||||||
delp->deleteTree(); VL_DANGLING(delp);
|
VL_DO_DANGLING(delp->deleteTree(), delp);
|
||||||
}
|
}
|
||||||
if (AstAlways* delp = VN_CAST(vscp->valuep(), Always)) {
|
if (AstAlways* delp = VN_CAST(vscp->valuep(), Always)) {
|
||||||
AstNode* bodyp = delp->bodysp();
|
AstNode* bodyp = delp->bodysp();
|
||||||
bodyp->unlinkFrBackWithNext();
|
bodyp->unlinkFrBackWithNext();
|
||||||
delp->replaceWith(bodyp);
|
delp->replaceWith(bodyp);
|
||||||
delp->deleteTree(); VL_DANGLING(delp);
|
VL_DO_DANGLING(delp->deleteTree(), delp);
|
||||||
}
|
}
|
||||||
if (AstNodeAssign* delp = VN_CAST(vscp->valuep(), NodeAssign)) {
|
if (AstNodeAssign* delp = VN_CAST(vscp->valuep(), NodeAssign)) {
|
||||||
AstNode* rhsp = delp->rhsp();
|
AstNode* rhsp = delp->rhsp();
|
||||||
rhsp->unlinkFrBack();
|
rhsp->unlinkFrBack();
|
||||||
delp->replaceWith(rhsp);
|
delp->replaceWith(rhsp);
|
||||||
delp->deleteTree(); VL_DANGLING(delp);
|
VL_DO_DANGLING(delp->deleteTree(), delp);
|
||||||
}
|
}
|
||||||
//if (debug()>9) {vscp->dumpTree(cout, "-vscDone: "); cout<<endl;}
|
//if (debug()>9) {vscp->dumpTree(cout, "-vscDone: "); cout<<endl;}
|
||||||
if (!VN_IS(vscp->valuep(), NodeMath)
|
if (!VN_IS(vscp->valuep(), NodeMath)
|
||||||
|
|
@ -805,7 +805,7 @@ void GateVisitor::consumedMove() {
|
||||||
// with "tracing-on" sensitivity
|
// with "tracing-on" sensitivity
|
||||||
UINFO(8," Remove unconsumed "<<nodep<<endl);
|
UINFO(8," Remove unconsumed "<<nodep<<endl);
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -884,7 +884,7 @@ private:
|
||||||
if (AstNodeVarRef* varrefp = VN_CAST(substp, NodeVarRef)) varrefp->lvalue(false);
|
if (AstNodeVarRef* varrefp = VN_CAST(substp, NodeVarRef)) varrefp->lvalue(false);
|
||||||
hashReplace(nodep, substp);
|
hashReplace(nodep, substp);
|
||||||
nodep->replaceWith(substp);
|
nodep->replaceWith(substp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep) {
|
virtual void visit(AstNode* nodep) {
|
||||||
|
|
@ -1207,7 +1207,7 @@ private:
|
||||||
dupVvertexp->propagateAttrClocksFrom(vvertexp);
|
dupVvertexp->propagateAttrClocksFrom(vvertexp);
|
||||||
// Remove inputs links
|
// Remove inputs links
|
||||||
while (V3GraphEdge* inedgep = vvertexp->inBeginp()) {
|
while (V3GraphEdge* inedgep = vvertexp->inBeginp()) {
|
||||||
inedgep->unlinkDelete(); VL_DANGLING(inedgep);
|
VL_DO_DANGLING(inedgep->unlinkDelete(), inedgep);
|
||||||
}
|
}
|
||||||
// replaceAssigns() does the deleteTree on lvertexNodep in a later step
|
// replaceAssigns() does the deleteTree on lvertexNodep in a later step
|
||||||
AstNode* lvertexNodep = lvertexp->nodep();
|
AstNode* lvertexNodep = lvertexp->nodep();
|
||||||
|
|
@ -1338,19 +1338,19 @@ private:
|
||||||
UINFO(5, "assemble to new sel: "<<newselp<<endl);
|
UINFO(5, "assemble to new sel: "<<newselp<<endl);
|
||||||
// replace preSel with newSel
|
// replace preSel with newSel
|
||||||
preselp->replaceWith(newselp);
|
preselp->replaceWith(newselp);
|
||||||
preselp->deleteTree(); VL_DANGLING(preselp);
|
VL_DO_DANGLING(preselp->deleteTree(), preselp);
|
||||||
// create new rhs for pre assignment
|
// create new rhs for pre assignment
|
||||||
AstNode* newrhsp = new AstConcat(
|
AstNode* newrhsp = new AstConcat(
|
||||||
m_assignp->rhsp()->fileline(), m_assignp->rhsp()->cloneTree(false),
|
m_assignp->rhsp()->fileline(), m_assignp->rhsp()->cloneTree(false),
|
||||||
assignp->rhsp()->cloneTree(false));
|
assignp->rhsp()->cloneTree(false));
|
||||||
AstNode* oldrhsp = m_assignp->rhsp();
|
AstNode* oldrhsp = m_assignp->rhsp();
|
||||||
oldrhsp->replaceWith(newrhsp);
|
oldrhsp->replaceWith(newrhsp);
|
||||||
oldrhsp->deleteTree(); VL_DANGLING(oldrhsp);
|
VL_DO_DANGLING(oldrhsp->deleteTree(), oldrhsp);
|
||||||
m_assignp->dtypeChgWidthSigned(m_assignp->width()+assignp->width(),
|
m_assignp->dtypeChgWidthSigned(m_assignp->width()+assignp->width(),
|
||||||
m_assignp->width()+assignp->width(),
|
m_assignp->width()+assignp->width(),
|
||||||
AstNumeric::SIGNED);
|
AstNumeric::SIGNED);
|
||||||
// don't need to delete, will be handled
|
// don't need to delete, will be handled
|
||||||
//assignp->unlinkFrBack(); assignp->deleteTree(); VL_DANGLING(assignp);
|
//assignp->unlinkFrBack(); VL_DO_DANGLING(assignp->deleteTree(), assignp);
|
||||||
|
|
||||||
// update the graph
|
// update the graph
|
||||||
{
|
{
|
||||||
|
|
@ -1362,11 +1362,11 @@ private:
|
||||||
GateEitherVertex* fromvp
|
GateEitherVertex* fromvp
|
||||||
= dynamic_cast<GateEitherVertex*>(oedgep->fromp());
|
= dynamic_cast<GateEitherVertex*>(oedgep->fromp());
|
||||||
new V3GraphEdge(m_graphp, fromvp, m_logicvp, 1);
|
new V3GraphEdge(m_graphp, fromvp, m_logicvp, 1);
|
||||||
oedgep->unlinkDelete(); VL_DANGLING(oedgep);
|
VL_DO_DANGLING(oedgep->unlinkDelete(), oedgep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// delete all outedges to lvertexp, only one
|
// delete all outedges to lvertexp, only one
|
||||||
oldedgep->unlinkDelete(); VL_DANGLING(oldedgep);
|
VL_DO_DANGLING(oldedgep->unlinkDelete(), oldedgep);
|
||||||
}
|
}
|
||||||
++m_numMergedAssigns;
|
++m_numMergedAssigns;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1556,7 +1556,7 @@ private:
|
||||||
AstNode* rhsp = assignp->rhsp();
|
AstNode* rhsp = assignp->rhsp();
|
||||||
rhsp->replaceWith(new AstVarRef(rhsp->fileline(), m_clk_vsp, false));
|
rhsp->replaceWith(new AstVarRef(rhsp->fileline(), m_clk_vsp, false));
|
||||||
for (V3GraphEdge* edgep = lvertexp->inBeginp(); edgep; ) {
|
for (V3GraphEdge* edgep = lvertexp->inBeginp(); edgep; ) {
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
}
|
}
|
||||||
new V3GraphEdge(m_graphp, m_clk_vvertexp, lvertexp, 1);
|
new V3GraphEdge(m_graphp, m_clk_vvertexp, lvertexp, 1);
|
||||||
m_total_decomposed_clk_vectors++;
|
m_total_decomposed_clk_vectors++;
|
||||||
|
|
@ -1623,7 +1623,7 @@ private:
|
||||||
AstNode* valuep = assp->rhsp();
|
AstNode* valuep = assp->rhsp();
|
||||||
valuep->unlinkFrBack();
|
valuep->unlinkFrBack();
|
||||||
assp->replaceWith(valuep);
|
assp->replaceWith(valuep);
|
||||||
assp->deleteTree(); VL_DANGLING(assp);
|
VL_DO_DANGLING(assp->deleteTree(), assp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Speedups
|
// Speedups
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ private:
|
||||||
AstVarScope* newvscp = genInpClk(vscp);
|
AstVarScope* newvscp = genInpClk(vscp);
|
||||||
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->lvalue());
|
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->lvalue());
|
||||||
nodep->replaceWith(newrefp);
|
nodep->replaceWith(newrefp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ void V3Graph::clear() {
|
||||||
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; /*BELOW*/) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; /*BELOW*/) {
|
||||||
V3GraphEdge* nextp = edgep->outNextp();
|
V3GraphEdge* nextp = edgep->outNextp();
|
||||||
delete edgep;
|
VL_DO_DANGLING(delete edgep, edgep);
|
||||||
edgep = nextp;
|
edgep = nextp;
|
||||||
}
|
}
|
||||||
vertexp->outUnlink();
|
vertexp->outUnlink();
|
||||||
|
|
@ -232,7 +232,7 @@ void V3Graph::clear() {
|
||||||
// Delete the old vertices
|
// Delete the old vertices
|
||||||
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; /*BELOW*/) {
|
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; /*BELOW*/) {
|
||||||
V3GraphVertex* nextp = vertexp->verticesNextp();
|
V3GraphVertex* nextp = vertexp->verticesNextp();
|
||||||
delete vertexp;
|
VL_DO_DANGLING(delete vertexp, vertexp);
|
||||||
vertexp = nextp;
|
vertexp = nextp;
|
||||||
}
|
}
|
||||||
verticesUnlink();
|
verticesUnlink();
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ void GraphAcyc::deleteMarked() {
|
||||||
nextp = vertexp->verticesNextp();
|
nextp = vertexp->verticesNextp();
|
||||||
GraphAcycVertex* avertexp = static_cast<GraphAcycVertex*>(vertexp);
|
GraphAcycVertex* avertexp = static_cast<GraphAcycVertex*>(vertexp);
|
||||||
if (avertexp->isDelete()) {
|
if (avertexp->isDelete()) {
|
||||||
avertexp->unlinkDelete(&m_breakGraph); VL_DANGLING(avertexp);
|
VL_DO_DANGLING(avertexp->unlinkDelete(&m_breakGraph), avertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -291,13 +291,13 @@ void GraphAcyc::simplifyNone(GraphAcycVertex* avertexp) {
|
||||||
while (V3GraphEdge* edgep = avertexp->outBeginp()) {
|
while (V3GraphEdge* edgep = avertexp->outBeginp()) {
|
||||||
V3GraphVertex* otherVertexp = edgep->top();
|
V3GraphVertex* otherVertexp = edgep->top();
|
||||||
//UINFO(9," out "<<otherVertexp<<endl);
|
//UINFO(9," out "<<otherVertexp<<endl);
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
workPush(otherVertexp);
|
workPush(otherVertexp);
|
||||||
}
|
}
|
||||||
while (V3GraphEdge* edgep = avertexp->inBeginp()) {
|
while (V3GraphEdge* edgep = avertexp->inBeginp()) {
|
||||||
V3GraphVertex* otherVertexp = edgep->fromp();
|
V3GraphVertex* otherVertexp = edgep->fromp();
|
||||||
//UINFO(9," in "<<otherVertexp<<endl);
|
//UINFO(9," in "<<otherVertexp<<endl);
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
workPush(otherVertexp);
|
workPush(otherVertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -328,8 +328,8 @@ void GraphAcyc::simplifyOne(GraphAcycVertex* avertexp) {
|
||||||
// cppcheck-suppress leakReturnValNotUsed
|
// cppcheck-suppress leakReturnValNotUsed
|
||||||
edgeFromEdge(templateEdgep, inVertexp, outVertexp);
|
edgeFromEdge(templateEdgep, inVertexp, outVertexp);
|
||||||
// Remove old edge
|
// Remove old edge
|
||||||
inEdgep->unlinkDelete(); VL_DANGLING(inEdgep);
|
VL_DO_DANGLING(inEdgep->unlinkDelete(), inEdgep);
|
||||||
outEdgep->unlinkDelete(); VL_DANGLING(outEdgep); VL_DANGLING(templateEdgep);
|
VL_DO_DANGLING(outEdgep->unlinkDelete(), outEdgep); VL_DANGLING(templateEdgep);
|
||||||
workPush(inVertexp);
|
workPush(inVertexp);
|
||||||
workPush(outVertexp);
|
workPush(outVertexp);
|
||||||
}
|
}
|
||||||
|
|
@ -363,10 +363,10 @@ void GraphAcyc::simplifyOut(GraphAcycVertex* avertexp) {
|
||||||
// cppcheck-suppress leakReturnValNotUsed
|
// cppcheck-suppress leakReturnValNotUsed
|
||||||
edgeFromEdge(inEdgep, inVertexp, outVertexp);
|
edgeFromEdge(inEdgep, inVertexp, outVertexp);
|
||||||
// Remove old edge
|
// Remove old edge
|
||||||
inEdgep->unlinkDelete(); VL_DANGLING(inEdgep);
|
VL_DO_DANGLING(inEdgep->unlinkDelete(), inEdgep);
|
||||||
workPush(inVertexp);
|
workPush(inVertexp);
|
||||||
}
|
}
|
||||||
outEdgep->unlinkDelete(); VL_DANGLING(outEdgep);
|
VL_DO_DANGLING(outEdgep->unlinkDelete(), outEdgep);
|
||||||
workPush(outVertexp);
|
workPush(outVertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -389,18 +389,18 @@ void GraphAcyc::simplifyDup(GraphAcycVertex* avertexp) {
|
||||||
// !cutable duplicates prev !cutable: we can ignore it, redundant
|
// !cutable duplicates prev !cutable: we can ignore it, redundant
|
||||||
// cutable duplicates prev !cutable: know it's not a relevant loop, ignore it
|
// cutable duplicates prev !cutable: know it's not a relevant loop, ignore it
|
||||||
UINFO(8," DelDupEdge "<<avertexp<<" -> "<<edgep->top()<<endl);
|
UINFO(8," DelDupEdge "<<avertexp<<" -> "<<edgep->top()<<endl);
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
} else if (!edgep->cutable()) {
|
} else if (!edgep->cutable()) {
|
||||||
// !cutable duplicates prev cutable: delete the earlier cutable
|
// !cutable duplicates prev cutable: delete the earlier cutable
|
||||||
UINFO(8," DelDupPrev "<<avertexp<<" -> "<<prevEdgep->top()<<endl);
|
UINFO(8," DelDupPrev "<<avertexp<<" -> "<<prevEdgep->top()<<endl);
|
||||||
prevEdgep->unlinkDelete(); VL_DANGLING(prevEdgep);
|
VL_DO_DANGLING(prevEdgep->unlinkDelete(), prevEdgep);
|
||||||
outVertexp->userp(edgep);
|
outVertexp->userp(edgep);
|
||||||
} else {
|
} else {
|
||||||
// cutable duplicates prev cutable: combine weights
|
// cutable duplicates prev cutable: combine weights
|
||||||
UINFO(8," DelDupComb "<<avertexp<<" -> "<<edgep->top()<<endl);
|
UINFO(8," DelDupComb "<<avertexp<<" -> "<<edgep->top()<<endl);
|
||||||
prevEdgep->weight(prevEdgep->weight() + edgep->weight());
|
prevEdgep->weight(prevEdgep->weight() + edgep->weight());
|
||||||
addOrigEdgep(prevEdgep, edgep);
|
addOrigEdgep(prevEdgep, edgep);
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
}
|
}
|
||||||
workPush(outVertexp);
|
workPush(outVertexp);
|
||||||
workPush(avertexp);
|
workPush(avertexp);
|
||||||
|
|
@ -418,7 +418,7 @@ void GraphAcyc::cutBasic(GraphAcycVertex* avertexp) {
|
||||||
nextp = edgep->outNextp();
|
nextp = edgep->outNextp();
|
||||||
if (edgep->cutable() && edgep->top()==avertexp) {
|
if (edgep->cutable() && edgep->top()==avertexp) {
|
||||||
cutOrigEdge(edgep, " Cut Basic");
|
cutOrigEdge(edgep, " Cut Basic");
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
workPush(avertexp);
|
workPush(avertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -439,7 +439,7 @@ void GraphAcyc::cutBackward(GraphAcycVertex* avertexp) {
|
||||||
nextp = edgep->outNextp();
|
nextp = edgep->outNextp();
|
||||||
if (edgep->cutable() && edgep->top()->user()) {
|
if (edgep->cutable() && edgep->top()->user()) {
|
||||||
cutOrigEdge(edgep, " Cut A->B->A");
|
cutOrigEdge(edgep, " Cut A->B->A");
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
workPush(avertexp);
|
workPush(avertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -506,7 +506,7 @@ void GraphAcyc::placeTryEdge(V3GraphEdge* edgep) {
|
||||||
// Adding this edge would cause a loop, kill it
|
// Adding this edge would cause a loop, kill it
|
||||||
edgep->cutable(true); // So graph still looks pretty
|
edgep->cutable(true); // So graph still looks pretty
|
||||||
cutOrigEdge(edgep, " Cut loop");
|
cutOrigEdge(edgep, " Cut loop");
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
// Back out the ranks we calculated
|
// Back out the ranks we calculated
|
||||||
while (GraphAcycVertex* vertexp = workBeginp()) {
|
while (GraphAcycVertex* vertexp = workBeginp()) {
|
||||||
workPop();
|
workPop();
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,10 @@ private:
|
||||||
}
|
}
|
||||||
if (saveOld) {
|
if (saveOld) {
|
||||||
if (m_sumWeights) prevEdgep->weight(prevEdgep->weight() + edgep->weight());
|
if (m_sumWeights) prevEdgep->weight(prevEdgep->weight() + edgep->weight());
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
} else {
|
} else {
|
||||||
if (m_sumWeights) edgep->weight(prevEdgep->weight() + edgep->weight());
|
if (m_sumWeights) edgep->weight(prevEdgep->weight() + edgep->weight());
|
||||||
prevEdgep->unlinkDelete(); VL_DANGLING(prevEdgep);
|
VL_DO_DANGLING(prevEdgep->unlinkDelete(), prevEdgep);
|
||||||
outVertexp->userp(edgep);
|
outVertexp->userp(edgep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deletep) {
|
if (deletep) {
|
||||||
deletep->unlinkDelete(); VL_DANGLING(deletep);
|
VL_DO_DANGLING(deletep->unlinkDelete(), deletep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ private:
|
||||||
for (V3GraphVertex* nextp,*vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=nextp) {
|
for (V3GraphVertex* nextp,*vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=nextp) {
|
||||||
nextp = vertexp->verticesNextp();
|
nextp = vertexp->verticesNextp();
|
||||||
if (nfaState(vertexp)) {
|
if (nfaState(vertexp)) {
|
||||||
vertexp->unlinkDelete(m_graphp); VL_DANGLING(vertexp);
|
VL_DO_DANGLING(vertexp->unlinkDelete(m_graphp), vertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,7 +409,7 @@ private:
|
||||||
if (vvertexp->accepting()) {
|
if (vvertexp->accepting()) {
|
||||||
for (V3GraphEdge* nextp,*edgep = vertexp->outBeginp(); edgep; edgep=nextp) {
|
for (V3GraphEdge* nextp,*edgep = vertexp->outBeginp(); edgep; edgep=nextp) {
|
||||||
nextp = edgep->outNextp();
|
nextp = edgep->outNextp();
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -445,7 +445,7 @@ private:
|
||||||
for (V3GraphVertex* nextp,*vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=nextp) {
|
for (V3GraphVertex* nextp,*vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=nextp) {
|
||||||
nextp = vertexp->verticesNextp();
|
nextp = vertexp->verticesNextp();
|
||||||
if (!vertexp->user()) {
|
if (!vertexp->user()) {
|
||||||
vertexp->unlinkDelete(m_graphp); VL_DANGLING(vertexp);
|
VL_DO_DANGLING(vertexp->unlinkDelete(m_graphp), vertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,7 +487,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Transitions to this state removed by the unlink function
|
// Transitions to this state removed by the unlink function
|
||||||
vertexp->unlinkDelete(m_graphp); VL_DANGLING(vertexp);
|
VL_DO_DANGLING(vertexp->unlinkDelete(m_graphp), vertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -566,7 +566,7 @@ private:
|
||||||
DfaVertex* tovertexp = static_cast<DfaVertex*>(edgep->top());
|
DfaVertex* tovertexp = static_cast<DfaVertex*>(edgep->top());
|
||||||
if (tovertexp->accepting()) {
|
if (tovertexp->accepting()) {
|
||||||
new DfaEdge(graphp(), vvertexp, m_tempNewerReject, vedgep);
|
new DfaEdge(graphp(), vvertexp, m_tempNewerReject, vedgep);
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOT of all values goes to accept
|
// NOT of all values goes to accept
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ GraphPathChecker::~GraphPathChecker() {
|
||||||
for (V3GraphVertex* vxp = m_graphp->verticesBeginp();
|
for (V3GraphVertex* vxp = m_graphp->verticesBeginp();
|
||||||
vxp; vxp = vxp->verticesNextp()) {
|
vxp; vxp = vxp->verticesNextp()) {
|
||||||
GraphPCNode* nodep = static_cast<GraphPCNode*>(vxp->userp());
|
GraphPCNode* nodep = static_cast<GraphPCNode*>(vxp->userp());
|
||||||
delete nodep; VL_DANGLING(nodep);
|
VL_DO_DANGLING(delete nodep, nodep);
|
||||||
vxp->userp(NULL);
|
vxp->userp(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,14 +129,16 @@ private:
|
||||||
|| m_modp->user2() == CIL_NOTSOFT) {
|
|| m_modp->user2() == CIL_NOTSOFT) {
|
||||||
m_modp->user2(CIL_USER);
|
m_modp->user2(CIL_USER);
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); // Remove so don't propagate to upper cell...
|
// Remove so don't propagate to upper cell...
|
||||||
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else if (nodep->pragType() == AstPragmaType::NO_INLINE_MODULE) {
|
} else if (nodep->pragType() == AstPragmaType::NO_INLINE_MODULE) {
|
||||||
if (!m_modp) {
|
if (!m_modp) {
|
||||||
nodep->v3error("Inline pragma not under a module"); // LCOV_EXCL_LINE
|
nodep->v3error("Inline pragma not under a module"); // LCOV_EXCL_LINE
|
||||||
} else {
|
} else {
|
||||||
cantInline("Pragma NO_INLINE_MODULE", false);
|
cantInline("Pragma NO_INLINE_MODULE", false);
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); // Remove so don't propagate to upper cell...
|
// Remove so don't propagate to upper cell...
|
||||||
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
|
|
@ -401,7 +403,7 @@ private:
|
||||||
AstVarRef* exprvarrefp = VN_CAST(nodep->varp()->user2p(), VarRef);
|
AstVarRef* exprvarrefp = VN_CAST(nodep->varp()->user2p(), VarRef);
|
||||||
if (exprconstp) {
|
if (exprconstp) {
|
||||||
nodep->replaceWith(exprconstp->cloneTree(true));
|
nodep->replaceWith(exprconstp->cloneTree(true));
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (exprvarrefp) {
|
else if (exprvarrefp) {
|
||||||
|
|
@ -597,9 +599,9 @@ private:
|
||||||
if (stmtsp) stmtsp->unlinkFrBackWithNext();
|
if (stmtsp) stmtsp->unlinkFrBackWithNext();
|
||||||
if (stmtsp) m_modp->addStmtp(stmtsp);
|
if (stmtsp) m_modp->addStmtp(stmtsp);
|
||||||
// Remove the cell
|
// Remove the cell
|
||||||
newmodp->deleteTree(); VL_DANGLING(newmodp); // Clear any leftover ports, etc
|
VL_DO_DANGLING(newmodp->deleteTree(), newmodp); // Clear any leftover ports, etc
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
if (debug()>=9) { m_modp->dumpTree(cout, "donemod:"); }
|
if (debug()>=9) { m_modp->dumpTree(cout, "donemod:"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -746,7 +748,7 @@ void V3Inline::inlineAll(AstNetlist* nodep) {
|
||||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
||||||
nextmodp = VN_CAST(modp->nextp(), NodeModule);
|
nextmodp = VN_CAST(modp->nextp(), NodeModule);
|
||||||
if (modp->user1()) { // Was inlined
|
if (modp->user1()) { // Was inlined
|
||||||
modp->unlinkFrBack()->deleteTree(); VL_DANGLING(modp);
|
VL_DO_DANGLING(modp->unlinkFrBack()->deleteTree(), modp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're done with the pin
|
// We're done with the pin
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstUdpTable* nodep) {
|
virtual void visit(AstUdpTable* nodep) {
|
||||||
|
|
@ -303,9 +303,10 @@ private:
|
||||||
// Done. Delete original
|
// Done. Delete original
|
||||||
m_cellRangep = NULL;
|
m_cellRangep = NULL;
|
||||||
if (isIface) {
|
if (isIface) {
|
||||||
ifaceVarp->unlinkFrBack(); pushDeletep(ifaceVarp); VL_DANGLING(ifaceVarp);
|
ifaceVarp->unlinkFrBack();
|
||||||
|
VL_DO_DANGLING(pushDeletep(ifaceVarp), ifaceVarp);
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else {
|
} else {
|
||||||
m_cellRangep = NULL;
|
m_cellRangep = NULL;
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -379,7 +380,7 @@ private:
|
||||||
newp->dtypep(nodep->modVarp()->dtypep());
|
newp->dtypep(nodep->modVarp()->dtypep());
|
||||||
newp->packagep(varrefp->packagep());
|
newp->packagep(varrefp->packagep());
|
||||||
arrselp->addNextHere(newp);
|
arrselp->addNextHere(newp);
|
||||||
arrselp->unlinkFrBack()->deleteTree();
|
VL_DO_DANGLING(arrselp->unlinkFrBack()->deleteTree(), arrselp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AstVar* pinVarp = nodep->modVarp();
|
AstVar* pinVarp = nodep->modVarp();
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ public:
|
||||||
// above our current iteration point.
|
// above our current iteration point.
|
||||||
if (debug()>4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK ");
|
if (debug()>4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK ");
|
||||||
entp->complexAssign();
|
entp->complexAssign();
|
||||||
m_statep->pushUnlinkDeletep(oldassp); VL_DANGLING(oldassp);
|
VL_DO_DANGLING(m_statep->pushUnlinkDeletep(oldassp), oldassp);
|
||||||
++m_statep->m_statAssnDel;
|
++m_statep->m_statAssnDel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -195,7 +195,7 @@ public:
|
||||||
// We'll later constant propagate
|
// We'll later constant propagate
|
||||||
UINFO(4," replaceconst: "<<varrefp<<endl);
|
UINFO(4," replaceconst: "<<varrefp<<endl);
|
||||||
varrefp->replaceWith(constp->cloneTree(false));
|
varrefp->replaceWith(constp->cloneTree(false));
|
||||||
varrefp->deleteTree(); VL_DANGLING(varrefp);
|
VL_DO_DANGLING(varrefp->deleteTree(), varrefp);
|
||||||
++m_statep->m_statAssnCon;
|
++m_statep->m_statAssnCon;
|
||||||
return; // **DONE, no longer a var reference**
|
return; // **DONE, no longer a var reference**
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +307,7 @@ private:
|
||||||
m_sideEffect = true; // $sscanf etc may have RHS vars that are lvalues
|
m_sideEffect = true; // $sscanf etc may have RHS vars that are lvalues
|
||||||
m_lifep->complexAssign(vscp);
|
m_lifep->complexAssign(vscp);
|
||||||
} else {
|
} else {
|
||||||
m_lifep->varUsageReplace(vscp, nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(m_lifep->varUsageReplace(vscp, nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
|
|
@ -358,8 +358,8 @@ private:
|
||||||
// For the next assignments, clear any variables that were read or written in the block
|
// For the next assignments, clear any variables that were read or written in the block
|
||||||
ifLifep->lifeToAbove();
|
ifLifep->lifeToAbove();
|
||||||
elseLifep->lifeToAbove();
|
elseLifep->lifeToAbove();
|
||||||
delete ifLifep;
|
VL_DO_DANGLING(delete ifLifep, ifLifep);
|
||||||
delete elseLifep;
|
VL_DO_DANGLING(delete elseLifep, elseLifep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstWhile* nodep) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
|
|
@ -388,8 +388,8 @@ private:
|
||||||
// For the next assignments, clear any variables that were read or written in the block
|
// For the next assignments, clear any variables that were read or written in the block
|
||||||
condLifep->lifeToAbove();
|
condLifep->lifeToAbove();
|
||||||
bodyLifep->lifeToAbove();
|
bodyLifep->lifeToAbove();
|
||||||
delete condLifep;
|
VL_DO_DANGLING(delete condLifep, condLifep);
|
||||||
delete bodyLifep;
|
VL_DO_DANGLING(delete bodyLifep, bodyLifep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpLabel* nodep) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
// As with While's we can't predict if a JumpGo will kill us or not
|
// As with While's we can't predict if a JumpGo will kill us or not
|
||||||
|
|
@ -408,7 +408,7 @@ private:
|
||||||
UINFO(4," joinjump"<<endl);
|
UINFO(4," joinjump"<<endl);
|
||||||
// For the next assignments, clear any variables that were read or written in the block
|
// For the next assignments, clear any variables that were read or written in the block
|
||||||
bodyLifep->lifeToAbove();
|
bodyLifep->lifeToAbove();
|
||||||
delete bodyLifep;
|
VL_DO_DANGLING(delete bodyLifep, bodyLifep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
//UINFO(4," CCALL "<<nodep<<endl);
|
//UINFO(4," CCALL "<<nodep<<endl);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ private:
|
||||||
UINFO(9, " Replace "<<nodep<<" to "<<newvscp<<endl);
|
UINFO(9, " Replace "<<nodep<<" to "<<newvscp<<endl);
|
||||||
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->lvalue());
|
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->lvalue());
|
||||||
nodep->replaceWith(newrefp);
|
nodep->replaceWith(newrefp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
|
|
@ -253,7 +253,7 @@ private:
|
||||||
// Delete and mark so LifePostElimVisitor will get it
|
// Delete and mark so LifePostElimVisitor will get it
|
||||||
UINFO(4," DELETE "<<app->nodep<<endl);
|
UINFO(4," DELETE "<<app->nodep<<endl);
|
||||||
dlyVarp->user4p(origVarp);
|
dlyVarp->user4p(origVarp);
|
||||||
app->nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(app->nodep);
|
VL_DO_DANGLING(app->nodep->unlinkFrBack()->deleteTree(), app->nodep);
|
||||||
++m_statAssnDel;
|
++m_statAssnDel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ private:
|
||||||
if (pinStar) pinp->v3error("Duplicate .* in a cell");
|
if (pinStar) pinp->v3error("Duplicate .* in a cell");
|
||||||
pinStar = true;
|
pinStar = true;
|
||||||
// Done with this fake pin
|
// Done with this fake pin
|
||||||
pinp->unlinkFrBack()->deleteTree(); VL_DANGLING(pinp);
|
VL_DO_DANGLING(pinp->unlinkFrBack()->deleteTree(), pinp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Convert unnamed pins to pin number based assignments
|
// Convert unnamed pins to pin number based assignments
|
||||||
|
|
@ -470,7 +470,7 @@ private:
|
||||||
<<foundp->warnContextSecondary());
|
<<foundp->warnContextSecondary());
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else if (!foundp) {
|
} else if (!foundp) {
|
||||||
m_mods.rootp()->insert(nodep->name(), new VSymEnt(&m_mods, nodep));
|
m_mods.rootp()->insert(nodep->name(), new VSymEnt(&m_mods, nodep));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -985,7 +985,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
if (m_ftaskp && nodep->isParam()) {
|
if (m_ftaskp && nodep->isParam()) {
|
||||||
nodep->v3error("Unsupported: Parameters in functions."); // Big3 unsupported too
|
nodep->v3error("Unsupported: Parameters in functions."); // Big3 unsupported too
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!m_statep->forScopeCreation()) {
|
if (!m_statep->forScopeCreation()) {
|
||||||
|
|
@ -1038,12 +1038,12 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
AstNodeDType* newdtypep = nodep->subDTypep();
|
AstNodeDType* newdtypep = nodep->subDTypep();
|
||||||
UASSERT_OBJ(newdtypep && nodep->childDTypep(), findvarp,
|
UASSERT_OBJ(newdtypep && nodep->childDTypep(), findvarp,
|
||||||
"No child type?");
|
"No child type?");
|
||||||
bdtypep->unlinkFrBack()->deleteTree();
|
VL_DO_DANGLING(bdtypep->unlinkFrBack()->deleteTree(), bdtypep);
|
||||||
newdtypep->unlinkFrBack();
|
newdtypep->unlinkFrBack();
|
||||||
findvarp->childDTypep(newdtypep);
|
findvarp->childDTypep(newdtypep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
// User can disable the message at either point
|
// User can disable the message at either point
|
||||||
if (!(m_ftaskp && m_ftaskp->dpiImport())
|
if (!(m_ftaskp && m_ftaskp->dpiImport())
|
||||||
|
|
@ -1075,7 +1075,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
newp->valuep(valuep);
|
newp->valuep(valuep);
|
||||||
UINFO(9," replace parameter "<<nodep<<endl);
|
UINFO(9," replace parameter "<<nodep<<endl);
|
||||||
UINFO(9," with "<<newp<<endl);
|
UINFO(9," with "<<newp<<endl);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
nodep = newp;
|
nodep = newp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1299,7 +1299,7 @@ private:
|
||||||
nodep->name(),
|
nodep->name(),
|
||||||
exprp);
|
exprp);
|
||||||
cellp->addParamsp(pinp);
|
cellp->addParamsp(pinp);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPort* nodep) {
|
virtual void visit(AstPort* nodep) {
|
||||||
|
|
@ -1327,7 +1327,7 @@ private:
|
||||||
symp->exported(false);
|
symp->exported(false);
|
||||||
}
|
}
|
||||||
// Ports not needed any more
|
// Ports not needed any more
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
// Deal with implicit definitions
|
// Deal with implicit definitions
|
||||||
|
|
@ -1352,7 +1352,7 @@ private:
|
||||||
// Unsupported gates need implicit creation
|
// Unsupported gates need implicit creation
|
||||||
pinImplicitExprRecurse(nodep);
|
pinImplicitExprRecurse(nodep);
|
||||||
// We're done with implicit gates
|
// We're done with implicit gates
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
|
|
@ -1497,7 +1497,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
||||||
// or maybe an alias of an alias
|
// or maybe an alias of an alias
|
||||||
m_statep->insertScopeAlias(LinkDotState::SAMN_IFTOP, lhsSymp, rhsSymp);
|
m_statep->insertScopeAlias(LinkDotState::SAMN_IFTOP, lhsSymp, rhsSymp);
|
||||||
// We have stored the link, we don't need these any more
|
// We have stored the link, we don't need these any more
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
// For speed, don't recurse things that can't have scope
|
// For speed, don't recurse things that can't have scope
|
||||||
// Note we allow AstNodeStmt's as generates may be under them
|
// Note we allow AstNodeStmt's as generates may be under them
|
||||||
|
|
@ -1565,7 +1565,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
||||||
if (m_statep->forScopeCreation()) {
|
if (m_statep->forScopeCreation()) {
|
||||||
// Done with AstModportFTaskRef.
|
// Done with AstModportFTaskRef.
|
||||||
// Delete to prevent problems if we dead-delete pointed to ftask
|
// Delete to prevent problems if we dead-delete pointed to ftask
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstModportVarRef* nodep) {
|
virtual void visit(AstModportVarRef* nodep) {
|
||||||
|
|
@ -1589,7 +1589,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
||||||
if (m_statep->forScopeCreation()) {
|
if (m_statep->forScopeCreation()) {
|
||||||
// Done with AstModportVarRef.
|
// Done with AstModportVarRef.
|
||||||
// Delete to prevent problems if we dead-delete pointed to variable
|
// Delete to prevent problems if we dead-delete pointed to variable
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep) {
|
virtual void visit(AstNode* nodep) {
|
||||||
|
|
@ -1801,7 +1801,7 @@ private:
|
||||||
virtual void visit(AstCellInline* nodep) {
|
virtual void visit(AstCellInline* nodep) {
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
if (m_statep->forScopeCreation() && !v3Global.opt.vpi()) {
|
if (m_statep->forScopeCreation() && !v3Global.opt.vpi()) {
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep) {
|
virtual void visit(AstCell* nodep) {
|
||||||
|
|
@ -1844,7 +1844,7 @@ private:
|
||||||
if (!foundp) {
|
if (!foundp) {
|
||||||
if (nodep->name() == "__paramNumber1" && VN_IS(m_cellp->modp(), Primitive)) {
|
if (nodep->name() == "__paramNumber1" && VN_IS(m_cellp->modp(), Primitive)) {
|
||||||
// Primitive parameter is really a delay we can just ignore
|
// Primitive parameter is really a delay we can just ignore
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string suggest
|
string suggest
|
||||||
|
|
@ -1923,7 +1923,7 @@ private:
|
||||||
}
|
}
|
||||||
if (debug()>=9) newp->dumpTree("-dot-out: ");
|
if (debug()>=9) newp->dumpTree("-dot-out: ");
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else { // Dot midpoint
|
} else { // Dot midpoint
|
||||||
AstNode* newp = nodep->rhsp()->unlinkFrBack();
|
AstNode* newp = nodep->rhsp()->unlinkFrBack();
|
||||||
if (m_ds.m_unresolved) {
|
if (m_ds.m_unresolved) {
|
||||||
|
|
@ -1932,7 +1932,7 @@ private:
|
||||||
newp = crp;
|
newp = crp;
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start) {
|
if (start) {
|
||||||
|
|
@ -1963,7 +1963,7 @@ private:
|
||||||
VFlagChildDType(), nodep->name());
|
VFlagChildDType(), nodep->name());
|
||||||
if (m_ds.m_dotErr) nodep->unlinkFrBack(); // Avoid circular node loop on errors
|
if (m_ds.m_dotErr) nodep->unlinkFrBack(); // Avoid circular node loop on errors
|
||||||
else nodep->replaceWith(newp);
|
else nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//
|
//
|
||||||
|
|
@ -2042,7 +2042,7 @@ private:
|
||||||
UINFO(9," cell -> iface varref "<<foundp->nodep()<<endl);
|
UINFO(9," cell -> iface varref "<<foundp->nodep()<<endl);
|
||||||
AstNode* newp = new AstVarRef(ifaceRefVarp->fileline(),
|
AstNode* newp = new AstVarRef(ifaceRefVarp->fileline(),
|
||||||
ifaceRefVarp, false);
|
ifaceRefVarp, false);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else if (VN_IS(cellp->modp(), NotFoundModule)) {
|
} else if (VN_IS(cellp->modp(), NotFoundModule)) {
|
||||||
cellp->modNameFileline()->v3error("Cannot find file containing interface: "
|
cellp->modNameFileline()->v3error("Cannot find file containing interface: "
|
||||||
<<cellp->modp()->prettyNameQ());
|
<<cellp->modp()->prettyNameQ());
|
||||||
|
|
@ -2060,7 +2060,7 @@ private:
|
||||||
m_ds.m_dotPos = DP_SCOPE;
|
m_ds.m_dotPos = DP_SCOPE;
|
||||||
ok = true;
|
ok = true;
|
||||||
AstNode* newp = new AstVarRef(nodep->fileline(), varp, false);
|
AstNode* newp = new AstVarRef(nodep->fileline(), varp, false);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (allowVar) {
|
else if (allowVar) {
|
||||||
AstNode* newp;
|
AstNode* newp;
|
||||||
|
|
@ -2084,7 +2084,7 @@ private:
|
||||||
newp = refp;
|
newp = refp;
|
||||||
}
|
}
|
||||||
UINFO(9," new "<<newp<<endl);
|
UINFO(9," new "<<newp<<endl);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
m_ds.m_dotPos = DP_MEMBER;
|
m_ds.m_dotPos = DP_MEMBER;
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2117,14 +2117,14 @@ private:
|
||||||
AstVar* varp = makeIfaceModportVar(nodep->fileline(),
|
AstVar* varp = makeIfaceModportVar(nodep->fileline(),
|
||||||
cellp, ifacep, modportp);
|
cellp, ifacep, modportp);
|
||||||
AstVarRef* refp = new AstVarRef(varp->fileline(), varp, false);
|
AstVarRef* refp = new AstVarRef(varp->fileline(), varp, false);
|
||||||
nodep->replaceWith(refp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(refp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (AstEnumItem* valuep = VN_CAST(foundp->nodep(), EnumItem)) {
|
else if (AstEnumItem* valuep = VN_CAST(foundp->nodep(), EnumItem)) {
|
||||||
if (allowVar) {
|
if (allowVar) {
|
||||||
AstNode* newp = new AstEnumItemRef(nodep->fileline(),
|
AstNode* newp = new AstEnumItemRef(nodep->fileline(),
|
||||||
valuep, foundp->packagep());
|
valuep, foundp->packagep());
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
ok = true;
|
ok = true;
|
||||||
m_ds.m_dotText = "";
|
m_ds.m_dotText = "";
|
||||||
}
|
}
|
||||||
|
|
@ -2166,7 +2166,7 @@ private:
|
||||||
// Create if implicit, and also if error (so only complain once)
|
// Create if implicit, and also if error (so only complain once)
|
||||||
AstVarRef* newp = new AstVarRef(nodep->fileline(), nodep->name(), false);
|
AstVarRef* newp = new AstVarRef(nodep->fileline(), nodep->name(), false);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
createImplicitVar(m_curSymp, newp, m_modp, m_modSymp, err);
|
createImplicitVar(m_curSymp, newp, m_modp, m_modSymp, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2237,7 +2237,7 @@ private:
|
||||||
AstVarRef* newrefp = new AstVarRef(nodep->fileline(),
|
AstVarRef* newrefp = new AstVarRef(nodep->fileline(),
|
||||||
nodep->varp(), nodep->lvalue());
|
nodep->varp(), nodep->lvalue());
|
||||||
nodep->replaceWith(newrefp);
|
nodep->replaceWith(newrefp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2262,7 +2262,7 @@ private:
|
||||||
UINFO(7," Resolved "<<nodep<<endl); // Also prints taskp
|
UINFO(7," Resolved "<<nodep<<endl); // Also prints taskp
|
||||||
AstVarRef* newvscp = new AstVarRef(nodep->fileline(), vscp, nodep->lvalue());
|
AstVarRef* newvscp = new AstVarRef(nodep->fileline(), vscp, nodep->lvalue());
|
||||||
nodep->replaceWith(newvscp);
|
nodep->replaceWith(newvscp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
UINFO(9," new "<<newvscp<<endl); // Also prints taskp
|
UINFO(9," new "<<newvscp<<endl); // Also prints taskp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2323,7 +2323,7 @@ private:
|
||||||
AstNode* newp = new AstMethodCall(nodep->fileline(), varEtcp,
|
AstNode* newp = new AstMethodCall(nodep->fileline(), varEtcp,
|
||||||
VFlagChildDType(), nodep->name(), argsp);
|
VFlagChildDType(), nodep->name(), argsp);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
|
|
@ -2425,7 +2425,7 @@ private:
|
||||||
AstNode* exprp = nodep->bitp()->unlinkFrBack();
|
AstNode* exprp = nodep->bitp()->unlinkFrBack();
|
||||||
AstCellArrayRef* newp
|
AstCellArrayRef* newp
|
||||||
= new AstCellArrayRef(nodep->fileline(), nodep->fromp()->name(), exprp);
|
= new AstCellArrayRef(nodep->fileline(), nodep->fromp()->name(), exprp);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodePreSel* nodep) {
|
virtual void visit(AstNodePreSel* nodep) {
|
||||||
|
|
@ -2525,22 +2525,22 @@ private:
|
||||||
taskp->dpiExport(true);
|
taskp->dpiExport(true);
|
||||||
if (nodep->cname()!="") taskp->cname(nodep->cname());
|
if (nodep->cname()!="") taskp->cname(nodep->cname());
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackageImport* nodep) {
|
virtual void visit(AstPackageImport* nodep) {
|
||||||
// No longer needed
|
// No longer needed
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackageExport* nodep) {
|
virtual void visit(AstPackageExport* nodep) {
|
||||||
// No longer needed
|
// No longer needed
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackageExportStarStar* nodep) {
|
virtual void visit(AstPackageExportStarStar* nodep) {
|
||||||
// No longer needed
|
// No longer needed
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellRef* nodep) {
|
virtual void visit(AstCellRef* nodep) {
|
||||||
UINFO(5," AstCellRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
UINFO(5," AstCellRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ private:
|
||||||
initsp = initsp->addNext(newp);
|
initsp = initsp->addNext(newp);
|
||||||
newp = initsp;
|
newp = initsp;
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
// Don't need to track AstRepeat/AstFor as they have already been converted
|
// Don't need to track AstRepeat/AstFor as they have already been converted
|
||||||
|
|
@ -193,7 +193,7 @@ private:
|
||||||
AstJumpLabel* labelp = findAddLabel(m_ftaskp, false);
|
AstJumpLabel* labelp = findAddLabel(m_ftaskp, false);
|
||||||
nodep->addPrev(new AstJumpGo(nodep->fileline(), labelp));
|
nodep->addPrev(new AstJumpGo(nodep->fileline(), labelp));
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstBreak* nodep) {
|
virtual void visit(AstBreak* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -203,7 +203,7 @@ private:
|
||||||
AstJumpLabel* labelp = findAddLabel(m_loopp, false);
|
AstJumpLabel* labelp = findAddLabel(m_loopp, false);
|
||||||
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
|
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstContinue* nodep) {
|
virtual void visit(AstContinue* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -214,7 +214,7 @@ private:
|
||||||
AstJumpLabel* labelp = findAddLabel(m_loopp, true);
|
AstJumpLabel* labelp = findAddLabel(m_loopp, true);
|
||||||
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
|
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisable* nodep) {
|
virtual void visit(AstDisable* nodep) {
|
||||||
UINFO(8," DISABLE "<<nodep<<endl);
|
UINFO(8," DISABLE "<<nodep<<endl);
|
||||||
|
|
@ -236,7 +236,7 @@ private:
|
||||||
AstJumpLabel* labelp = findAddLabel(beginp, false);
|
AstJumpLabel* labelp = findAddLabel(beginp, false);
|
||||||
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
|
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
//if (debug()>=9) { UINFO(0,"\n"); beginp->dumpTree(cout, " labelo: "); }
|
//if (debug()>=9) { UINFO(0,"\n"); beginp->dumpTree(cout, " labelo: "); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ private:
|
||||||
else addp = newp;
|
else addp = newp;
|
||||||
}
|
}
|
||||||
nodep->replaceWith(addp);
|
nodep->replaceWith(addp);
|
||||||
nodep->deleteTree();
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ private:
|
||||||
AstNode* newp = new AstParamTypeDType(nodep->fileline(),
|
AstNode* newp = new AstParamTypeDType(nodep->fileline(),
|
||||||
nodep->varType(), nodep->name(),
|
nodep->varType(), nodep->name(),
|
||||||
VFlagChildDType(), dtypep);
|
VFlagChildDType(), dtypep);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -262,63 +262,63 @@ private:
|
||||||
AstTypedef* typep = VN_CAST(nodep->backp(), Typedef);
|
AstTypedef* typep = VN_CAST(nodep->backp(), Typedef);
|
||||||
UASSERT_OBJ(typep, nodep, "Attribute not attached to typedef");
|
UASSERT_OBJ(typep, nodep, "Attribute not attached to typedef");
|
||||||
typep->attrPublic(true);
|
typep->attrPublic(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_CLOCK) {
|
else if (nodep->attrType() == AstAttrType::VAR_CLOCK) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
nodep->v3warn(DEPRECATED, "sc_clock is deprecated and will be removed");
|
nodep->v3warn(DEPRECATED, "sc_clock is deprecated and will be removed");
|
||||||
m_varp->attrScClocked(true);
|
m_varp->attrScClocked(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_CLOCK_ENABLE) {
|
else if (nodep->attrType() == AstAttrType::VAR_CLOCK_ENABLE) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->attrClockEn(true);
|
m_varp->attrClockEn(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC) {
|
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->sigUserRWPublic(true); m_varp->sigModPublic(true);
|
m_varp->sigUserRWPublic(true); m_varp->sigModPublic(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT) {
|
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->sigUserRWPublic(true);
|
m_varp->sigUserRWPublic(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT_RD) {
|
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT_RD) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->sigUserRdPublic(true);
|
m_varp->sigUserRdPublic(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT_RW) {
|
else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT_RW) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->sigUserRWPublic(true);
|
m_varp->sigUserRWPublic(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_ISOLATE_ASSIGNMENTS) {
|
else if (nodep->attrType() == AstAttrType::VAR_ISOLATE_ASSIGNMENTS) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->attrIsolateAssign(true);
|
m_varp->attrIsolateAssign(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_SFORMAT) {
|
else if (nodep->attrType() == AstAttrType::VAR_SFORMAT) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->attrSFormat(true);
|
m_varp->attrSFormat(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_SC_BV) {
|
else if (nodep->attrType() == AstAttrType::VAR_SC_BV) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->attrScBv(true);
|
m_varp->attrScBv(true);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_CLOCKER) {
|
else if (nodep->attrType() == AstAttrType::VAR_CLOCKER) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->attrClocker(VVarAttrClocker::CLOCKER_YES);
|
m_varp->attrClocker(VVarAttrClocker::CLOCKER_YES);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->attrType() == AstAttrType::VAR_NO_CLOCKER) {
|
else if (nodep->attrType() == AstAttrType::VAR_NO_CLOCKER) {
|
||||||
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
|
||||||
m_varp->attrClocker(VVarAttrClocker::CLOCKER_NO);
|
m_varp->attrClocker(VVarAttrClocker::CLOCKER_NO);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,7 +363,7 @@ private:
|
||||||
if (VN_IS(backp, Typedef)) { // A typedef doesn't need us to make yet another level of typedefing
|
if (VN_IS(backp, Typedef)) { // A typedef doesn't need us to make yet another level of typedefing
|
||||||
// For typedefs just remove the AstRefDType level of abstraction
|
// For typedefs just remove the AstRefDType level of abstraction
|
||||||
nodep->replaceWith(dtypep);
|
nodep->replaceWith(dtypep);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
defp = new AstTypedef(nodep->fileline(), nodep->name(), NULL,
|
defp = new AstTypedef(nodep->fileline(), nodep->name(), NULL,
|
||||||
|
|
@ -373,14 +373,14 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodep->replaceWith(new AstRefDType(nodep->fileline(), defp->name()));
|
nodep->replaceWith(new AstRefDType(nodep->fileline(), defp->name()));
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstTypedefFwd* nodep) {
|
virtual void visit(AstTypedefFwd* nodep) {
|
||||||
// We only needed the forward declaration in order to parse correctly.
|
// We only needed the forward declaration in order to parse correctly.
|
||||||
// We won't even check it was ever really defined, as it might have been in a header
|
// We won't even check it was ever really defined, as it might have been in a header
|
||||||
// file referring to a module we never needed
|
// file referring to a module we never needed
|
||||||
nodep->unlinkFrBack()->deleteTree();
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstForeach* nodep) {
|
virtual void visit(AstForeach* nodep) {
|
||||||
|
|
@ -439,8 +439,8 @@ private:
|
||||||
dimension--;
|
dimension--;
|
||||||
}
|
}
|
||||||
//newp->dumpTree(cout, "-foreach-new:");
|
//newp->dumpTree(cout, "-foreach-new:");
|
||||||
firstVarsp->deleteTree(); VL_DANGLING(firstVarsp);
|
VL_DO_DANGLING(firstVarsp->deleteTree(), firstVarsp);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ private:
|
||||||
// Initial assignments under function/tasks can just be simple
|
// Initial assignments under function/tasks can just be simple
|
||||||
// assignments without the initial
|
// assignments without the initial
|
||||||
if (m_ftaskp) {
|
if (m_ftaskp) {
|
||||||
nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCoverOrAssert* nodep) {
|
virtual void visit(AstNodeCoverOrAssert* nodep) {
|
||||||
|
|
@ -167,18 +167,18 @@ private:
|
||||||
did = 0;
|
did = 0;
|
||||||
if (AstNodeSel* selp = VN_CAST(nodep->sensp(), NodeSel)) {
|
if (AstNodeSel* selp = VN_CAST(nodep->sensp(), NodeSel)) {
|
||||||
AstNode* fromp = selp->fromp()->unlinkFrBack();
|
AstNode* fromp = selp->fromp()->unlinkFrBack();
|
||||||
selp->replaceWith(fromp); selp->deleteTree(); VL_DANGLING(selp);
|
selp->replaceWith(fromp); VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||||
did = 1;
|
did = 1;
|
||||||
}
|
}
|
||||||
// NodeSel doesn't include AstSel....
|
// NodeSel doesn't include AstSel....
|
||||||
if (AstSel* selp = VN_CAST(nodep->sensp(), Sel)) {
|
if (AstSel* selp = VN_CAST(nodep->sensp(), Sel)) {
|
||||||
AstNode* fromp = selp->fromp()->unlinkFrBack();
|
AstNode* fromp = selp->fromp()->unlinkFrBack();
|
||||||
selp->replaceWith(fromp); selp->deleteTree(); VL_DANGLING(selp);
|
selp->replaceWith(fromp); VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||||
did = 1;
|
did = 1;
|
||||||
}
|
}
|
||||||
if (AstNodePreSel* selp = VN_CAST(nodep->sensp(), NodePreSel)) {
|
if (AstNodePreSel* selp = VN_CAST(nodep->sensp(), NodePreSel)) {
|
||||||
AstNode* fromp = selp->lhsp()->unlinkFrBack();
|
AstNode* fromp = selp->lhsp()->unlinkFrBack();
|
||||||
selp->replaceWith(fromp); selp->deleteTree(); VL_DANGLING(selp);
|
selp->replaceWith(fromp); VL_DO_DANGLING(selp->deleteTree(), selp);
|
||||||
did = 1;
|
did = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -242,17 +242,17 @@ private:
|
||||||
if (nodep->pragType() == AstPragmaType::PUBLIC_MODULE) {
|
if (nodep->pragType() == AstPragmaType::PUBLIC_MODULE) {
|
||||||
UASSERT_OBJ(m_modp, nodep, "PUBLIC_MODULE not under a module");
|
UASSERT_OBJ(m_modp, nodep, "PUBLIC_MODULE not under a module");
|
||||||
m_modp->modPublic(true);
|
m_modp->modPublic(true);
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->pragType() == AstPragmaType::PUBLIC_TASK) {
|
else if (nodep->pragType() == AstPragmaType::PUBLIC_TASK) {
|
||||||
UASSERT_OBJ(m_ftaskp, nodep, "PUBLIC_TASK not under a task");
|
UASSERT_OBJ(m_ftaskp, nodep, "PUBLIC_TASK not under a task");
|
||||||
m_ftaskp->taskPublic(true);
|
m_ftaskp->taskPublic(true);
|
||||||
m_modp->modPublic(true); // Need to get to the task...
|
m_modp->modPublic(true); // Need to get to the task...
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
|
else if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
|
||||||
if (!v3Global.opt.coverageLine()) { // No need for block statements; may optimize better without
|
if (!v3Global.opt.coverageLine()) { // No need for block statements; may optimize better without
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -343,7 +343,7 @@ private:
|
||||||
}
|
}
|
||||||
newFormat.append(str);
|
newFormat.append(str);
|
||||||
AstNode *nextp = argp->nextp();
|
AstNode *nextp = argp->nextp();
|
||||||
argp->unlinkFrBack(); pushDeletep(argp); VL_DANGLING(argp);
|
argp->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(argp), argp);
|
||||||
argp = nextp;
|
argp = nextp;
|
||||||
} else {
|
} else {
|
||||||
newFormat.append("%?"); // V3Width to figure it out
|
newFormat.append("%?"); // V3Width to figure it out
|
||||||
|
|
@ -392,7 +392,7 @@ private:
|
||||||
&& VN_CAST(nodep->exprsp(), Const)->num().isFromString()) {
|
&& VN_CAST(nodep->exprsp(), Const)->num().isFromString()) {
|
||||||
AstConst* fmtp = VN_CAST(nodep->exprsp()->unlinkFrBack(), Const);
|
AstConst* fmtp = VN_CAST(nodep->exprsp()->unlinkFrBack(), Const);
|
||||||
nodep->text(fmtp->num().toString());
|
nodep->text(fmtp->num().toString());
|
||||||
pushDeletep(fmtp); VL_DANGLING(fmtp);
|
VL_DO_DANGLING(pushDeletep(fmtp), fmtp);
|
||||||
}
|
}
|
||||||
nodep->hasFormat(true);
|
nodep->hasFormat(true);
|
||||||
}
|
}
|
||||||
|
|
@ -432,7 +432,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1576,7 +1576,7 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) {
|
||||||
domainp->dumpTree(cout);
|
domainp->dumpTree(cout);
|
||||||
cout<<endl;
|
cout<<endl;
|
||||||
}
|
}
|
||||||
newtreep->deleteTree(); VL_DANGLING(newtreep);
|
VL_DO_DANGLING(newtreep->deleteTree(), newtreep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // next input edgep
|
} // next input edgep
|
||||||
|
|
@ -1747,7 +1747,7 @@ void OrderVisitor::processMoveDoneOne(OrderMoveVertex* vertexp) {
|
||||||
UINFO(9," Clear to "<<(toVertexp->inEmpty()?"[EMP] ":" ")
|
UINFO(9," Clear to "<<(toVertexp->inEmpty()?"[EMP] ":" ")
|
||||||
<<toVertexp<<endl);
|
<<toVertexp<<endl);
|
||||||
// Delete this edge
|
// Delete this edge
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
if (toVertexp->inEmpty()) {
|
if (toVertexp->inEmpty()) {
|
||||||
// If destination node now has all inputs resolved; recurse to move that vertex
|
// If destination node now has all inputs resolved; recurse to move that vertex
|
||||||
// This is thus depth first (before width) which keeps the
|
// This is thus depth first (before width) which keeps the
|
||||||
|
|
@ -1811,7 +1811,7 @@ AstActive* OrderVisitor::processMoveOneLogic(const OrderLogicVertex* lvertexp,
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
if (domainp == m_deleteDomainp) {
|
if (domainp == m_deleteDomainp) {
|
||||||
UINFO(4," Ordering deleting pre-settled "<<nodep<<endl);
|
UINFO(4," Ordering deleting pre-settled "<<nodep<<endl);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else {
|
} else {
|
||||||
newFuncpr->addStmtsp(nodep);
|
newFuncpr->addStmtsp(nodep);
|
||||||
if (v3Global.opt.outputSplitCFuncs()) {
|
if (v3Global.opt.outputSplitCFuncs()) {
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ private:
|
||||||
AstCell* cellp = *it;
|
AstCell* cellp = *it;
|
||||||
if (string* genHierNamep = (string *) cellp->user5p()) {
|
if (string* genHierNamep = (string *) cellp->user5p()) {
|
||||||
cellp->user5p(NULL);
|
cellp->user5p(NULL);
|
||||||
delete genHierNamep; VL_DANGLING(genHierNamep);
|
VL_DO_DANGLING(delete genHierNamep, genHierNamep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_cellps.clear();
|
m_cellps.clear();
|
||||||
|
|
@ -335,7 +335,7 @@ private:
|
||||||
} else if (AstPin* pinp = VN_CAST(candp, Pin)) {
|
} else if (AstPin* pinp = VN_CAST(candp, Pin)) {
|
||||||
UINFO(9,"Found interface parameter: "<<pinp<<endl);
|
UINFO(9,"Found interface parameter: "<<pinp<<endl);
|
||||||
UASSERT_OBJ(pinp->exprp(), pinp, "Interface parameter pin missing expression");
|
UASSERT_OBJ(pinp->exprp(), pinp, "Interface parameter pin missing expression");
|
||||||
nodep->replaceWith(pinp->exprp()->cloneTree(false)); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->replaceWith(pinp->exprp()->cloneTree(false)), nodep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -401,7 +401,7 @@ private:
|
||||||
taskrefp->dotted(m_unlinkedTxt);
|
taskrefp->dotted(m_unlinkedTxt);
|
||||||
}
|
}
|
||||||
nodep->replaceWith(nodep->op1p()->unlinkFrBack());
|
nodep->replaceWith(nodep->op1p()->unlinkFrBack());
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellArrayRef* nodep) {
|
virtual void visit(AstCellArrayRef* nodep) {
|
||||||
V3Const::constifyParamsEdit(nodep->selp());
|
V3Const::constifyParamsEdit(nodep->selp());
|
||||||
|
|
@ -436,7 +436,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenIf* nodep) {
|
virtual void visit(AstGenIf* nodep) {
|
||||||
UINFO(9," GENIF "<<nodep<<endl);
|
UINFO(9," GENIF "<<nodep<<endl);
|
||||||
|
|
@ -457,7 +457,7 @@ private:
|
||||||
} else {
|
} else {
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
// Normal edit rules will now recurse the replacement
|
// Normal edit rules will now recurse the replacement
|
||||||
} else {
|
} else {
|
||||||
nodep->condp()->v3error("Generate If condition must evaluate to constant");
|
nodep->condp()->v3error("Generate If condition must evaluate to constant");
|
||||||
|
|
@ -486,7 +486,7 @@ private:
|
||||||
// Note V3Unroll will replace some AstVarRef's to the loop variable with constants
|
// Note V3Unroll will replace some AstVarRef's to the loop variable with constants
|
||||||
// Don't remove any deleted nodes in m_unroller until whole process finishes,
|
// Don't remove any deleted nodes in m_unroller until whole process finishes,
|
||||||
// (are held in m_unroller), as some AstXRefs may still point to old nodes.
|
// (are held in m_unroller), as some AstXRefs may still point to old nodes.
|
||||||
m_unroller.unrollGen(forp, beginName); VL_DANGLING(forp);
|
VL_DO_DANGLING(m_unroller.unrollGen(forp, beginName), forp);
|
||||||
// Blocks were constructed under the special begin, move them up
|
// Blocks were constructed under the special begin, move them up
|
||||||
// Note forp is null, so grab statements again
|
// Note forp is null, so grab statements again
|
||||||
if (AstNode* stmtsp = nodep->genforp()) {
|
if (AstNode* stmtsp = nodep->genforp()) {
|
||||||
|
|
@ -519,7 +519,7 @@ private:
|
||||||
for (AstNode* ep = itemp->condsp(); ep; ) {
|
for (AstNode* ep = itemp->condsp(); ep; ) {
|
||||||
AstNode* nextp = ep->nextp(); // May edit list
|
AstNode* nextp = ep->nextp(); // May edit list
|
||||||
iterateAndNextNull(ep);
|
iterateAndNextNull(ep);
|
||||||
V3Const::constifyParamsEdit(ep); VL_DANGLING(ep); // ep may change
|
VL_DO_DANGLING(V3Const::constifyParamsEdit(ep), ep); // ep may change
|
||||||
ep = nextp;
|
ep = nextp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -553,7 +553,7 @@ private:
|
||||||
nodep->replaceWith(keepp);
|
nodep->replaceWith(keepp);
|
||||||
}
|
}
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ AstRange* V3ParseGrammar::scrubRange(AstNodeRange* nrangep) {
|
||||||
nextp = VN_CAST(nodep->nextp(), NodeRange);
|
nextp = VN_CAST(nodep->nextp(), NodeRange);
|
||||||
if (!VN_IS(nodep, Range)) {
|
if (!VN_IS(nodep, Range)) {
|
||||||
nodep->v3error("Unsupported or syntax error: Unsized range in cell or other declaration");
|
nodep->v3error("Unsupported or syntax error: Unsized range in cell or other declaration");
|
||||||
nodep->unlinkFrBack(); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nrangep && nrangep->nextp()) {
|
if (nrangep && nrangep->nextp()) {
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ double V3ParseImp::parseDouble(const char* textp, size_t length, bool* successp)
|
||||||
if (successp) *successp = false;
|
if (successp) *successp = false;
|
||||||
else yyerrorf("Syntax error parsing real: %s", strgp);
|
else yyerrorf("Syntax error parsing real: %s", strgp);
|
||||||
}
|
}
|
||||||
delete[] strgp;
|
VL_DO_DANGLING(delete[] strgp, strgp);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i
|
||||||
preprocDumps(*osp);
|
preprocDumps(*osp);
|
||||||
if (ofp) {
|
if (ofp) {
|
||||||
ofp->close();
|
ofp->close();
|
||||||
delete ofp; VL_DANGLING(ofp);
|
VL_DO_DANGLING(delete ofp, ofp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1041,7 +1041,7 @@ static void partCheckCriticalPaths(V3Graph* mtasksp) {
|
||||||
// Advance to nextp(way) and delete edge
|
// Advance to nextp(way) and delete edge
|
||||||
static V3GraphEdge* partBlastEdgep(GraphWay way, V3GraphEdge* edgep) {
|
static V3GraphEdge* partBlastEdgep(GraphWay way, V3GraphEdge* edgep) {
|
||||||
V3GraphEdge* nextp = edgep->nextp(way);
|
V3GraphEdge* nextp = edgep->nextp(way);
|
||||||
edgep->unlinkDelete(); VL_DANGLING(edgep);
|
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
|
||||||
return nextp;
|
return nextp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1965,7 +1965,7 @@ private:
|
||||||
// Move edges from donorp to recipientp
|
// Move edges from donorp to recipientp
|
||||||
partMergeEdgesFrom(m_mtasksp, mergedp, donorp, NULL);
|
partMergeEdgesFrom(m_mtasksp, mergedp, donorp, NULL);
|
||||||
// Remove donorp from the graph
|
// Remove donorp from the graph
|
||||||
donorp->unlinkDelete(m_mtasksp); VL_DANGLING(donorp);
|
VL_DO_DANGLING(donorp->unlinkDelete(m_mtasksp), donorp);
|
||||||
m_mergesDone++;
|
m_mergesDone++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2697,10 +2697,10 @@ void V3Partition::finalizeCosts(V3Graph* execMTaskGraphp) {
|
||||||
outp->top(), 1);
|
outp->top(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mtp->unlinkDelete(execMTaskGraphp); VL_DANGLING(mtp);
|
VL_DO_DANGLING(mtp->unlinkDelete(execMTaskGraphp), mtp);
|
||||||
// Also remove and delete the AstMTaskBody, otherwise it would
|
// Also remove and delete the AstMTaskBody, otherwise it would
|
||||||
// keep a dangling pointer to the ExecMTask.
|
// keep a dangling pointer to the ExecMTask.
|
||||||
bodyp->unlinkFrBack()->deleteTree(); VL_DANGLING(bodyp);
|
VL_DO_DANGLING(bodyp->unlinkFrBack()->deleteTree(), bodyp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1175,7 +1175,7 @@ int V3PreProcImp::getStateToken() {
|
||||||
out = defineSubst(refp);
|
out = defineSubst(refp);
|
||||||
//NOP: out = m_preprocp->defSubstitute(out);
|
//NOP: out = m_preprocp->defSubstitute(out);
|
||||||
}
|
}
|
||||||
m_defRefs.pop(); VL_DANGLING(refp);
|
VL_DO_DANGLING(m_defRefs.pop(), refp);
|
||||||
if (m_defRefs.empty()) {
|
if (m_defRefs.empty()) {
|
||||||
statePop();
|
statePop();
|
||||||
if (state() == ps_JOIN) { // Handle {left}```FOO(ARG) where `FOO(ARG) might be empty
|
if (state() == ps_JOIN) { // Handle {left}```FOO(ARG) where `FOO(ARG) might be empty
|
||||||
|
|
|
||||||
|
|
@ -120,11 +120,11 @@ private:
|
||||||
// Replace constant index with new loop index
|
// Replace constant index with new loop index
|
||||||
AstNode* lbitp = m_mgSelLp->bitp();
|
AstNode* lbitp = m_mgSelLp->bitp();
|
||||||
lbitp->replaceWith(new AstVarRef(fl, itp, false));
|
lbitp->replaceWith(new AstVarRef(fl, itp, false));
|
||||||
lbitp->deleteTree(); VL_DANGLING(lbitp);
|
VL_DO_DANGLING(lbitp->deleteTree(), lbitp);
|
||||||
if (m_mgSelRp) { // else constant and no replace
|
if (m_mgSelRp) { // else constant and no replace
|
||||||
AstNode* rbitp = m_mgSelRp->bitp();
|
AstNode* rbitp = m_mgSelRp->bitp();
|
||||||
rbitp->replaceWith(new AstVarRef(fl, itp, false));
|
rbitp->replaceWith(new AstVarRef(fl, itp, false));
|
||||||
rbitp->deleteTree(); VL_DANGLING(lbitp);
|
VL_DO_DANGLING(rbitp->deleteTree(), lbitp);
|
||||||
}
|
}
|
||||||
if (debug()>=9) initp->dumpTree(cout, "-new: ");
|
if (debug()>=9) initp->dumpTree(cout, "-new: ");
|
||||||
if (debug()>=9) whilep->dumpTree(cout, "-new: ");
|
if (debug()>=9) whilep->dumpTree(cout, "-new: ");
|
||||||
|
|
@ -133,7 +133,7 @@ private:
|
||||||
for (AssVec::iterator it=m_mgAssignps.begin(); it!=m_mgAssignps.end(); ++it) {
|
for (AssVec::iterator it=m_mgAssignps.begin(); it!=m_mgAssignps.end(); ++it) {
|
||||||
AstNodeAssign* assp = *it;
|
AstNodeAssign* assp = *it;
|
||||||
if (assp != bodyp) {
|
if (assp != bodyp) {
|
||||||
assp->unlinkFrBack()->deleteTree(); VL_DANGLING(assp);
|
VL_DO_DANGLING(assp->unlinkFrBack()->deleteTree(), assp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ private:
|
||||||
// A block that was just moved under a scope, Kill it.
|
// A block that was just moved under a scope, Kill it.
|
||||||
// Certain nodes can be referenced later in this pass, notably
|
// Certain nodes can be referenced later in this pass, notably
|
||||||
// an FTaskRef needs to access the FTask to find the cloned task
|
// an FTaskRef needs to access the FTask to find the cloned task
|
||||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
newlistp = AstNode::addNextNull(newlistp, newp);
|
newlistp = AstNode::addNextNull(newlistp, newp);
|
||||||
}
|
}
|
||||||
if (debug()>=9) { cout<<endl; nodep->dumpTree(cout, " Deslice-Dn: "); }
|
if (debug()>=9) { cout<<endl; nodep->dumpTree(cout, " Deslice-Dn: "); }
|
||||||
nodep->replaceWith(newlistp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newlistp); 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
|
||||||
// This will potentially call this function again to resolve next level of slicing
|
// This will potentially call this function again to resolve next level of slicing
|
||||||
return;
|
return;
|
||||||
|
|
@ -209,7 +209,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
UASSERT_OBJ(logp, nodep, "Unpacked array with empty indices range");
|
UASSERT_OBJ(logp, nodep, "Unpacked array with empty indices range");
|
||||||
nodep->replaceWith(logp);
|
nodep->replaceWith(logp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
nodep = logp;
|
nodep = logp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -825,7 +825,7 @@ public:
|
||||||
it != m_removeSet.end(); ++it) {
|
it != m_removeSet.end(); ++it) {
|
||||||
AstNode* np = *it;
|
AstNode* np = *it;
|
||||||
np->unlinkFrBack(); // Without next
|
np->unlinkFrBack(); // Without next
|
||||||
np->deleteTree(); VL_DANGLING(np);
|
VL_DO_DANGLING(np->deleteTree(), np);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual ~RemovePlaceholdersVisitor() {}
|
virtual ~RemovePlaceholdersVisitor() {}
|
||||||
|
|
@ -868,7 +868,7 @@ public:
|
||||||
RemovePlaceholdersVisitor removePlaceholders(*addme);
|
RemovePlaceholdersVisitor removePlaceholders(*addme);
|
||||||
}
|
}
|
||||||
origp->unlinkFrBack(); // Without next
|
origp->unlinkFrBack(); // Without next
|
||||||
origp->deleteTree(); VL_DANGLING(origp);
|
VL_DO_DANGLING(origp->deleteTree(), origp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -248,5 +248,6 @@ void V3Stats::statsReport() {
|
||||||
StatsReport reporter (ofp);
|
StatsReport reporter (ofp);
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ofp->close(); delete ofp; VL_DANGLING(ofp);
|
ofp->close();
|
||||||
|
VL_DO_DANGLING(delete ofp, ofp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ public:
|
||||||
}
|
}
|
||||||
void deleteAssign(AstNodeAssign* nodep) {
|
void deleteAssign(AstNodeAssign* nodep) {
|
||||||
UINFO(5, "Delete "<<nodep<<endl);
|
UINFO(5, "Delete "<<nodep<<endl);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
void deleteUnusedAssign() {
|
void deleteUnusedAssign() {
|
||||||
// If there are unused assignments in this var, kill them
|
// If there are unused assignments in this var, kill them
|
||||||
|
|
@ -308,7 +308,7 @@ private:
|
||||||
}
|
}
|
||||||
if (debug()>5) newp->dumpTree(cout, " w_new: ");
|
if (debug()>5) newp->dumpTree(cout, " w_new: ");
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
++m_statSubsts;
|
++m_statSubsts;
|
||||||
}
|
}
|
||||||
virtual void visit(AstWordSel* nodep) {
|
virtual void visit(AstWordSel* nodep) {
|
||||||
|
|
@ -327,7 +327,7 @@ private:
|
||||||
// Check that the RHS hasn't changed value since we recorded it.
|
// Check that the RHS hasn't changed value since we recorded it.
|
||||||
SubstUseVisitor visitor (substp, entryp->getWordStep(word));
|
SubstUseVisitor visitor (substp, entryp->getWordStep(word));
|
||||||
if (visitor.ok()) {
|
if (visitor.ok()) {
|
||||||
replaceSubstEtc(nodep, substp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceSubstEtc(nodep, substp), nodep);
|
||||||
} else {
|
} else {
|
||||||
entryp->consumeWord(word);
|
entryp->consumeWord(word);
|
||||||
}
|
}
|
||||||
|
|
@ -355,7 +355,7 @@ private:
|
||||||
SubstUseVisitor visitor (substp, entryp->getWholeStep());
|
SubstUseVisitor visitor (substp, entryp->getWholeStep());
|
||||||
if (visitor.ok()) {
|
if (visitor.ok()) {
|
||||||
UINFO(8," USEwhole "<<nodep<<endl);
|
UINFO(8," USEwhole "<<nodep<<endl);
|
||||||
replaceSubstEtc(nodep, substp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceSubstEtc(nodep, substp), nodep);
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," USEwholeButChg "<<nodep<<endl);
|
UINFO(8," USEwholeButChg "<<nodep<<endl);
|
||||||
entryp->consumeWhole();
|
entryp->consumeWhole();
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ private:
|
||||||
const AstNode* init2p = VN_CAST(var2p->valuep(), InitArray);
|
const AstNode* init2p = VN_CAST(var2p->valuep(), InitArray);
|
||||||
if (init1p->sameGateTree(init2p)) {
|
if (init1p->sameGateTree(init2p)) {
|
||||||
UINFO(8," Duplicate table var "<<vsc2p<<" == "<<vsc1p<<endl);
|
UINFO(8," Duplicate table var "<<vsc2p<<" == "<<vsc1p<<endl);
|
||||||
vsc1p->unlinkFrBack()->deleteTree();
|
VL_DO_DANGLING(vsc1p->unlinkFrBack()->deleteTree(), vsc1p);
|
||||||
return vsc2p;
|
return vsc2p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +443,7 @@ private:
|
||||||
UINFO(4," ALWAYS "<<nodep<<endl);
|
UINFO(4," ALWAYS "<<nodep<<endl);
|
||||||
if (treeTest(nodep)) {
|
if (treeTest(nodep)) {
|
||||||
// Well, then, I'll be a memory hog.
|
// Well, then, I'll be a memory hog.
|
||||||
createTable(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(createTable(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep) {}
|
virtual void visit(AstAssignAlias* nodep) {}
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ private:
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
m_assignwp = nodep;
|
m_assignwp = nodep;
|
||||||
iterateChildren(nodep); VL_DANGLING(nodep); // May delete nodep.
|
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
|
||||||
m_assignwp = NULL;
|
m_assignwp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
|
|
@ -213,7 +213,7 @@ private:
|
||||||
if (nodep->pragType() == AstPragmaType::NO_INLINE_TASK) {
|
if (nodep->pragType() == AstPragmaType::NO_INLINE_TASK) {
|
||||||
// Just mark for the next steps, and we're done with it.
|
// Just mark for the next steps, and we're done with it.
|
||||||
m_curVxp->noInline(true);
|
m_curVxp->noInline(true);
|
||||||
nodep->unlinkFrBack()->deleteTree();
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -383,7 +383,7 @@ private:
|
||||||
UINFO(9, " Port "<<portp<<endl);
|
UINFO(9, " Port "<<portp<<endl);
|
||||||
UINFO(9, " pin "<<pinp<<endl);
|
UINFO(9, " pin "<<pinp<<endl);
|
||||||
pinp->unlinkFrBack(); // Relinked to assignment below
|
pinp->unlinkFrBack(); // Relinked to assignment below
|
||||||
argp->unlinkFrBack()->deleteTree(); // Args no longer needed
|
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp); // Args no longer needed
|
||||||
//
|
//
|
||||||
if (portp->isWritable() && VN_IS(pinp, Const)) {
|
if (portp->isWritable() && VN_IS(pinp, Const)) {
|
||||||
pinp->v3error("Function/task "
|
pinp->v3error("Function/task "
|
||||||
|
|
@ -470,7 +470,7 @@ private:
|
||||||
{
|
{
|
||||||
AstBegin* tempp = new AstBegin(beginp->fileline(), "[EditWrapper]", beginp);
|
AstBegin* tempp = new AstBegin(beginp->fileline(), "[EditWrapper]", beginp);
|
||||||
TaskRelinkVisitor visit (tempp);
|
TaskRelinkVisitor visit (tempp);
|
||||||
tempp->stmtsp()->unlinkFrBackWithNext(); tempp->deleteTree(); VL_DANGLING(tempp);
|
tempp->stmtsp()->unlinkFrBackWithNext(); VL_DO_DANGLING(tempp->deleteTree(), tempp);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (debug()>=9) { beginp->dumpTreeAndNext(cout, "-iotask: "); }
|
if (debug()>=9) { beginp->dumpTreeAndNext(cout, "-iotask: "); }
|
||||||
|
|
@ -953,7 +953,7 @@ private:
|
||||||
}
|
}
|
||||||
if (nodep->dpiOpenParent()) {
|
if (nodep->dpiOpenParent()) {
|
||||||
// No need to make more than just the c prototype, children will
|
// No need to make more than just the c prototype, children will
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1073,10 +1073,10 @@ private:
|
||||||
{
|
{
|
||||||
AstBegin* tempp = new AstBegin(cfuncp->fileline(), "[EditWrapper]", cfuncp);
|
AstBegin* tempp = new AstBegin(cfuncp->fileline(), "[EditWrapper]", cfuncp);
|
||||||
TaskRelinkVisitor visit (tempp);
|
TaskRelinkVisitor visit (tempp);
|
||||||
tempp->stmtsp()->unlinkFrBackWithNext(); tempp->deleteTree(); VL_DANGLING(tempp);
|
tempp->stmtsp()->unlinkFrBackWithNext(); VL_DO_DANGLING(tempp->deleteTree(), tempp);
|
||||||
}
|
}
|
||||||
// Delete rest of cloned task and return new func
|
// Delete rest of cloned task and return new func
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
if (debug()>=9) { cfuncp->dumpTree(cout, "-userFunc: "); }
|
if (debug()>=9) { cfuncp->dumpTree(cout, "-userFunc: "); }
|
||||||
return cfuncp;
|
return cfuncp;
|
||||||
}
|
}
|
||||||
|
|
@ -1183,7 +1183,7 @@ private:
|
||||||
nodep->replaceWith(beginp);
|
nodep->replaceWith(beginp);
|
||||||
}
|
}
|
||||||
// Cleanup
|
// Cleanup
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
UINFO(4," FTask REF Done.\n");
|
UINFO(4," FTask REF Done.\n");
|
||||||
// Visit nodes that normal iteration won't find
|
// Visit nodes that normal iteration won't find
|
||||||
if (visitp) iterateAndNextNull(visitp);
|
if (visitp) iterateAndNextNull(visitp);
|
||||||
|
|
@ -1230,7 +1230,7 @@ private:
|
||||||
if (AstVar* portp = VN_CAST(nodep->fvarp(), Var)) {
|
if (AstVar* portp = VN_CAST(nodep->fvarp(), Var)) {
|
||||||
AstVarScope* vscp = m_statep->findVarScope(m_scopep, portp);
|
AstVarScope* vscp = m_statep->findVarScope(m_scopep, portp);
|
||||||
UINFO(9," funcremovevsc "<<vscp<<endl);
|
UINFO(9," funcremovevsc "<<vscp<<endl);
|
||||||
pushDeletep(vscp->unlinkFrBack()); VL_DANGLING(vscp);
|
VL_DO_DANGLING(pushDeletep(vscp->unlinkFrBack()), vscp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (AstNode* nextp, *stmtp = nodep->stmtsp(); stmtp; stmtp = nextp) {
|
for (AstNode* nextp, *stmtp = nodep->stmtsp(); stmtp; stmtp = nextp) {
|
||||||
|
|
@ -1238,13 +1238,13 @@ private:
|
||||||
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
||||||
AstVarScope* vscp = m_statep->findVarScope(m_scopep, portp);
|
AstVarScope* vscp = m_statep->findVarScope(m_scopep, portp);
|
||||||
UINFO(9," funcremovevsc "<<vscp<<endl);
|
UINFO(9," funcremovevsc "<<vscp<<endl);
|
||||||
pushDeletep(vscp->unlinkFrBack()); VL_DANGLING(vscp);
|
VL_DO_DANGLING(pushDeletep(vscp->unlinkFrBack()), vscp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Just push for deletion, as other references to func may
|
// Just push for deletion, as other references to func may
|
||||||
// remain until visitor exits
|
// remain until visitor exits
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
m_insMode = prevInsMode;
|
m_insMode = prevInsMode;
|
||||||
m_insStmtp = prevInsStmtp;
|
m_insStmtp = prevInsStmtp;
|
||||||
|
|
@ -1347,7 +1347,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
|
||||||
pinp->v3error("No such argument "<<argp->prettyNameQ()
|
pinp->v3error("No such argument "<<argp->prettyNameQ()
|
||||||
<<" in function call to "<<nodep->taskp()->prettyTypeName());
|
<<" in function call to "<<nodep->taskp()->prettyTypeName());
|
||||||
// We'll just delete it; seems less error prone than making a false argument
|
// We'll just delete it; seems less error prone than making a false argument
|
||||||
pinp->unlinkFrBack()->deleteTree(); VL_DANGLING(pinp);
|
VL_DO_DANGLING(pinp->unlinkFrBack()->deleteTree(), pinp);
|
||||||
} else {
|
} else {
|
||||||
if (tconnects[it->second].second) {
|
if (tconnects[it->second].second) {
|
||||||
pinp->v3error("Duplicate argument "<<argp->prettyNameQ()
|
pinp->v3error("Duplicate argument "<<argp->prettyNameQ()
|
||||||
|
|
@ -1367,7 +1367,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
|
||||||
pinp->v3error("Too many arguments in function call to "
|
pinp->v3error("Too many arguments in function call to "
|
||||||
<<nodep->taskp()->prettyTypeName());
|
<<nodep->taskp()->prettyTypeName());
|
||||||
// We'll just delete it; seems less error prone than making a false argument
|
// We'll just delete it; seems less error prone than making a false argument
|
||||||
pinp->unlinkFrBack()->deleteTree(); VL_DANGLING(pinp);
|
VL_DO_DANGLING(pinp->unlinkFrBack()->deleteTree(), pinp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tconnects[ppinnum].second = argp;
|
tconnects[ppinnum].second = argp;
|
||||||
|
|
|
||||||
|
|
@ -587,7 +587,7 @@ private:
|
||||||
m_fullSubStmts += EmitCBaseCounterVisitor(nodep).count();
|
m_fullSubStmts += EmitCBaseCounterVisitor(nodep).count();
|
||||||
} else {
|
} else {
|
||||||
// Duplicates don't need a TraceInc
|
// Duplicates don't need a TraceInc
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
return incAddp;
|
return incAddp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -429,9 +429,9 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
VarMap::iterator it = m_lhsmap.find(key);
|
VarMap::iterator it = m_lhsmap.find(key);
|
||||||
UINFO(9," mapInsertLhsVarRef "<<nodep<<endl);
|
UINFO(9," mapInsertLhsVarRef "<<nodep<<endl);
|
||||||
if (it == m_lhsmap.end()) { // Not found
|
if (it == m_lhsmap.end()) { // Not found
|
||||||
RefVec* refs = new RefVec();
|
RefVec* refsp = new RefVec();
|
||||||
refs->push_back(nodep);
|
refsp->push_back(nodep);
|
||||||
m_lhsmap.insert(make_pair(key, refs));
|
m_lhsmap.insert(make_pair(key, refsp));
|
||||||
} else {
|
} else {
|
||||||
it->second->push_back(nodep);
|
it->second->push_back(nodep);
|
||||||
}
|
}
|
||||||
|
|
@ -512,14 +512,14 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
for (VarMap::iterator nextit, it = m_lhsmap.begin(); it != m_lhsmap.end(); it = nextit) {
|
for (VarMap::iterator nextit, it = m_lhsmap.begin(); it != m_lhsmap.end(); it = nextit) {
|
||||||
nextit = it; ++nextit;
|
nextit = it; ++nextit;
|
||||||
AstVar* invarp = it->first;
|
AstVar* invarp = it->first;
|
||||||
RefVec* refs = it->second;
|
RefVec* refsp = it->second;
|
||||||
|
|
||||||
// Figure out if this var needs tristate expanded.
|
// Figure out if this var needs tristate expanded.
|
||||||
if (!m_tgraph.isTristate(invarp)) {
|
if (!m_tgraph.isTristate(invarp)) {
|
||||||
// This var has no tristate logic, so we leave it alone.
|
// This var has no tristate logic, so we leave it alone.
|
||||||
UINFO(8, " NO TRISTATE ON:" << invarp << endl);
|
UINFO(8, " NO TRISTATE ON:" << invarp << endl);
|
||||||
m_lhsmap.erase(invarp);
|
m_lhsmap.erase(invarp);
|
||||||
delete refs;
|
VL_DO_DANGLING(delete refsp, refsp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -559,7 +559,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
AstNode* undrivenp = NULL;
|
AstNode* undrivenp = NULL;
|
||||||
|
|
||||||
// loop through the lhs drivers to build the driver resolution logic
|
// loop through the lhs drivers to build the driver resolution logic
|
||||||
for (RefVec::iterator ii=refs->begin(); ii != refs->end(); ++ii) {
|
for (RefVec::iterator ii = refsp->begin(); ii != refsp->end(); ++ii) {
|
||||||
AstVarRef* refp = (*ii);
|
AstVarRef* refp = (*ii);
|
||||||
int w = lhsp->width();
|
int w = lhsp->width();
|
||||||
|
|
||||||
|
|
@ -623,7 +623,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
new AstConst(invarp->fileline(), pull));
|
new AstConst(invarp->fileline(), pull));
|
||||||
orp = new AstOr(invarp->fileline(), orp, undrivenp);
|
orp = new AstOr(invarp->fileline(), orp, undrivenp);
|
||||||
} else {
|
} else {
|
||||||
undrivenp->deleteTree(); VL_DANGLING(undrivenp);
|
VL_DO_DANGLING(undrivenp->deleteTree(), undrivenp);
|
||||||
}
|
}
|
||||||
if (envarp) {
|
if (envarp) {
|
||||||
nodep->addStmtp(new AstAssignW(enp->fileline(),
|
nodep->addStmtp(new AstAssignW(enp->fileline(),
|
||||||
|
|
@ -641,7 +641,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
nodep->addStmtp(assp);
|
nodep->addStmtp(assp);
|
||||||
// Delete the map and vector list now that we have expanded it.
|
// Delete the map and vector list now that we have expanded it.
|
||||||
m_lhsmap.erase(invarp);
|
m_lhsmap.erase(invarp);
|
||||||
delete refs;
|
VL_DO_DANGLING(delete refsp, refsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -662,7 +662,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
AstNode* newp = new AstVarRef(nodep->fileline(), varp, true);
|
AstNode* newp = new AstVarRef(nodep->fileline(), varp, true);
|
||||||
UINFO(9," const->"<<newp<<endl);
|
UINFO(9," const->"<<newp<<endl);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (m_tgraph.isTristate(nodep)) {
|
else if (m_tgraph.isTristate(nodep)) {
|
||||||
m_tgraph.didProcess(nodep);
|
m_tgraph.didProcess(nodep);
|
||||||
|
|
@ -676,7 +676,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
AstConst* newconstp = new AstConst(fl, num1);
|
AstConst* newconstp = new AstConst(fl, num1);
|
||||||
AstConst* enp = new AstConst(fl, numz0);
|
AstConst* enp = new AstConst(fl, numz0);
|
||||||
nodep->replaceWith(newconstp);
|
nodep->replaceWith(newconstp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
newconstp->user1p(enp); // Propagate up constant with non-Z bits as 1
|
newconstp->user1p(enp); // Propagate up constant with non-Z bits as 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -841,7 +841,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
nodep->replaceWith(expr2p);
|
nodep->replaceWith(expr2p);
|
||||||
UINFO(9," bufif datap="<<expr2p<<endl);
|
UINFO(9," bufif datap="<<expr2p<<endl);
|
||||||
UINFO(9," bufif enp="<<enp<<endl);
|
UINFO(9," bufif enp="<<enp<<endl);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -976,7 +976,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
if (debug()>=9) nodep->dumpTree(cout, "-caseeq-old: ");
|
if (debug()>=9) nodep->dumpTree(cout, "-caseeq-old: ");
|
||||||
if (debug()>=9) newp->dumpTree(cout, "-caseeq-new: ");
|
if (debug()>=9) newp->dumpTree(cout, "-caseeq-new: ");
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else {
|
} else {
|
||||||
checkUnhandled(nodep);
|
checkUnhandled(nodep);
|
||||||
}
|
}
|
||||||
|
|
@ -1040,7 +1040,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
if (!m_graphing) {
|
if (!m_graphing) {
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep); // Node must persist as user3p points to it
|
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Node must persist as user3p points to it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,12 +152,12 @@ private:
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignDly* nodep) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
m_assigndlyp = nodep;
|
m_assigndlyp = nodep;
|
||||||
iterateChildren(nodep); VL_DANGLING(nodep); // May delete nodep.
|
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
|
||||||
m_assigndlyp = NULL;
|
m_assigndlyp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
m_assignwp = nodep;
|
m_assignwp = nodep;
|
||||||
iterateChildren(nodep); VL_DANGLING(nodep); // May delete nodep.
|
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
|
||||||
m_assignwp = NULL;
|
m_assignwp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCaseItem* nodep) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
|
|
@ -177,7 +177,7 @@ private:
|
||||||
V3Const::constifyEdit(nodep->rhsp()); // rhsp may change
|
V3Const::constifyEdit(nodep->rhsp()); // rhsp may change
|
||||||
if (VN_IS(nodep->lhsp(), Const) && VN_IS(nodep->rhsp(), Const)) {
|
if (VN_IS(nodep->lhsp(), Const) && VN_IS(nodep->rhsp(), Const)) {
|
||||||
// Both sides are constant, node can be constant
|
// Both sides are constant, node can be constant
|
||||||
V3Const::constifyEdit(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(V3Const::constifyEdit(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
||||||
|
|
@ -188,15 +188,15 @@ private:
|
||||||
|| (VN_IS(rhsp, Const) && VN_CAST(rhsp, Const)->num().isFourState()))) {
|
|| (VN_IS(rhsp, Const) && VN_CAST(rhsp, Const)->num().isFourState()))) {
|
||||||
newp = new AstConst(nodep->fileline(), AstConst::WidthedValue(),
|
newp = new AstConst(nodep->fileline(), AstConst::WidthedValue(),
|
||||||
1, (VN_IS(nodep, EqCase) ? 0 : 1));
|
1, (VN_IS(nodep, EqCase) ? 0 : 1));
|
||||||
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
VL_DO_DANGLING(lhsp->deleteTree(), lhsp);
|
||||||
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
VL_DO_DANGLING(rhsp->deleteTree(), rhsp);
|
||||||
} else {
|
} else {
|
||||||
if (VN_IS(nodep, EqCase)) {
|
if (VN_IS(nodep, EqCase)) {
|
||||||
newp = new AstEq(nodep->fileline(), lhsp, rhsp);
|
newp = new AstEq(nodep->fileline(), lhsp, rhsp);
|
||||||
} else { newp = new AstNeq(nodep->fileline(), lhsp, rhsp); }
|
} else { newp = new AstNeq(nodep->fileline(), lhsp, rhsp); }
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
// Iterate tree now that we may have gotten rid of Xs
|
// Iterate tree now that we may have gotten rid of Xs
|
||||||
iterateChildren(newp);
|
iterateChildren(newp);
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +207,7 @@ private:
|
||||||
V3Const::constifyEdit(nodep->rhsp()); // rhsp may change
|
V3Const::constifyEdit(nodep->rhsp()); // rhsp may change
|
||||||
if (VN_IS(nodep->lhsp(), Const) && VN_IS(nodep->rhsp(), Const)) {
|
if (VN_IS(nodep->lhsp(), Const) && VN_IS(nodep->rhsp(), Const)) {
|
||||||
// Both sides are constant, node can be constant
|
// Both sides are constant, node can be constant
|
||||||
V3Const::constifyEdit(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(V3Const::constifyEdit(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
||||||
|
|
@ -229,10 +229,10 @@ private:
|
||||||
if (VN_IS(nodep, EqWild)) {
|
if (VN_IS(nodep, EqWild)) {
|
||||||
newp = new AstEq(nodep->fileline(), and1p, and2p);
|
newp = new AstEq(nodep->fileline(), and1p, and2p);
|
||||||
} else { newp = new AstNeq(nodep->fileline(), and1p, and2p); }
|
} else { newp = new AstNeq(nodep->fileline(), and1p, and2p); }
|
||||||
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
VL_DO_DANGLING(rhsp->deleteTree(), rhsp);
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
// Iterate tree now that we may have gotten rid of the compare
|
// Iterate tree now that we may have gotten rid of the compare
|
||||||
iterateChildren(newp);
|
iterateChildren(newp);
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +256,7 @@ private:
|
||||||
UINFO(4," ISUNKNOWN->0 "<<nodep<<endl);
|
UINFO(4," ISUNKNOWN->0 "<<nodep<<endl);
|
||||||
AstConst* newp = new AstConst(nodep->fileline(), AstConst::LogicFalse());
|
AstConst* newp = new AstConst(nodep->fileline(), AstConst::LogicFalse());
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep) {
|
virtual void visit(AstConst* nodep) {
|
||||||
if (m_constXCvt
|
if (m_constXCvt
|
||||||
|
|
@ -280,7 +280,7 @@ private:
|
||||||
}
|
}
|
||||||
AstConst* newp = new AstConst(nodep->fileline(), numnew);
|
AstConst* newp = new AstConst(nodep->fileline(), numnew);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
UINFO(4," -> "<<newp<<endl);
|
UINFO(4," -> "<<newp<<endl);
|
||||||
} else {
|
} else {
|
||||||
// Make a Vxrand variable
|
// Make a Vxrand variable
|
||||||
|
|
@ -317,7 +317,7 @@ private:
|
||||||
if (debug()>=9) newref1p->dumpTree(cout, " _new: ");
|
if (debug()>=9) newref1p->dumpTree(cout, " _new: ");
|
||||||
if (debug()>=9) newvarp->dumpTree(cout, " _new: ");
|
if (debug()>=9) newvarp->dumpTree(cout, " _new: ");
|
||||||
if (debug()>=9) newinitp->dumpTree(cout, " _new: ");
|
if (debug()>=9) newinitp->dumpTree(cout, " _new: ");
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +347,7 @@ private:
|
||||||
condp = V3Const::constifyEdit(condp);
|
condp = V3Const::constifyEdit(condp);
|
||||||
if (condp->isOne()) {
|
if (condp->isOne()) {
|
||||||
// We don't need to add a conditional; we know the existing expression is ok
|
// We don't need to add a conditional; we know the existing expression is ok
|
||||||
condp->deleteTree();
|
VL_DO_DANGLING(condp->deleteTree(), condp);
|
||||||
}
|
}
|
||||||
else if (!lvalue) {
|
else if (!lvalue) {
|
||||||
// SEL(...) -> COND(LTE(bit<=maxmsb), ARRAYSEL(...), {width{1'bx}})
|
// SEL(...) -> COND(LTE(bit<=maxmsb), ARRAYSEL(...), {width{1'bx}})
|
||||||
|
|
@ -408,7 +408,7 @@ private:
|
||||||
condp = V3Const::constifyEdit(condp);
|
condp = V3Const::constifyEdit(condp);
|
||||||
if (condp->isOne()) {
|
if (condp->isOne()) {
|
||||||
// We don't need to add a conditional; we know the existing expression is ok
|
// We don't need to add a conditional; we know the existing expression is ok
|
||||||
condp->deleteTree();
|
VL_DO_DANGLING(condp->deleteTree(), condp);
|
||||||
}
|
}
|
||||||
else if (!lvalue
|
else if (!lvalue
|
||||||
// Making a scalar would break if we're making an array
|
// Making a scalar would break if we're making an array
|
||||||
|
|
|
||||||
|
|
@ -209,14 +209,14 @@ private:
|
||||||
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(cout, "- _simtree: ");
|
||||||
clonep->deleteTree(); VL_DANGLING(clonep);
|
VL_DO_DANGLING(clonep->deleteTree(), clonep);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Fetch the result
|
// Fetch the result
|
||||||
V3Number* res = simvis.fetchNumberNull(clonep);
|
V3Number* res = simvis.fetchNumberNull(clonep);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
UINFO(3, "No number returned from simulation" << endl);
|
UINFO(3, "No number returned from simulation" << endl);
|
||||||
clonep->deleteTree(); VL_DANGLING(clonep);
|
VL_DO_DANGLING(clonep->deleteTree(), clonep);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Patch up datatype
|
// Patch up datatype
|
||||||
|
|
@ -224,11 +224,11 @@ private:
|
||||||
AstConst new_con (clonep->fileline(), *res);
|
AstConst new_con (clonep->fileline(), *res);
|
||||||
new_con.dtypeFrom(dtypep);
|
new_con.dtypeFrom(dtypep);
|
||||||
outNum = new_con.num();
|
outNum = new_con.num();
|
||||||
clonep->deleteTree(); VL_DANGLING(clonep);
|
VL_DO_DANGLING(clonep->deleteTree(), clonep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
outNum = *res;
|
outNum = *res;
|
||||||
clonep->deleteTree(); VL_DANGLING(clonep);
|
VL_DO_DANGLING(clonep->deleteTree(), clonep);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -322,7 +322,7 @@ private:
|
||||||
iterateAndNextNull(tempp->stmtsp());
|
iterateAndNextNull(tempp->stmtsp());
|
||||||
m_varModeReplace = false;
|
m_varModeReplace = false;
|
||||||
oneloopp = tempp->stmtsp()->unlinkFrBackWithNext();
|
oneloopp = tempp->stmtsp()->unlinkFrBackWithNext();
|
||||||
tempp->deleteTree(); VL_DANGLING(tempp);
|
VL_DO_DANGLING(tempp->deleteTree(), tempp);
|
||||||
}
|
}
|
||||||
if (m_generate) {
|
if (m_generate) {
|
||||||
string index = AstNode::encodeNumber(m_varValuep->toSInt());
|
string index = AstNode::encodeNumber(m_varValuep->toSInt());
|
||||||
|
|
@ -359,10 +359,10 @@ private:
|
||||||
// Replace the FOR()
|
// Replace the FOR()
|
||||||
if (newbodysp) nodep->replaceWith(newbodysp);
|
if (newbodysp) nodep->replaceWith(newbodysp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
if (bodysp) { pushDeletep(bodysp); VL_DANGLING(bodysp); }
|
if (bodysp) { VL_DO_DANGLING(pushDeletep(bodysp), bodysp); }
|
||||||
if (precondsp) { pushDeletep(precondsp); VL_DANGLING(precondsp); }
|
if (precondsp) { VL_DO_DANGLING(pushDeletep(precondsp), precondsp); }
|
||||||
if (initp) { pushDeletep(initp); VL_DANGLING(initp); }
|
if (initp) { VL_DO_DANGLING(pushDeletep(initp), initp); }
|
||||||
if (incp && !incp->backp()) { pushDeletep(incp); VL_DANGLING(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(cout, "- _new: ");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +377,7 @@ private:
|
||||||
// Grab initial value
|
// Grab initial value
|
||||||
AstNode* initp = NULL; // Should be statement before the while.
|
AstNode* initp = NULL; // Should be statement before the while.
|
||||||
if (nodep->backp()->nextp() == nodep) initp = nodep->backp();
|
if (nodep->backp()->nextp() == nodep) initp = nodep->backp();
|
||||||
if (initp) { V3Const::constifyEdit(initp); VL_DANGLING(initp); }
|
if (initp) { VL_DO_DANGLING(V3Const::constifyEdit(initp), initp); }
|
||||||
if (nodep->backp()->nextp() == nodep) initp = nodep->backp();
|
if (nodep->backp()->nextp() == nodep) initp = nodep->backp();
|
||||||
// Grab assignment
|
// Grab assignment
|
||||||
AstNode* incp = NULL; // Should be last statement
|
AstNode* incp = NULL; // Should be last statement
|
||||||
|
|
@ -385,14 +385,14 @@ private:
|
||||||
if (nodep->incsp()) incp = nodep->incsp();
|
if (nodep->incsp()) incp = nodep->incsp();
|
||||||
else {
|
else {
|
||||||
for (incp = nodep->bodysp(); incp && incp->nextp(); incp = incp->nextp()) {}
|
for (incp = nodep->bodysp(); incp && incp->nextp(); incp = incp->nextp()) {}
|
||||||
if (incp) { V3Const::constifyEdit(incp); VL_DANGLING(incp); }
|
if (incp) { VL_DO_DANGLING(V3Const::constifyEdit(incp), incp); }
|
||||||
for (incp = nodep->bodysp(); incp && incp->nextp(); incp = incp->nextp()) {} // Again, as may have changed
|
for (incp = nodep->bodysp(); incp && incp->nextp(); incp = incp->nextp()) {} // Again, as may have changed
|
||||||
}
|
}
|
||||||
// And check it
|
// And check it
|
||||||
if (forUnrollCheck(nodep, initp,
|
if (forUnrollCheck(nodep, initp,
|
||||||
nodep->precondsp(), nodep->condp(),
|
nodep->precondsp(), nodep->condp(),
|
||||||
incp, nodep->bodysp())) {
|
incp, nodep->bodysp())) {
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep); // Did replacement
|
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Did replacement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -414,11 +414,11 @@ private:
|
||||||
// we'd need to initialize the variable to the initial
|
// we'd need to initialize the variable to the initial
|
||||||
// condition, but they'll become while's which can be
|
// condition, but they'll become while's which can be
|
||||||
// deleted by V3Const.
|
// deleted by V3Const.
|
||||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
|
||||||
} else if (forUnrollCheck(nodep, nodep->initsp(),
|
} else if (forUnrollCheck(nodep, nodep->initsp(),
|
||||||
NULL, nodep->condp(),
|
NULL, nodep->condp(),
|
||||||
nodep->incsp(), nodep->bodysp())) {
|
nodep->incsp(), nodep->bodysp())) {
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep); // Did replacement
|
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Did replacement
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("For loop doesn't have genvar index, or is malformed");
|
nodep->v3error("For loop doesn't have genvar index, or is malformed");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
148
src/V3Width.cpp
148
src/V3Width.cpp
|
|
@ -462,14 +462,14 @@ private:
|
||||||
if (AstReplicate* repp = VN_CAST(nodep->lhsp(), Replicate)) {
|
if (AstReplicate* repp = VN_CAST(nodep->lhsp(), Replicate)) {
|
||||||
if (repp->width()==0) { // Keep rhs
|
if (repp->width()==0) { // Keep rhs
|
||||||
nodep->replaceWith(nodep->rhsp()->unlinkFrBack());
|
nodep->replaceWith(nodep->rhsp()->unlinkFrBack());
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (AstReplicate* repp = VN_CAST(nodep->rhsp(), Replicate)) {
|
if (AstReplicate* repp = VN_CAST(nodep->rhsp(), Replicate)) {
|
||||||
if (repp->width()==0) { // Keep lhs
|
if (repp->width()==0) { // Keep lhs
|
||||||
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -478,7 +478,7 @@ private:
|
||||||
AstNode* newp = new AstConcatN(nodep->fileline(), nodep->lhsp()->unlinkFrBack(),
|
AstNode* newp = new AstConcatN(nodep->fileline(), nodep->lhsp()->unlinkFrBack(),
|
||||||
nodep->rhsp()->unlinkFrBack());
|
nodep->rhsp()->unlinkFrBack());
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -543,7 +543,7 @@ private:
|
||||||
AstNode* newp = new AstReplicateN(nodep->fileline(), nodep->lhsp()->unlinkFrBack(),
|
AstNode* newp = new AstReplicateN(nodep->fileline(), nodep->lhsp()->unlinkFrBack(),
|
||||||
nodep->rhsp()->unlinkFrBack());
|
nodep->rhsp()->unlinkFrBack());
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
nodep->dtypeSetLogicUnsized((nodep->lhsp()->width() * times),
|
nodep->dtypeSetLogicUnsized((nodep->lhsp()->width() * times),
|
||||||
|
|
@ -983,7 +983,7 @@ private:
|
||||||
if (nodep->lhsp()->isDouble() || nodep->rhsp()->isDouble()) {
|
if (nodep->lhsp()->isDouble() || nodep->rhsp()->isDouble()) {
|
||||||
spliceCvtD(nodep->lhsp());
|
spliceCvtD(nodep->lhsp());
|
||||||
spliceCvtD(nodep->rhsp());
|
spliceCvtD(nodep->rhsp());
|
||||||
replaceWithDVersion(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithDVersion(nodep), nodep);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1012,7 +1012,7 @@ private:
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
UINFO(9,"powOld "<<nodep<<endl);
|
UINFO(9,"powOld "<<nodep<<endl);
|
||||||
UINFO(9,"powNew "<<newp<<endl);
|
UINFO(9,"powNew "<<newp<<endl);
|
||||||
nodep->replaceWith(newp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->replaceWith(newp), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1067,7 +1067,7 @@ private:
|
||||||
int val = (nodep->attrType()==AstAttrType::DIM_UNPK_DIMENSIONS
|
int val = (nodep->attrType()==AstAttrType::DIM_UNPK_DIMENSIONS
|
||||||
? dim.second : (dim.first+dim.second));
|
? dim.second : (dim.first+dim.second));
|
||||||
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Signed32(), val));
|
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Signed32(), val));
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AstAttrType::DIM_BITS:
|
case AstAttrType::DIM_BITS:
|
||||||
|
|
@ -1086,13 +1086,13 @@ private:
|
||||||
newp->dtypeSetSigned32();
|
newp->dtypeSetSigned32();
|
||||||
newp->didWidth(true);
|
newp->didWidth(true);
|
||||||
newp->protect(false);
|
newp->protect(false);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AstAttrType::DIM_LEFT:
|
case AstAttrType::DIM_LEFT:
|
||||||
case AstAttrType::DIM_LOW: {
|
case AstAttrType::DIM_LOW: {
|
||||||
AstNode* newp = new AstConst(nodep->fileline(), AstConst::Signed32(), 0);
|
AstNode* newp = new AstConst(nodep->fileline(), AstConst::Signed32(), 0);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AstAttrType::DIM_RIGHT:
|
case AstAttrType::DIM_RIGHT:
|
||||||
|
|
@ -1105,12 +1105,12 @@ private:
|
||||||
AstNode* newp
|
AstNode* newp
|
||||||
= new AstSub(nodep->fileline(), sizep,
|
= new AstSub(nodep->fileline(), sizep,
|
||||||
new AstConst(nodep->fileline(), AstConst::Signed32(), 1));
|
new AstConst(nodep->fileline(), AstConst::Signed32(), 1));
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AstAttrType::DIM_INCREMENT: {
|
case AstAttrType::DIM_INCREMENT: {
|
||||||
AstNode* newp = new AstConst(nodep->fileline(), AstConst::Signed32(), -1);
|
AstNode* newp = new AstConst(nodep->fileline(), AstConst::Signed32(), -1);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AstAttrType::DIM_BITS: {
|
case AstAttrType::DIM_BITS: {
|
||||||
|
|
@ -1127,12 +1127,12 @@ private:
|
||||||
int dim = 1;
|
int dim = 1;
|
||||||
AstConst* newp = dimensionValue(nodep->fileline(), nodep->fromp()->dtypep(),
|
AstConst* newp = dimensionValue(nodep->fileline(), nodep->fromp()->dtypep(),
|
||||||
nodep->attrType(), dim);
|
nodep->attrType(), dim);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (VN_IS(nodep->dimp(), Const)) {
|
} else if (VN_IS(nodep->dimp(), Const)) {
|
||||||
int dim = VN_CAST(nodep->dimp(), Const)->toSInt();
|
int dim = VN_CAST(nodep->dimp(), Const)->toSInt();
|
||||||
AstConst* newp = dimensionValue(nodep->fileline(), nodep->fromp()->dtypep(),
|
AstConst* newp = dimensionValue(nodep->fileline(), nodep->fromp()->dtypep(),
|
||||||
nodep->attrType(), dim);
|
nodep->attrType(), dim);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
else { // Need a runtime lookup table. Yuk.
|
else { // Need a runtime lookup table. Yuk.
|
||||||
UASSERT_OBJ(nodep->fromp() && nodep->fromp()->dtypep(), nodep,
|
UASSERT_OBJ(nodep->fromp() && nodep->fromp()->dtypep(), nodep,
|
||||||
|
|
@ -1143,7 +1143,7 @@ private:
|
||||||
AstVarRef* varrefp = new AstVarRef(nodep->fileline(), varp, false);
|
AstVarRef* varrefp = new AstVarRef(nodep->fileline(), varp, false);
|
||||||
varrefp->packagep(v3Global.rootp()->dollarUnitPkgAddp());
|
varrefp->packagep(v3Global.rootp()->dollarUnitPkgAddp());
|
||||||
AstNode* newp = new AstArraySel(nodep->fileline(), varrefp, dimp);
|
AstNode* newp = new AstArraySel(nodep->fileline(), varrefp, dimp);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1294,7 +1294,7 @@ private:
|
||||||
AstNode* newp = new AstCastSize(nodep->fileline(),
|
AstNode* newp = new AstCastSize(nodep->fileline(),
|
||||||
nodep->lhsp()->unlinkFrBack(), constp);
|
nodep->lhsp()->unlinkFrBack(), constp);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
userIterate(newp, m_vup);
|
userIterate(newp, m_vup);
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("Unsupported: Cast to "<<nodep->dtp()->prettyTypeName());
|
nodep->v3error("Unsupported: Cast to "<<nodep->dtp()->prettyTypeName());
|
||||||
|
|
@ -1338,7 +1338,7 @@ private:
|
||||||
//newp = newp; // Can just remove cast
|
//newp = newp; // Can just remove cast
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
//if (debug()) newp->dumpTree(cout, " CastOut: ");
|
//if (debug()) newp->dumpTree(cout, " CastOut: ");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCastSize* nodep) {
|
virtual void visit(AstCastSize* nodep) {
|
||||||
|
|
@ -1387,7 +1387,7 @@ private:
|
||||||
// CastSize not needed once sizes determined
|
// CastSize not needed once sizes determined
|
||||||
AstNode* underp = nodep->lhsp()->unlinkFrBack();
|
AstNode* underp = nodep->lhsp()->unlinkFrBack();
|
||||||
nodep->replaceWith(underp);
|
nodep->replaceWith(underp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
//if (debug()) nodep->dumpTree(cout, " CastSizeOut: ");
|
//if (debug()) nodep->dumpTree(cout, " CastSizeOut: ");
|
||||||
}
|
}
|
||||||
|
|
@ -1606,7 +1606,7 @@ private:
|
||||||
if (VN_IS(enump, EnumDType)) break;
|
if (VN_IS(enump, EnumDType)) break;
|
||||||
}
|
}
|
||||||
UASSERT_OBJ(enump, nodep, "EnumItemRef can't deref back to an Enum");
|
UASSERT_OBJ(enump, nodep, "EnumItemRef can't deref back to an Enum");
|
||||||
userIterate(enump, m_vup); VL_DANGLING(enump); // parent's connection to enump may be relinked
|
VL_DO_DANGLING(userIterate(enump, m_vup), enump); // Parent enump maybe relinked
|
||||||
}
|
}
|
||||||
nodep->dtypeFrom(nodep->itemp());
|
nodep->dtypeFrom(nodep->itemp());
|
||||||
}
|
}
|
||||||
|
|
@ -1630,7 +1630,7 @@ private:
|
||||||
userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT, PRELIM).p());
|
userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT, PRELIM).p());
|
||||||
for (AstNode* nextip, *itemp = nodep->itemsp(); itemp; itemp=nextip) {
|
for (AstNode* nextip, *itemp = nodep->itemsp(); itemp; itemp=nextip) {
|
||||||
nextip = itemp->nextp(); // Prelim may cause the node to get replaced
|
nextip = itemp->nextp(); // Prelim may cause the node to get replaced
|
||||||
userIterate(itemp, WidthVP(CONTEXT, PRELIM).p()); VL_DANGLING(itemp);
|
VL_DO_DANGLING(userIterate(itemp, WidthVP(CONTEXT, PRELIM).p()), itemp);
|
||||||
}
|
}
|
||||||
// Take width as maximum across all items
|
// Take width as maximum across all items
|
||||||
int width = nodep->exprp()->width();
|
int width = nodep->exprp()->width();
|
||||||
|
|
@ -1674,7 +1674,7 @@ private:
|
||||||
}
|
}
|
||||||
if (!newp) newp = new AstConst(nodep->fileline(), AstConst::LogicFalse());
|
if (!newp) newp = new AstConst(nodep->fileline(), AstConst::LogicFalse());
|
||||||
if (debug()>=9) newp->dumpTree(cout, "-inside-out: ");
|
if (debug()>=9) newp->dumpTree(cout, "-inside-out: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInsideRange* nodep) {
|
virtual void visit(AstInsideRange* nodep) {
|
||||||
// Just do each side; AstInside will rip these nodes out later
|
// Just do each side; AstInside will rip these nodes out later
|
||||||
|
|
@ -1751,7 +1751,7 @@ private:
|
||||||
AstNode* newp = new AstMethodCall(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
AstNode* newp = new AstMethodCall(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||||
nodep->name(), NULL);
|
nodep->name(), NULL);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
userIterate(newp, m_vup);
|
userIterate(newp, m_vup);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1761,7 +1761,7 @@ private:
|
||||||
}
|
}
|
||||||
// Error handling
|
// Error handling
|
||||||
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::LogicFalse()));
|
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::LogicFalse()));
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
bool memberSelStruct(AstMemberSel* nodep, AstNodeUOrStructDType* adtypep) {
|
bool memberSelStruct(AstMemberSel* nodep, AstNodeUOrStructDType* adtypep) {
|
||||||
// Returns true if ok
|
// Returns true if ok
|
||||||
|
|
@ -1778,7 +1778,7 @@ private:
|
||||||
newp->didWidth(true); // Don't replace dtype with basic type
|
newp->didWidth(true); // Don't replace dtype with basic type
|
||||||
UINFO(9, " MEMBERSEL -> " << newp << endl);
|
UINFO(9, " MEMBERSEL -> " << newp << endl);
|
||||||
UINFO(9, " dt-> " << newp->dtypep() << endl);
|
UINFO(9, " dt-> " << newp->dtypep() << endl);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
// Should be able to treat it as a normal-ish nodesel - maybe.
|
// Should be able to treat it as a normal-ish nodesel - maybe.
|
||||||
// The lhsp() will be strange until this stage; create the number here?
|
// The lhsp() will be strange until this stage; create the number here?
|
||||||
}
|
}
|
||||||
|
|
@ -1850,7 +1850,7 @@ private:
|
||||||
for (; narg > maxArg; --narg) {
|
for (; narg > maxArg; --narg) {
|
||||||
AstNode* argp = nodep->pinsp();
|
AstNode* argp = nodep->pinsp();
|
||||||
while (argp->nextp()) argp = argp->nextp();
|
while (argp->nextp()) argp = argp->nextp();
|
||||||
argp->unlinkFrBack(); argp->deleteTree(); VL_DANGLING(argp);
|
argp->unlinkFrBack(); VL_DO_DANGLING(argp->deleteTree(), argp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1884,7 +1884,7 @@ private:
|
||||||
UASSERT_OBJ(newp, nodep, "Enum method (perhaps enum item) not const");
|
UASSERT_OBJ(newp, nodep, "Enum method (perhaps enum item) not const");
|
||||||
newp->fileline(nodep->fileline()); // Use method's filename/line number to be clearer;
|
newp->fileline(nodep->fileline()); // Use method's filename/line number to be clearer;
|
||||||
// may have warning disables
|
// may have warning disables
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else if (nodep->name() == "name"
|
} else if (nodep->name() == "name"
|
||||||
|| nodep->name() == "next"
|
|| nodep->name() == "next"
|
||||||
|| nodep->name() == "prev") {
|
|| nodep->name() == "prev") {
|
||||||
|
|
@ -1930,7 +1930,7 @@ private:
|
||||||
// Select in case widths are
|
// Select in case widths are
|
||||||
// off due to msblen!=width
|
// off due to msblen!=width
|
||||||
new AstSel(nodep->fileline(), nodep->fromp()->unlinkFrBack(), 0, selwidth));
|
new AstSel(nodep->fileline(), nodep->fromp()->unlinkFrBack(), 0, selwidth));
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("Unknown built-in enum method " << nodep->prettyNameQ());
|
nodep->v3error("Unknown built-in enum method " << nodep->prettyNameQ());
|
||||||
}
|
}
|
||||||
|
|
@ -1993,7 +1993,7 @@ private:
|
||||||
}
|
}
|
||||||
if (newp) {
|
if (newp) {
|
||||||
newp->didWidth(true);
|
newp->didWidth(true);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AstNode* methodCallAssocIndexExpr(AstMethodCall* nodep, AstAssocArrayDType* adtypep) {
|
AstNode* methodCallAssocIndexExpr(AstMethodCall* nodep, AstAssocArrayDType* adtypep) {
|
||||||
|
|
@ -2111,7 +2111,7 @@ private:
|
||||||
}
|
}
|
||||||
if (newp) {
|
if (newp) {
|
||||||
newp->didWidth(true);
|
newp->didWidth(true);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AstNode* methodCallQueueIndexExpr(AstMethodCall* nodep) {
|
AstNode* methodCallQueueIndexExpr(AstMethodCall* nodep) {
|
||||||
|
|
@ -2147,7 +2147,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("Unknown built-in array method " << nodep->prettyNameQ());
|
nodep->v3error("Unknown built-in array method " << nodep->prettyNameQ());
|
||||||
}
|
}
|
||||||
|
|
@ -2159,30 +2159,30 @@ private:
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
AstNode* newp = new AstLenN(nodep->fileline(), nodep->fromp()->unlinkFrBack());
|
AstNode* newp = new AstLenN(nodep->fileline(), nodep->fromp()->unlinkFrBack());
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else if (nodep->name() == "itoa") {
|
} else if (nodep->name() == "itoa") {
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
replaceWithSFormat(nodep, "%0d"); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSFormat(nodep, "%0d"), nodep);
|
||||||
} else if (nodep->name() == "hextoa") {
|
} else if (nodep->name() == "hextoa") {
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
replaceWithSFormat(nodep, "%0x"); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSFormat(nodep, "%0x"), nodep);
|
||||||
} else if (nodep->name() == "octtoa") {
|
} else if (nodep->name() == "octtoa") {
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
replaceWithSFormat(nodep, "%0o"); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSFormat(nodep, "%0o"), nodep);
|
||||||
} else if (nodep->name() == "bintoa") {
|
} else if (nodep->name() == "bintoa") {
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
replaceWithSFormat(nodep, "%0b"); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSFormat(nodep, "%0b"), nodep);
|
||||||
} else if (nodep->name() == "realtoa") {
|
} else if (nodep->name() == "realtoa") {
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
replaceWithSFormat(nodep, "%g"); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSFormat(nodep, "%g"), nodep);
|
||||||
} else if (nodep->name() == "tolower") {
|
} else if (nodep->name() == "tolower") {
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
AstNode* newp = new AstToLowerN(nodep->fileline(), nodep->fromp()->unlinkFrBack());
|
AstNode* newp = new AstToLowerN(nodep->fileline(), nodep->fromp()->unlinkFrBack());
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (nodep->name() == "toupper") {
|
} else if (nodep->name() == "toupper") {
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
AstNode* newp = new AstToUpperN(nodep->fileline(), nodep->fromp()->unlinkFrBack());
|
AstNode* newp = new AstToUpperN(nodep->fileline(), nodep->fromp()->unlinkFrBack());
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (nodep->name() == "compare" || nodep->name() == "icompare") {
|
} else if (nodep->name() == "compare" || nodep->name() == "icompare") {
|
||||||
const bool ignoreCase = nodep->name()[0] == 'i';
|
const bool ignoreCase = nodep->name()[0] == 'i';
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
|
|
@ -2190,7 +2190,7 @@ private:
|
||||||
AstNode* lhs = nodep->fromp()->unlinkFrBack();
|
AstNode* lhs = nodep->fromp()->unlinkFrBack();
|
||||||
AstNode* rhs = argp->exprp()->unlinkFrBack();
|
AstNode* rhs = argp->exprp()->unlinkFrBack();
|
||||||
AstNode* newp = new AstCompareNN(nodep->fileline(), lhs, rhs, ignoreCase);
|
AstNode* newp = new AstCompareNN(nodep->fileline(), lhs, rhs, ignoreCase);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (nodep->name() == "putc" ) {
|
} else if (nodep->name() == "putc" ) {
|
||||||
methodOkArguments(nodep, 2, 2);
|
methodOkArguments(nodep, 2, 2);
|
||||||
AstArg* arg0p = VN_CAST(nodep->pinsp(), Arg);
|
AstArg* arg0p = VN_CAST(nodep->pinsp(), Arg);
|
||||||
|
|
@ -2202,14 +2202,14 @@ private:
|
||||||
AstNode* newp = new AstAssign(nodep->fileline(), fromp,
|
AstNode* newp = new AstAssign(nodep->fileline(), fromp,
|
||||||
new AstPutcN(nodep->fileline(), varrefp, rhsp, thsp));
|
new AstPutcN(nodep->fileline(), varrefp, rhsp, thsp));
|
||||||
fromp->lvalue(true);
|
fromp->lvalue(true);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (nodep->name() == "getc") {
|
} else if (nodep->name() == "getc") {
|
||||||
methodOkArguments(nodep, 1, 1);
|
methodOkArguments(nodep, 1, 1);
|
||||||
AstArg* arg0p = VN_CAST(nodep->pinsp(), Arg);
|
AstArg* arg0p = VN_CAST(nodep->pinsp(), Arg);
|
||||||
AstNode* lhsp = nodep->fromp()->unlinkFrBack();
|
AstNode* lhsp = nodep->fromp()->unlinkFrBack();
|
||||||
AstNode* rhsp = arg0p->exprp()->unlinkFrBack();
|
AstNode* rhsp = arg0p->exprp()->unlinkFrBack();
|
||||||
AstNode* newp = new AstGetcN(nodep->fileline(), lhsp, rhsp);
|
AstNode* newp = new AstGetcN(nodep->fileline(), lhsp, rhsp);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (nodep->name() == "substr") {
|
} else if (nodep->name() == "substr") {
|
||||||
methodOkArguments(nodep, 2, 2);
|
methodOkArguments(nodep, 2, 2);
|
||||||
AstArg* arg0p = VN_CAST(nodep->pinsp(), Arg);
|
AstArg* arg0p = VN_CAST(nodep->pinsp(), Arg);
|
||||||
|
|
@ -2218,7 +2218,7 @@ private:
|
||||||
AstNode* rhsp = arg0p->exprp()->unlinkFrBack();
|
AstNode* rhsp = arg0p->exprp()->unlinkFrBack();
|
||||||
AstNode* thsp = arg1p->exprp()->unlinkFrBack();
|
AstNode* thsp = arg1p->exprp()->unlinkFrBack();
|
||||||
AstNode* newp = new AstSubstrN(nodep->fileline(), lhsp, rhsp, thsp);
|
AstNode* newp = new AstSubstrN(nodep->fileline(), lhsp, rhsp, thsp);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else if (nodep->name() == "atobin"
|
} else if (nodep->name() == "atobin"
|
||||||
|| nodep->name() == "atohex"
|
|| nodep->name() == "atohex"
|
||||||
|| nodep->name() == "atoi"
|
|| nodep->name() == "atoi"
|
||||||
|
|
@ -2233,7 +2233,7 @@ private:
|
||||||
else { V3ERROR_NA; fmt = AstAtoN::ATOI; } // dummy assignment to suppress compiler warning
|
else { V3ERROR_NA; fmt = AstAtoN::ATOI; } // dummy assignment to suppress compiler warning
|
||||||
methodOkArguments(nodep, 0, 0);
|
methodOkArguments(nodep, 0, 0);
|
||||||
AstNode* newp = new AstAtoN(nodep->fileline(), nodep->fromp()->unlinkFrBack(), fmt);
|
AstNode* newp = new AstAtoN(nodep->fileline(), nodep->fromp()->unlinkFrBack(), fmt);
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("Unknown built-in string method "<<nodep->prettyNameQ());
|
nodep->v3error("Unknown built-in string method "<<nodep->prettyNameQ());
|
||||||
}
|
}
|
||||||
|
|
@ -2312,14 +2312,14 @@ private:
|
||||||
dtypep = vdtypep->subDTypep()->skipRefp();
|
dtypep = vdtypep->subDTypep()->skipRefp();
|
||||||
}
|
}
|
||||||
if (AstNodeUOrStructDType* vdtypep = VN_CAST(dtypep, NodeUOrStructDType)) {
|
if (AstNodeUOrStructDType* vdtypep = VN_CAST(dtypep, NodeUOrStructDType)) {
|
||||||
patternUOrStruct(nodep, vdtypep, defaultp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(patternUOrStruct(nodep, vdtypep, defaultp), nodep);
|
||||||
}
|
}
|
||||||
else if (AstNodeArrayDType* vdtypep = VN_CAST(dtypep, NodeArrayDType)) {
|
else if (AstNodeArrayDType* vdtypep = VN_CAST(dtypep, NodeArrayDType)) {
|
||||||
patternArray(nodep, vdtypep, defaultp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(patternArray(nodep, vdtypep, defaultp), nodep);
|
||||||
}
|
}
|
||||||
else if (VN_IS(dtypep, BasicDType)
|
else if (VN_IS(dtypep, BasicDType)
|
||||||
&& VN_CAST(dtypep, BasicDType)->isRanged()) {
|
&& VN_CAST(dtypep, BasicDType)->isRanged()) {
|
||||||
patternBasic(nodep, dtypep, defaultp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(patternBasic(nodep, dtypep, defaultp), nodep);
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("Unsupported: Assignment pattern applies against non struct/union: "
|
nodep->v3error("Unsupported: Assignment pattern applies against non struct/union: "
|
||||||
<<dtypep->prettyTypeName());
|
<<dtypep->prettyTypeName());
|
||||||
|
|
@ -2407,7 +2407,7 @@ private:
|
||||||
// Forming a AstConcat will cause problems with
|
// Forming a AstConcat will cause problems with
|
||||||
// unsized (uncommitted sized) constants
|
// unsized (uncommitted sized) constants
|
||||||
if (AstNode* newp = WidthCommitVisitor::newIfConstCommitSize(VN_CAST(valuep, Const))) {
|
if (AstNode* newp = WidthCommitVisitor::newIfConstCommitSize(VN_CAST(valuep, Const))) {
|
||||||
pushDeletep(valuep); VL_DANGLING(valuep);
|
VL_DO_DANGLING(pushDeletep(valuep), valuep);
|
||||||
valuep = newp;
|
valuep = newp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2420,11 +2420,11 @@ private:
|
||||||
nodep->dtypep()->numeric());
|
nodep->dtypep()->numeric());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newpatp) { pushDeletep(newpatp); VL_DANGLING(newpatp); }
|
if (newpatp) { VL_DO_DANGLING(pushDeletep(newpatp), newpatp); }
|
||||||
}
|
}
|
||||||
if (newp) nodep->replaceWith(newp);
|
if (newp) nodep->replaceWith(newp);
|
||||||
else nodep->v3error("Assignment pattern with no members");
|
else nodep->v3error("Assignment pattern with no members");
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep); // Deletes defaultp also, if present
|
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
|
||||||
}
|
}
|
||||||
void patternArray(AstPattern* nodep, AstNodeArrayDType* vdtypep, AstPatMember* defaultp) {
|
void patternArray(AstPattern* nodep, AstNodeArrayDType* vdtypep, AstPatMember* defaultp) {
|
||||||
AstNodeArrayDType* arrayp = VN_CAST(vdtypep, NodeArrayDType);
|
AstNodeArrayDType* arrayp = VN_CAST(vdtypep, NodeArrayDType);
|
||||||
|
|
@ -2461,7 +2461,7 @@ private:
|
||||||
// Forming a AstConcat will cause problems with
|
// Forming a AstConcat will cause problems with
|
||||||
// unsized (uncommitted sized) constants
|
// unsized (uncommitted sized) constants
|
||||||
if (AstNode* newp = WidthCommitVisitor::newIfConstCommitSize(VN_CAST(valuep, Const))) {
|
if (AstNode* newp = WidthCommitVisitor::newIfConstCommitSize(VN_CAST(valuep, Const))) {
|
||||||
pushDeletep(valuep); VL_DANGLING(valuep);
|
VL_DO_DANGLING(pushDeletep(valuep), valuep);
|
||||||
valuep = newp;
|
valuep = newp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2483,13 +2483,13 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newpatp) { pushDeletep(newpatp); VL_DANGLING(newpatp); }
|
if (newpatp) { VL_DO_DANGLING(pushDeletep(newpatp), newpatp); }
|
||||||
}
|
}
|
||||||
if (!patmap.empty()) nodep->v3error("Assignment pattern with too many elements");
|
if (!patmap.empty()) nodep->v3error("Assignment pattern with too many elements");
|
||||||
if (newp) nodep->replaceWith(newp);
|
if (newp) nodep->replaceWith(newp);
|
||||||
else nodep->v3error("Assignment pattern with no members");
|
else nodep->v3error("Assignment pattern with no members");
|
||||||
//if (debug()>=9) newp->dumpTree("-apat-out: ");
|
//if (debug()>=9) newp->dumpTree("-apat-out: ");
|
||||||
pushDeletep(nodep); VL_DANGLING(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) {
|
||||||
AstBasicDType* bdtypep = VN_CAST(vdtypep, BasicDType);
|
AstBasicDType* bdtypep = VN_CAST(vdtypep, BasicDType);
|
||||||
|
|
@ -2527,7 +2527,7 @@ private:
|
||||||
// Forming a AstConcat will cause problems with
|
// Forming a AstConcat will cause problems with
|
||||||
// unsized (uncommitted sized) constants
|
// unsized (uncommitted sized) constants
|
||||||
if (AstNode* newp = WidthCommitVisitor::newIfConstCommitSize(VN_CAST(valuep, Const))) {
|
if (AstNode* newp = WidthCommitVisitor::newIfConstCommitSize(VN_CAST(valuep, Const))) {
|
||||||
pushDeletep(valuep); VL_DANGLING(valuep);
|
VL_DO_DANGLING(pushDeletep(valuep), valuep);
|
||||||
valuep = newp;
|
valuep = newp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2542,13 +2542,13 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newpatp) { pushDeletep(newpatp); VL_DANGLING(newpatp); }
|
if (newpatp) { VL_DO_DANGLING(pushDeletep(newpatp), newpatp); }
|
||||||
}
|
}
|
||||||
if (!patmap.empty()) nodep->v3error("Assignment pattern with too many elements");
|
if (!patmap.empty()) nodep->v3error("Assignment pattern with too many elements");
|
||||||
if (newp) nodep->replaceWith(newp);
|
if (newp) nodep->replaceWith(newp);
|
||||||
else nodep->v3error("Assignment pattern with no members");
|
else nodep->v3error("Assignment pattern with no members");
|
||||||
//if (debug()>=9) newp->dumpTree("-apat-out: ");
|
//if (debug()>=9) newp->dumpTree("-apat-out: ");
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep); // Deletes defaultp also, if present
|
VL_DO_DANGLING(pushDeletep(nodep), nodep); // Deletes defaultp also, if present
|
||||||
}
|
}
|
||||||
virtual void visit(AstPatMember* nodep) {
|
virtual void visit(AstPatMember* nodep) {
|
||||||
AstNodeDType* vdtypep = m_vup->dtypeNullp();
|
AstNodeDType* vdtypep = m_vup->dtypeNullp();
|
||||||
|
|
@ -2600,7 +2600,7 @@ private:
|
||||||
if (!VN_IS(nodep, GenCase)) userIterateAndNext(itemp->bodysp(), NULL);
|
if (!VN_IS(nodep, GenCase)) userIterateAndNext(itemp->bodysp(), NULL);
|
||||||
for (AstNode* nextcp, *condp = itemp->condsp(); condp; condp=nextcp) {
|
for (AstNode* nextcp, *condp = itemp->condsp(); condp; condp=nextcp) {
|
||||||
nextcp = condp->nextp(); // Prelim may cause the node to get replaced
|
nextcp = condp->nextp(); // Prelim may cause the node to get replaced
|
||||||
userIterate(condp, WidthVP(CONTEXT, PRELIM).p()); VL_DANGLING(condp);
|
VL_DO_DANGLING(userIterate(condp, WidthVP(CONTEXT, PRELIM).p()), condp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2821,7 +2821,7 @@ private:
|
||||||
break;
|
break;
|
||||||
default: UASSERT_OBJ(false, nodep, "Unexpected elaboration display type");
|
default: UASSERT_OBJ(false, nodep, "Unexpected elaboration display type");
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstFOpen* nodep) {
|
virtual void visit(AstFOpen* nodep) {
|
||||||
|
|
@ -3128,7 +3128,7 @@ private:
|
||||||
userIterateAndNext(nodep->exprp(), m_vup);
|
userIterateAndNext(nodep->exprp(), m_vup);
|
||||||
nodep->replaceWith(nodep->exprp()->unlinkFrBack());
|
nodep->replaceWith(nodep->exprp()->unlinkFrBack());
|
||||||
}
|
}
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
|
|
@ -3215,7 +3215,7 @@ private:
|
||||||
string format;
|
string format;
|
||||||
if (VN_IS(pinp, Const)) format = VN_CAST(pinp, Const)->num().toString();
|
if (VN_IS(pinp, Const)) format = VN_CAST(pinp, Const)->num().toString();
|
||||||
else pinp->v3error("Format to $display-like function must have constant format string");
|
else pinp->v3error("Format to $display-like function must have constant format string");
|
||||||
pushDeletep(argp); VL_DANGLING(argp);
|
VL_DO_DANGLING(pushDeletep(argp), argp);
|
||||||
AstSFormatF* newp = new AstSFormatF(nodep->fileline(), format, false, argsp);
|
AstSFormatF* newp = new AstSFormatF(nodep->fileline(), format, false, argsp);
|
||||||
if (!newp->scopeNamep() && newp->formatScopeTracking()) {
|
if (!newp->scopeNamep() && newp->formatScopeTracking()) {
|
||||||
newp->scopeNamep(new AstScopeName(newp->fileline()));
|
newp->scopeNamep(new AstScopeName(newp->fileline()));
|
||||||
|
|
@ -3237,7 +3237,7 @@ private:
|
||||||
pinp = newp;
|
pinp = newp;
|
||||||
}
|
}
|
||||||
// AstPattern requires assignments to pass datatype on PRELIM
|
// AstPattern requires assignments to pass datatype on PRELIM
|
||||||
userIterate(pinp, WidthVP(portp->dtypep(), PRELIM).p()); VL_DANGLING(pinp);
|
VL_DO_DANGLING(userIterate(pinp, WidthVP(portp->dtypep(), PRELIM).p()), pinp);
|
||||||
}
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
// Stage 2
|
// Stage 2
|
||||||
|
|
@ -3250,7 +3250,7 @@ private:
|
||||||
if (!pinp) continue; // Argument error we'll find later
|
if (!pinp) continue; // Argument error we'll find later
|
||||||
// Change data types based on above accept completion
|
// Change data types based on above accept completion
|
||||||
if (portp->isDouble()) {
|
if (portp->isDouble()) {
|
||||||
spliceCvtD(pinp); VL_DANGLING(pinp);
|
VL_DO_DANGLING(spliceCvtD(pinp), pinp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3616,7 +3616,7 @@ private:
|
||||||
V3Number num (shiftp, 32, 0); num.opAssign(shiftp->num());
|
V3Number num (shiftp, 32, 0); num.opAssign(shiftp->num());
|
||||||
AstNode* shiftp = nodep->rhsp();
|
AstNode* shiftp = nodep->rhsp();
|
||||||
nodep->rhsp()->replaceWith(new AstConst(shiftp->fileline(), num));
|
nodep->rhsp()->replaceWith(new AstConst(shiftp->fileline(), num));
|
||||||
shiftp->deleteTree(); VL_DANGLING(shiftp);
|
VL_DO_DANGLING(shiftp->deleteTree(), shiftp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3780,7 +3780,7 @@ private:
|
||||||
num.isSigned(false);
|
num.isSigned(false);
|
||||||
AstNode* newp = new AstConst(nodep->fileline(), num);
|
AstNode* newp = new AstConst(nodep->fileline(), num);
|
||||||
constp->replaceWith(newp);
|
constp->replaceWith(newp);
|
||||||
pushDeletep(constp); VL_DANGLING(constp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(constp), constp); VL_DANGLING(nodep);
|
||||||
nodep = newp;
|
nodep = newp;
|
||||||
} else if (expWidth<nodep->width()) {
|
} else if (expWidth<nodep->width()) {
|
||||||
// Trunc - Extract
|
// Trunc - Extract
|
||||||
|
|
@ -3833,7 +3833,7 @@ private:
|
||||||
num.isSigned(expSigned);
|
num.isSigned(expSigned);
|
||||||
AstNode* newp = new AstConst(nodep->fileline(), num);
|
AstNode* newp = new AstConst(nodep->fileline(), num);
|
||||||
constp->replaceWith(newp);
|
constp->replaceWith(newp);
|
||||||
constp->deleteTree(); VL_DANGLING(constp); VL_DANGLING(nodep);
|
VL_DO_DANGLING(constp->deleteTree(), constp); VL_DANGLING(nodep);
|
||||||
nodep = newp;
|
nodep = newp;
|
||||||
} else {
|
} else {
|
||||||
AstNRelinker linker;
|
AstNRelinker linker;
|
||||||
|
|
@ -3858,7 +3858,7 @@ private:
|
||||||
if (debug()>4) constp->dumpTree(cout, " fixAutoExtend_old: ");
|
if (debug()>4) constp->dumpTree(cout, " fixAutoExtend_old: ");
|
||||||
if (debug()>4) newp->dumpTree(cout, " _new: ");
|
if (debug()>4) newp->dumpTree(cout, " _new: ");
|
||||||
constp->replaceWith(newp);
|
constp->replaceWith(newp);
|
||||||
constp->deleteTree(); VL_DANGLING(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.
|
||||||
nodepr = newp;
|
nodepr = newp;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -3876,7 +3876,7 @@ private:
|
||||||
if (debug()>4) constp->dumpTree(cout, " fixUnszExtend_old: ");
|
if (debug()>4) constp->dumpTree(cout, " fixUnszExtend_old: ");
|
||||||
if (debug()>4) newp->dumpTree(cout, " _new: ");
|
if (debug()>4) newp->dumpTree(cout, " _new: ");
|
||||||
constp->replaceWith(newp);
|
constp->replaceWith(newp);
|
||||||
constp->deleteTree(); VL_DANGLING(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.
|
||||||
nodepr = newp;
|
nodepr = newp;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -3997,7 +3997,7 @@ private:
|
||||||
nodep->v3error("Logical Operator "<<nodep->prettyTypeName()
|
nodep->v3error("Logical Operator "<<nodep->prettyTypeName()
|
||||||
<<" expects a non-complex data type on the "<<side<<".");
|
<<" expects a non-complex data type on the "<<side<<".");
|
||||||
underp->replaceWith(new AstConst(nodep->fileline(), AstConst::LogicFalse()));
|
underp->replaceWith(new AstConst(nodep->fileline(), AstConst::LogicFalse()));
|
||||||
pushDeletep(underp); VL_DANGLING(underp);
|
VL_DO_DANGLING(pushDeletep(underp), underp);
|
||||||
} else {
|
} else {
|
||||||
bool bad = widthBad(underp, nodep->findLogicBoolDType());
|
bool bad = widthBad(underp, nodep->findLogicBoolDType());
|
||||||
if (bad) {
|
if (bad) {
|
||||||
|
|
@ -4010,7 +4010,7 @@ private:
|
||||||
?" or "+cvtToStr(underp->widthMin()):"")
|
?" or "+cvtToStr(underp->widthMin()):"")
|
||||||
<<" bits.");
|
<<" bits.");
|
||||||
}
|
}
|
||||||
fixWidthReduce(underp); VL_DANGLING(underp); //Changed
|
VL_DO_DANGLING(fixWidthReduce(underp), underp); //Changed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4154,7 +4154,7 @@ private:
|
||||||
// V3Inst::pinReconnectSimple must deal
|
// V3Inst::pinReconnectSimple must deal
|
||||||
UINFO(5,"pinInSizeMismatch: "<<pinp);
|
UINFO(5,"pinInSizeMismatch: "<<pinp);
|
||||||
} else {
|
} else {
|
||||||
fixWidthExtend(underp, expDTypep, extendRule); VL_DANGLING(underp); // Changed
|
VL_DO_DANGLING(fixWidthExtend(underp, expDTypep, extendRule), underp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4264,7 +4264,7 @@ private:
|
||||||
UINFO(6," ReplaceWithUOrSVersion: "<<nodep<<" w/ "<<newp<<endl);
|
UINFO(6," ReplaceWithUOrSVersion: "<<nodep<<" w/ "<<newp<<endl);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
AstNodeBiop* replaceWithDVersion(AstNodeBiop* nodep) {
|
AstNodeBiop* replaceWithDVersion(AstNodeBiop* nodep) {
|
||||||
|
|
@ -4297,7 +4297,7 @@ private:
|
||||||
UINFO(6," ReplaceWithDVersion: "<<nodep<<" w/ "<<newp<<endl);
|
UINFO(6," ReplaceWithDVersion: "<<nodep<<" w/ "<<newp<<endl);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
// No width change; the default created type (bool or double) is correct
|
// No width change; the default created type (bool or double) is correct
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
AstNodeBiop* replaceWithNVersion(AstNodeBiop* nodep) {
|
AstNodeBiop* replaceWithNVersion(AstNodeBiop* nodep) {
|
||||||
|
|
@ -4325,7 +4325,7 @@ private:
|
||||||
UINFO(6," ReplaceWithNVersion: "<<nodep<<" w/ "<<newp<<endl);
|
UINFO(6," ReplaceWithNVersion: "<<nodep<<" w/ "<<newp<<endl);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
// No width change; the default created type (bool or string) is correct
|
// No width change; the default created type (bool or string) is correct
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
AstNodeUniop* replaceWithDVersion(AstNodeUniop* nodep) {
|
AstNodeUniop* replaceWithDVersion(AstNodeUniop* nodep) {
|
||||||
|
|
@ -4346,7 +4346,7 @@ private:
|
||||||
UINFO(6," ReplaceWithDVersion: "<<nodep<<" w/ "<<newp<<endl);
|
UINFO(6," ReplaceWithDVersion: "<<nodep<<" w/ "<<newp<<endl);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4367,7 +4367,7 @@ private:
|
||||||
argp->exprp()->unlinkFrBack()));
|
argp->exprp()->unlinkFrBack()));
|
||||||
fromp->lvalue(true);
|
fromp->lvalue(true);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
@ -4667,7 +4667,7 @@ private:
|
||||||
if (!VN_IS(nodep, Const)) {
|
if (!VN_IS(nodep, Const)) {
|
||||||
nodep->v3error(message);
|
nodep->v3error(message);
|
||||||
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
|
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AstNode* nodeForUnsizedWarning(AstNode* nodep) {
|
AstNode* nodeForUnsizedWarning(AstNode* nodep) {
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ class WidthRemoveVisitor : public AstNVisitor {
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstSigned* nodep) {
|
virtual void visit(AstSigned* nodep) {
|
||||||
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnsigned* nodep) {
|
virtual void visit(AstUnsigned* nodep) {
|
||||||
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
VL_DO_DANGLING(replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()), nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep) {
|
virtual void visit(AstNode* nodep) {
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
|
|
@ -52,7 +52,7 @@ private:
|
||||||
UINFO(6," Replace "<<nodep<<" w/ "<<newp<<endl);
|
UINFO(6," Replace "<<nodep<<" w/ "<<newp<<endl);
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
|
|
@ -122,7 +122,7 @@ private:
|
||||||
AstNode* oldp = nodep; nodep = newp;
|
AstNode* oldp = nodep; nodep = newp;
|
||||||
//if (debug()>4) oldp->dumpTree(cout, " fixConstSize_old: ");
|
//if (debug()>4) oldp->dumpTree(cout, " fixConstSize_old: ");
|
||||||
//if (debug()>4) newp->dumpTree(cout, " _new: ");
|
//if (debug()>4) newp->dumpTree(cout, " _new: ");
|
||||||
pushDeletep(oldp); VL_DANGLING(oldp);
|
VL_DO_DANGLING(pushDeletep(oldp), oldp);
|
||||||
}
|
}
|
||||||
editDType(nodep);
|
editDType(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ private:
|
||||||
if (!VN_IS(nodep, Const)) {
|
if (!VN_IS(nodep, Const)) {
|
||||||
nodep->v3error(message);
|
nodep->v3error(message);
|
||||||
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
|
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,7 +219,7 @@ private:
|
||||||
fromp, subp);
|
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(cout, "--SELBTn: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (AstPackArrayDType* adtypep = VN_CAST(ddtypep, PackArrayDType)) {
|
else if (AstPackArrayDType* adtypep = VN_CAST(ddtypep, PackArrayDType)) {
|
||||||
// SELBIT(array, index) -> SEL(array, index*width-of-subindex, width-of-subindex)
|
// SELBIT(array, index) -> SEL(array, index*width-of-subindex, width-of-subindex)
|
||||||
|
|
@ -248,7 +248,7 @@ private:
|
||||||
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(cout, "--SELBTn: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (AstAssocArrayDType* adtypep = VN_CAST(ddtypep, AssocArrayDType)) {
|
else if (AstAssocArrayDType* adtypep = VN_CAST(ddtypep, AssocArrayDType)) {
|
||||||
// SELBIT(array, index) -> ASSOCSEL(array, index)
|
// SELBIT(array, index) -> ASSOCSEL(array, index)
|
||||||
|
|
@ -257,7 +257,7 @@ private:
|
||||||
fromp, subp);
|
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(cout, "--SELBTn: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (AstQueueDType* adtypep = VN_CAST(ddtypep, QueueDType)) {
|
else if (AstQueueDType* adtypep = VN_CAST(ddtypep, QueueDType)) {
|
||||||
// SELBIT(array, index) -> CMETHODCALL(queue, "at", index)
|
// SELBIT(array, index) -> CMETHODCALL(queue, "at", index)
|
||||||
|
|
@ -266,7 +266,7 @@ private:
|
||||||
fromp, "at", subp);
|
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(cout, "--SELBTq: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (VN_IS(ddtypep, BasicDType)) {
|
else if (VN_IS(ddtypep, BasicDType)) {
|
||||||
// SELBIT(range, index) -> SEL(array, index, 1)
|
// SELBIT(range, index) -> SEL(array, index, 1)
|
||||||
|
|
@ -278,7 +278,7 @@ private:
|
||||||
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(cout, "--SELBTn: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); 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
|
||||||
// SELBIT(range, index) -> SEL(array, index, 1)
|
// SELBIT(range, index) -> SEL(array, index, 1)
|
||||||
|
|
@ -290,15 +290,15 @@ private:
|
||||||
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(cout, "--SELBTn: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else { // NULL=bad extract, or unknown node type
|
else { // NULL=bad extract, or unknown node type
|
||||||
nodep->v3error("Illegal bit or array select; type already selected, or bad dimension: type is"
|
nodep->v3error("Illegal bit or array select; type already selected, or bad dimension: type is"
|
||||||
<<fromdata.m_errp->prettyName());
|
<<fromdata.m_errp->prettyName());
|
||||||
// How to recover? We'll strip a dimension.
|
// How to recover? We'll strip a dimension.
|
||||||
nodep->replaceWith(fromp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
if (!rhsp->backp()) { pushDeletep(rhsp); VL_DANGLING(rhsp); }
|
if (!rhsp->backp()) { VL_DO_DANGLING(pushDeletep(rhsp), rhsp); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelExtract* nodep) {
|
virtual void visit(AstSelExtract* nodep) {
|
||||||
// Select of a range specified part of an array, i.e. "array[2:3]"
|
// Select of a range specified part of an array, i.e. "array[2:3]"
|
||||||
|
|
@ -325,15 +325,15 @@ private:
|
||||||
// Slice extraction
|
// Slice extraction
|
||||||
if (fromRange.elements() == elem
|
if (fromRange.elements() == elem
|
||||||
&& fromRange.lo() == lsb) { // Extracting whole of original array
|
&& fromRange.lo() == lsb) { // Extracting whole of original array
|
||||||
nodep->replaceWith(fromp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else if (fromRange.elements() == 1) { // Extracting single element
|
} else if (fromRange.elements() == 1) { // Extracting single element
|
||||||
AstArraySel* newp = new AstArraySel(nodep->fileline(), fromp, lsbp);
|
AstArraySel* newp = new AstArraySel(nodep->fileline(), fromp, lsbp);
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
} else { // Slice
|
} else { // Slice
|
||||||
AstSliceSel* newp = new AstSliceSel(nodep->fileline(), fromp,
|
AstSliceSel* newp = new AstSliceSel(nodep->fileline(), fromp,
|
||||||
VNumRange(VNumRange::LeftRight(),
|
VNumRange(VNumRange::LeftRight(),
|
||||||
msb, lsb));
|
msb, lsb));
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (AstPackArrayDType* adtypep = VN_CAST(ddtypep, PackArrayDType)) {
|
else if (AstPackArrayDType* adtypep = VN_CAST(ddtypep, PackArrayDType)) {
|
||||||
|
|
@ -365,7 +365,7 @@ private:
|
||||||
newp->dtypeFrom(sliceDType(adtypep, msb, lsb));
|
newp->dtypeFrom(sliceDType(adtypep, msb, lsb));
|
||||||
//if (debug()>=9) newp->dumpTree(cout, "--EXTBTn: ");
|
//if (debug()>=9) newp->dumpTree(cout, "--EXTBTn: ");
|
||||||
UASSERT_OBJ(newp->widthMin() == newp->widthConst(), nodep, "Width mismatch");
|
UASSERT_OBJ(newp->widthMin() == newp->widthConst(), nodep, "Width mismatch");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (VN_IS(ddtypep, BasicDType)) {
|
else if (VN_IS(ddtypep, BasicDType)) {
|
||||||
if (fromRange.littleEndian()) {
|
if (fromRange.littleEndian()) {
|
||||||
|
|
@ -387,7 +387,7 @@ private:
|
||||||
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(cout, "--SELEXnew: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else if (VN_IS(ddtypep, NodeUOrStructDType)) {
|
else if (VN_IS(ddtypep, NodeUOrStructDType)) {
|
||||||
// Classes aren't little endian
|
// Classes aren't little endian
|
||||||
|
|
@ -406,19 +406,19 @@ private:
|
||||||
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(cout, "--SELEXnew: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else { // NULL=bad extract, or unknown node type
|
else { // NULL=bad extract, or unknown node type
|
||||||
nodep->v3error("Illegal range select; type already selected, or bad dimension: type is "
|
nodep->v3error("Illegal range select; type already selected, or bad dimension: type is "
|
||||||
<<fromdata.m_errp->prettyName());
|
<<fromdata.m_errp->prettyName());
|
||||||
UINFO(1," Related ddtype: "<<ddtypep<<endl);
|
UINFO(1," Related ddtype: "<<ddtypep<<endl);
|
||||||
// How to recover? We'll strip a dimension.
|
// How to recover? We'll strip a dimension.
|
||||||
nodep->replaceWith(fromp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
// delete whatever we didn't use in reconstruction
|
// delete whatever we didn't use in reconstruction
|
||||||
if (!fromp->backp()) { pushDeletep(fromp); VL_DANGLING(fromp); }
|
if (!fromp->backp()) { VL_DO_DANGLING(pushDeletep(fromp), fromp); }
|
||||||
if (!msbp->backp()) { pushDeletep(msbp); VL_DANGLING(msbp); }
|
if (!msbp->backp()) { VL_DO_DANGLING(pushDeletep(msbp), msbp); }
|
||||||
if (!lsbp->backp()) { pushDeletep(lsbp); VL_DANGLING(lsbp); }
|
if (!lsbp->backp()) { VL_DO_DANGLING(pushDeletep(lsbp), lsbp); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceSelPlusMinus(AstNodePreSel* nodep) {
|
void replaceSelPlusMinus(AstNodePreSel* nodep) {
|
||||||
|
|
@ -479,18 +479,18 @@ private:
|
||||||
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(cout, "--SELNEW: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
else { // NULL=bad extract, or unknown node type
|
else { // NULL=bad extract, or unknown node type
|
||||||
nodep->v3error("Illegal +: or -: select; type already selected, or bad dimension: type is "
|
nodep->v3error("Illegal +: or -: select; type already selected, or bad dimension: type is "
|
||||||
<<fromdata.m_errp->prettyTypeName());
|
<<fromdata.m_errp->prettyTypeName());
|
||||||
// How to recover? We'll strip a dimension.
|
// How to recover? We'll strip a dimension.
|
||||||
nodep->replaceWith(fromp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
// delete whatever we didn't use in reconstruction
|
// delete whatever we didn't use in reconstruction
|
||||||
if (!fromp->backp()) { pushDeletep(fromp); VL_DANGLING(fromp); }
|
if (!fromp->backp()) { VL_DO_DANGLING(pushDeletep(fromp), fromp); }
|
||||||
if (!rhsp->backp()) { pushDeletep(rhsp); VL_DANGLING(rhsp); }
|
if (!rhsp->backp()) { VL_DO_DANGLING(pushDeletep(rhsp), rhsp); }
|
||||||
if (!widthp->backp()) { pushDeletep(widthp); VL_DANGLING(widthp); }
|
if (!widthp->backp()) { VL_DO_DANGLING(pushDeletep(widthp), widthp); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelPlus* nodep) {
|
virtual void visit(AstSelPlus* nodep) {
|
||||||
replaceSelPlusMinus(nodep);
|
replaceSelPlusMinus(nodep);
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,7 @@ sub treeop_exec_func {
|
||||||
|
|
||||||
$out .= "AstNode* newp = " . _exec_new_recurse($aref).";\n";
|
$out .= "AstNode* newp = " . _exec_new_recurse($aref).";\n";
|
||||||
$out .= "nodep->replaceWith(newp);";
|
$out .= "nodep->replaceWith(newp);";
|
||||||
$out .= "nodep->deleteTree(); VL_DANGLING(nodep);";
|
$out .= "VL_DO_DANGLING(nodep->deleteTree(), nodep);";
|
||||||
#print "FF $out\n" if $Debug;
|
#print "FF $out\n" if $Debug;
|
||||||
} elsif ($func eq "NEVER") {
|
} elsif ($func eq "NEVER") {
|
||||||
$out .= "nodep->v3fatalSrc(\"Executing transform that was NEVERed\");";
|
$out .= "nodep->v3fatalSrc(\"Executing transform that was NEVERed\");";
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ public:
|
||||||
// It's no longer implicit but a wire logic type
|
// It's no longer implicit but a wire logic type
|
||||||
AstBasicDType* newp = new AstBasicDType(dtypep->fileline(), AstBasicDTypeKwd::LOGIC,
|
AstBasicDType* newp = new AstBasicDType(dtypep->fileline(), AstBasicDTypeKwd::LOGIC,
|
||||||
dtypep->numeric(), dtypep->width(), dtypep->widthMin());
|
dtypep->numeric(), dtypep->width(), dtypep->widthMin());
|
||||||
dtypep->deleteTree(); VL_DANGLING(dtypep);
|
VL_DO_DANGLING(dtypep->deleteTree(), dtypep);
|
||||||
dtypep = newp;
|
dtypep = newp;
|
||||||
}
|
}
|
||||||
dtypep->rangep(finalRangep);
|
dtypep->rangep(finalRangep);
|
||||||
|
|
@ -2126,7 +2126,7 @@ loop_generate_construct<nodep>: // ==IEEE: loop_generate_construct
|
||||||
// for loop won't get an extra layer of hierarchy tacked on
|
// for loop won't get an extra layer of hierarchy tacked on
|
||||||
blkp->addGenforp(new AstGenFor($1,initp,$5,$7,lowerNoBegp));
|
blkp->addGenforp(new AstGenFor($1,initp,$5,$7,lowerNoBegp));
|
||||||
$$ = blkp;
|
$$ = blkp;
|
||||||
lowerBegp->deleteTree(); VL_DANGLING(lowerBegp);
|
VL_DO_DANGLING(lowerBegp->deleteTree(), lowerBegp);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void oneTest(int seed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
topp->final();
|
topp->final();
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv, char** env) {
|
int main(int argc, char** argv, char** env) {
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,6 @@ int main(int argc, char** argv, char** env) {
|
||||||
}
|
}
|
||||||
topp->final();
|
topp->final();
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ void make_and_destroy() {
|
||||||
topp->eval();
|
topp->eval();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ int main(int argc, char** argv, char** env) {
|
||||||
topp->eval();
|
topp->eval();
|
||||||
topp->final();
|
topp->final();
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,6 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -672,7 +672,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
if (tfp) tfp->close();
|
if (tfp) tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete topp; VL_DANGLING(topp);
|
VL_DO_DANGLING(delete topp, topp);
|
||||||
exit(0L);
|
exit(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue