Internals: Move iterators to AstNVisitor to avoid null this.
This commit is contained in:
parent
489f58011b
commit
05db8ce6c8
|
|
@ -268,8 +268,8 @@ technique lifted from graph traversal packages).
|
|||
A visitor first clears the one it wants to use by calling
|
||||
C<AstNode::user#ClearTree()>, then it can mark any node's user() with whatever
|
||||
data it wants. Readers just call C<< nodep->user() >>, but may need to cast
|
||||
appropriately, so you'll often see C<< nodep->userp()->castSOMETYPE() >>. At
|
||||
the top of each visitor are comments describing how the C<user()> stuff
|
||||
appropriately, so you'll often see C<< VN_CAST(nodep->userp(), SOMETYPE) >>.
|
||||
At the top of each visitor are comments describing how the C<user()> stuff
|
||||
applies to that visitor class. For example:
|
||||
|
||||
// NODE STATE
|
||||
|
|
@ -299,16 +299,13 @@ as it slows the program down to have to pass vup everywhere.)
|
|||
|
||||
=head2 Iterators
|
||||
|
||||
C<AstNode> provides a set of iterators to facilitate walking over the
|
||||
tree. Each takes two arguments, a visitor, C<v>, of type C<AstNVisitor> and
|
||||
an optional pointer user data, C<vup>, of type C<AstNUser*>. The second is
|
||||
one of the ways to pass parameters to visitors described in L</Visitor
|
||||
Functions>, but its use is now deprecated and should I<not> be used for new
|
||||
visitor classes.
|
||||
C<AstNVisitor> provides a set of iterators to facilitate walking over the
|
||||
tree. Each operates on the current C<AstNVisitor> class (as this) and takes
|
||||
an argument type C<AstNode*>.
|
||||
|
||||
=over 4
|
||||
|
||||
=item C<iterate()>
|
||||
=item C<iterate>
|
||||
|
||||
This just applies the C<accept> method of the C<AstNode> to the visitor
|
||||
function.
|
||||
|
|
@ -349,9 +346,9 @@ to be aware that calling iteration may cause the children to change. For
|
|||
example:
|
||||
|
||||
// nodep->lhsp() is 0x1234000
|
||||
nodep->lhsp()->iterateAndNext(...); // and under covers nodep->lhsp() changes
|
||||
iterateAndNextNull(nodep->lhsp()); // and under covers nodep->lhsp() changes
|
||||
// nodep->lhsp() is 0x5678400
|
||||
nodep->lhsp()->iterateAndNext(...);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
|
||||
Will work fine, as even if the first iterate causes a new node to take the
|
||||
place of the lhsp(), that edit will update nodep->lhsp() and the second
|
||||
|
|
@ -359,9 +356,9 @@ call will correctly see the change. Alternatively:
|
|||
|
||||
lp = nodep->lhsp();
|
||||
// nodep->lhsp() is 0x1234000, lp is 0x1234000
|
||||
lp->iterateAndNext(...); **lhsp=NULL;** // and under covers nodep->lhsp() changes
|
||||
iterateAndNextNull(lp); **lhsp=NULL;** // and under covers nodep->lhsp() changes
|
||||
// nodep->lhsp() is 0x5678400, lp is 0x1234000
|
||||
lp->iterateAndNext(...);
|
||||
iterateAndNextNull(lp);
|
||||
|
||||
This will cause bugs or a core dump, as lp is a dangling pointer. Thus it
|
||||
is advisable to set lhsp=NULL shown in the *'s above to make sure these
|
||||
|
|
@ -370,7 +367,7 @@ V3Width is to use acceptSubtreeReturnEdits, which operates on a single node
|
|||
and returns the new pointer if any. Note acceptSubtreeReturnEdits does not
|
||||
follow nextp() links.
|
||||
|
||||
lp = lp->acceptSubtreeReturnEdits()
|
||||
lp = acceptSubtreeReturnEdits(lp)
|
||||
|
||||
=head2 Identifying derived classes
|
||||
|
||||
|
|
@ -379,16 +376,16 @@ dealing with. For example a visitor might not implement separate C<visit>
|
|||
methods for C<AstIf> and C<AstGenIf>, but just a single method for the base
|
||||
class:
|
||||
|
||||
void visit (AstNodeIf* nodep, AstNUser* vup)
|
||||
void visit (AstNodeIf* nodep)
|
||||
|
||||
However that method might want to specify additional code if it is called
|
||||
for C<AstGenIf>. Verilator does this by providing a C<castSOMETYPE()>
|
||||
for C<AstGenIf>. Verilator does this by providing a C<VN_CAST>
|
||||
method for each possible node type, using C++ C<dynamic_cast>. This either
|
||||
returns a pointer to the object cast to that type (if it is of class
|
||||
C<SOMETYPE>, or a derived class of C<SOMETYPE>) or else NULL. So our
|
||||
C<visit> method could use:
|
||||
|
||||
if (nodep->castAstGenIf()) {
|
||||
if (VN_CAST(nodep, AstGenIf) {
|
||||
<code specific to AstGenIf>
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ private:
|
|||
m_iActivep = NULL;
|
||||
m_cActivep = NULL;
|
||||
m_activeVec.clear();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Don't clear scopep, the namer persists beyond this visit
|
||||
}
|
||||
virtual void visit(AstSenTree* nodep) {
|
||||
|
|
@ -91,7 +91,7 @@ private:
|
|||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
// METHODS
|
||||
public:
|
||||
|
|
@ -154,7 +154,7 @@ public:
|
|||
}
|
||||
virtual ~ActiveNamer() {}
|
||||
void main(AstScope* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ private:
|
|||
if (m_check == CT_SEQ) {
|
||||
AstNode* las = m_assignp;
|
||||
m_assignp = nodep;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_assignp = las;
|
||||
}
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ private:
|
|||
}
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -225,7 +225,7 @@ public:
|
|||
m_alwaysp = nodep;
|
||||
m_check = check;
|
||||
m_assignp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ActiveDlyVisitor() {}
|
||||
};
|
||||
|
|
@ -252,7 +252,7 @@ private:
|
|||
// Clear last scope's names, and collect this scope's existing names
|
||||
m_namer.main(nodep);
|
||||
m_scopeFinalp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
// Actives are being formed, so we can ignore any already made
|
||||
|
|
@ -325,7 +325,7 @@ private:
|
|||
// Read sensitivitues
|
||||
m_itemCombo = false;
|
||||
m_itemSequent = false;
|
||||
if (oldsensesp) oldsensesp->iterateAndNext(*this);
|
||||
iterateAndNextNull(oldsensesp);
|
||||
bool combo = m_itemCombo;
|
||||
bool sequent = m_itemSequent;
|
||||
|
||||
|
|
@ -399,7 +399,7 @@ private:
|
|||
&& subitemp->edgeType() != AstEdgeType::ET_NEGEDGE) {
|
||||
nodep->v3fatalSrc("Strange activity type under SenGate");
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSenItem* nodep) {
|
||||
if (nodep->edgeType() == AstEdgeType::ET_ANYEDGE) {
|
||||
|
|
@ -421,7 +421,7 @@ private:
|
|||
virtual void visit(AstVarScope* nodep) {}
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -429,7 +429,7 @@ public:
|
|||
m_scopeFinalp = NULL;
|
||||
m_itemCombo = false;
|
||||
m_itemSequent = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ActiveVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@ private:
|
|||
virtual void visit(AstTopScope* nodep) {
|
||||
m_topscopep = nodep;
|
||||
m_finder.main(m_topscopep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_topscopep = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
// Create required actives and add to module
|
||||
// We can start ordering at a module, or a scope
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
UINFO(4," ACTIVE "<<nodep<<endl);
|
||||
|
|
@ -118,7 +118,7 @@ private:
|
|||
nodep->sensesp(wantp);
|
||||
}
|
||||
// No need to do statements under it, they're already moved.
|
||||
//nodep->iterateChildren(*this);
|
||||
//iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstInitial* nodep) {
|
||||
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
||||
|
|
@ -143,13 +143,13 @@ private:
|
|||
virtual void visit(AstVarScope* nodep) {}
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit ActiveTopVisitor(AstNetlist* nodep) {
|
||||
m_topscopep = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ActiveTopVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -197,14 +197,14 @@ private:
|
|||
// If this statement ends with 'else if', then nextIf will point to the
|
||||
// nextIf statement. Otherwise it will be null.
|
||||
AstNodeIf* nextifp = dynamic_cast<AstNodeIf*>(ifp->elsesp());
|
||||
ifp->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(ifp->condp());
|
||||
|
||||
// Recurse into the true case.
|
||||
ifp->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(ifp->ifsp());
|
||||
|
||||
// If the last else is not an else if, recurse into that too.
|
||||
if (ifp->elsesp() && !nextifp) {
|
||||
ifp->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(ifp->elsesp());
|
||||
}
|
||||
|
||||
// Build a bitmask of the true predicates
|
||||
|
|
@ -242,13 +242,13 @@ private:
|
|||
nodep->replaceWith(checkifp);
|
||||
pushDeletep(nodep);
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
// VISITORS //========== Case assertions
|
||||
virtual void visit(AstCase* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->user1SetOnce()) {
|
||||
bool has_default=false;
|
||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=VN_CAST(itemp->nextp(), CaseItem)) {
|
||||
|
|
@ -306,7 +306,7 @@ private:
|
|||
|
||||
// VISITORS //========== Statements
|
||||
virtual void visit(AstDisplay* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Replace the special types with standard text
|
||||
if (nodep->displayType()==AstDisplayType::DT_INFO) {
|
||||
replaceDisplay(nodep, "-Info");
|
||||
|
|
@ -319,13 +319,13 @@ private:
|
|||
}
|
||||
|
||||
virtual void visit(AstNodePslCoverOrAssert* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_beginp && nodep->name() == "") nodep->name(m_beginp->name());
|
||||
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
||||
nodep->stmtsp(), nodep->name()); VL_DANGLING(nodep);
|
||||
}
|
||||
virtual void visit(AstVAssert* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
newVAssertion(nodep, nodep->propp()); VL_DANGLING(nodep);
|
||||
++m_statAsSV;
|
||||
}
|
||||
|
|
@ -333,7 +333,7 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
//
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Reset defaults
|
||||
m_modp = NULL;
|
||||
}
|
||||
|
|
@ -343,13 +343,13 @@ private:
|
|||
AstBegin* lastp = m_beginp;
|
||||
{
|
||||
m_beginp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_beginp = lastp;
|
||||
}
|
||||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -357,7 +357,7 @@ public:
|
|||
m_beginp = NULL;
|
||||
m_modp = NULL;
|
||||
// Process
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~AssertVisitor() {
|
||||
V3Stats::addStat("Assertions, PSL asserts", m_statAsPsl);
|
||||
|
|
|
|||
|
|
@ -89,12 +89,12 @@ private:
|
|||
virtual void visit(AstNodePslCoverOrAssert* nodep) {
|
||||
if (nodep->sentreep()) return; // Already processed
|
||||
clearAssertInfo();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->sentreep(newSenTree(nodep));
|
||||
clearAssertInfo();
|
||||
}
|
||||
virtual void visit(AstPslClocked* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_senip) {
|
||||
nodep->v3error("Unsupported: Only one PSL clock allowed per assertion");
|
||||
}
|
||||
|
|
@ -112,12 +112,12 @@ private:
|
|||
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Reset defaults
|
||||
m_seniDefaultp = NULL;
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -126,7 +126,7 @@ public:
|
|||
m_seniDefaultp = NULL;
|
||||
clearAssertInfo();
|
||||
// Process
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~AssertPreVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ void AstNode::addNextHere(AstNode* newp) {
|
|||
// Add to m_nextp on exact node passed, not at the end.
|
||||
// This could be at head, tail, or both (single)
|
||||
// New could be head of single node, or list
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<AstNode*>(this),"this should not be NULL"););
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<const AstNode*>(this),"this should not be NULL"););
|
||||
UASSERT(newp,"Null item passed to addNext");
|
||||
UASSERT(newp->backp()==NULL,"New node (back) already assigned?");
|
||||
this->debugTreeChange("-addHereThs: ", __LINE__, false);
|
||||
|
|
@ -646,7 +646,7 @@ AstNode* AstNode::cloneTreeIterList() {
|
|||
}
|
||||
|
||||
AstNode* AstNode::cloneTree(bool cloneNextLink) {
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<AstNode*>(this),"this should not be NULL"););
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<const AstNode*>(this),"this should not be NULL"););
|
||||
this->debugTreeChange("-cloneThs: ", __LINE__, cloneNextLink);
|
||||
cloneClearTree();
|
||||
AstNode* newp;
|
||||
|
|
@ -802,7 +802,7 @@ void AstNode::iterateAndNext(AstNVisitor& v) {
|
|||
}
|
||||
|
||||
void AstNode::iterateListBackwards(AstNVisitor& v) {
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<AstNode*>(this),"this should not be NULL"););
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<const AstNode*>(this),"this should not be NULL"););
|
||||
AstNode* nodep=this;
|
||||
while (nodep->m_nextp) nodep=nodep->m_nextp;
|
||||
while (nodep) {
|
||||
|
|
@ -822,8 +822,8 @@ void AstNode::iterateChildrenBackwards(AstNVisitor& v) {
|
|||
|
||||
void AstNode::iterateAndNextConst(AstNVisitor& v) {
|
||||
// Keep following the current list even if edits change it
|
||||
if (!this) return; // A few cases could be cleaned up, but want symmetry with iterateAndNext
|
||||
for (AstNode* nodep=this; nodep; ) { // effectively: if (!this) return; // Callers rely on this
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<const AstNode*>(this),"this should not be NULL"););
|
||||
for (AstNode* nodep=this; nodep; ) {
|
||||
AstNode* nnextp = nodep->m_nextp;
|
||||
ASTNODE_PREFETCH(nnextp);
|
||||
nodep->accept(v);
|
||||
|
|
@ -871,6 +871,7 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) {
|
|||
|
||||
void AstNode::cloneRelinkTree() {
|
||||
// private: Cleanup clone() operation on whole tree. Publicly call cloneTree() instead.
|
||||
UDEBUGONLY(UASSERT(dynamic_cast<const AstNode*>(this),"this should not be NULL"););
|
||||
for (AstNode* nodep=this; nodep; nodep=nodep->m_nextp) {
|
||||
if (m_dtypep && m_dtypep->clonep()) {
|
||||
m_dtypep = m_dtypep->clonep();
|
||||
|
|
@ -896,7 +897,7 @@ bool AstNode::gateTreeIter() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AstNode::sameTreeIter(const AstNode* node1p, const AstNode* node2p, bool ignNext, bool gateOnly) const {
|
||||
bool AstNode::sameTreeIter(const AstNode* node1p, const AstNode* node2p, bool ignNext, bool gateOnly) {
|
||||
// private: Return true if the two trees are identical
|
||||
if (!node1p && !node2p) return true;
|
||||
if (!node1p || !node2p) return false;
|
||||
|
|
|
|||
63
src/V3Ast.h
63
src/V3Ast.h
|
|
@ -917,6 +917,21 @@ public:
|
|||
virtual ~AstNVisitor() {
|
||||
doDeletes();
|
||||
}
|
||||
/// Call visit()s on nodep
|
||||
void iterate(AstNode* nodep);
|
||||
/// Call visit()s on nodep's children
|
||||
void iterateChildren(AstNode* nodep);
|
||||
/// Call visit()s on nodep's children in backp() order
|
||||
void iterateChildrenBackwards(AstNode* nodep);
|
||||
/// Call visit()s on const nodep's children
|
||||
void iterateChildrenConst(AstNode* nodep);
|
||||
/// Call visit()s on nodep (maybe NULL) and nodep's nextp() list
|
||||
void iterateAndNextNull(AstNode* nodep);
|
||||
/// Call visit()s on const nodep (maybe NULL) and nodep's nextp() list
|
||||
void iterateAndNextConstNull(AstNode* nodep);
|
||||
/// Return edited nodep; see comments in V3Ast.cpp
|
||||
AstNode* iterateSubtreeReturnEdits(AstNode* nodep);
|
||||
|
||||
#include "V3Ast__gen_visitor.h" // From ./astgen
|
||||
// Things like:
|
||||
// virtual void visit(AstBreak* nodep) { visit((AstNodeStmt*)(nodep)); }
|
||||
|
|
@ -1051,14 +1066,13 @@ class AstNode {
|
|||
void op4p(AstNode* nodep) { m_op4p = nodep; if (nodep) nodep->m_backp = this; }
|
||||
|
||||
void init(); // initialize value of AstNode
|
||||
void iterateListBackwards(AstNVisitor& v);
|
||||
private:
|
||||
AstNode* cloneTreeIter();
|
||||
AstNode* cloneTreeIterList();
|
||||
void checkTreeIter(AstNode* backp);
|
||||
void checkTreeIterList(AstNode* backp);
|
||||
bool gateTreeIter() const;
|
||||
bool sameTreeIter(const AstNode* node1p, const AstNode* node2p, bool ignNext, bool gateOnly) const;
|
||||
static bool sameTreeIter(const AstNode* node1p, const AstNode* node2p, bool ignNext, bool gateOnly);
|
||||
void deleteTreeIter();
|
||||
void deleteNode();
|
||||
public:
|
||||
|
|
@ -1352,15 +1366,21 @@ public:
|
|||
|
||||
// INVOKERS
|
||||
virtual void accept(AstNVisitor& v) = 0;
|
||||
void iterate(AstNVisitor& v) { this->accept(v); } // Does this; excludes following this->next
|
||||
void iterateAndNext(AstNVisitor& v);
|
||||
void iterateAndNextConst(AstNVisitor& v);
|
||||
void iterateChildren(AstNVisitor& v); // Excludes following this->next
|
||||
void iterateChildrenBackwards(AstNVisitor& v); // Excludes following this->next
|
||||
void iterateChildrenConst(AstNVisitor& v); // Excludes following this->next
|
||||
AstNode* iterateSubtreeReturnEdits(AstNVisitor& v); // Return edited nodep; see comments in V3Ast.cpp
|
||||
|
||||
protected:
|
||||
// All AstNVisitor related functions are called as methods off the visitor
|
||||
friend class AstNVisitor;
|
||||
void iterateChildren(AstNVisitor& v); // Use instead AstNVisitor::iterateChildren
|
||||
void iterateChildrenBackwards(AstNVisitor& v); // Use instead AstNVisitor::iterateChildrenBackwards
|
||||
void iterateChildrenConst(AstNVisitor& v); // Use instead AstNVisitor::iterateChildrenConst
|
||||
void iterateAndNext(AstNVisitor& v); // Use instead AstNVisitor::iterateAndNextNull
|
||||
void iterateAndNextConst(AstNVisitor& v); // Use instead AstNVisitor::iterateAndNextConstNull
|
||||
AstNode* iterateSubtreeReturnEdits(AstNVisitor& v); // Use instead AstNVisitor::iterateSubtreeReturnEdits
|
||||
private:
|
||||
void iterateListBackwards(AstNVisitor& v);
|
||||
|
||||
// CONVERSION
|
||||
public:
|
||||
#include "V3Ast__gen_interface.h" // From ./astgen
|
||||
// Things like:
|
||||
// AstAlways* castAlways();
|
||||
|
|
@ -2096,6 +2116,31 @@ public:
|
|||
// inline AstAlways* AstNode::castAlways() { return dynamic_cast<AstAlways*>(this);}
|
||||
// inline bool AstNode::privateIsaAlways(const AstNode* nodep) { return nodep && nodep->type() == AstType::atAlways; }
|
||||
|
||||
//######################################################################
|
||||
// Inline AstNVisitor METHODS
|
||||
|
||||
inline void AstNVisitor::iterate(AstNode* nodep) {
|
||||
nodep->accept(*this);
|
||||
}
|
||||
inline void AstNVisitor::iterateChildren(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
inline void AstNVisitor::iterateChildrenBackwards(AstNode* nodep) {
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
}
|
||||
inline void AstNVisitor::iterateChildrenConst(AstNode* nodep) {
|
||||
nodep->iterateChildrenConst(*this);
|
||||
}
|
||||
inline void AstNVisitor::iterateAndNextNull(AstNode* nodep) {
|
||||
if (VL_LIKELY(nodep)) nodep->iterateAndNext(*this);
|
||||
}
|
||||
inline void AstNVisitor::iterateAndNextConstNull(AstNode* nodep) {
|
||||
if (VL_LIKELY(nodep)) nodep->iterateAndNextConst(*this);
|
||||
}
|
||||
inline AstNode* AstNVisitor::iterateSubtreeReturnEdits(AstNode* nodep) {
|
||||
return nodep->iterateSubtreeReturnEdits(*this);
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// Inline ACCESSORS
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
m_repeatNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
|
|
@ -107,7 +107,7 @@ private:
|
|||
m_namedScope = "";
|
||||
m_unnamedScope = "";
|
||||
m_ftaskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ftaskp = NULL;
|
||||
}
|
||||
m_namedScope = oldScope;
|
||||
|
|
@ -143,7 +143,7 @@ private:
|
|||
}
|
||||
|
||||
// Remap var names and replace lower Begins
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
if (nodep->genforp()) nodep->v3fatalSrc("GENFORs should have been expanded earlier");
|
||||
}
|
||||
m_namedScope = oldScope;
|
||||
|
|
@ -184,7 +184,7 @@ private:
|
|||
nodep->unlinkFrBack();
|
||||
m_modp->addStmtp(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVarXRef* nodep) {
|
||||
UINFO(9, " VARXREF "<<nodep<<endl);
|
||||
|
|
@ -204,12 +204,12 @@ private:
|
|||
nodep->scopeAttrp(new AstText(nodep->fileline(), (string)"__DOT__"+m_namedScope));
|
||||
if (afterp) nodep->scopeAttrp(afterp);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCoverDecl* nodep) {
|
||||
// Don't need to fix path in coverage statements, they're not under
|
||||
// any BEGINs, but V3Coverage adds them all under the module itself.
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
// VISITORS - LINT CHECK
|
||||
virtual void visit(AstIf* nodep) { // Note not AstNodeIf; other types don't get covered
|
||||
|
|
@ -223,11 +223,11 @@ private:
|
|||
nodep->fileline()->modifyWarnOff(V3ErrorCode::IFDEPTH, true); // Warn only once
|
||||
m_ifDepth = -1;
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ifDepth = prevIfDepth;
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -237,7 +237,7 @@ public:
|
|||
m_ftaskp = NULL;
|
||||
m_repeatNum = 0;
|
||||
m_ifDepth = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~BeginVisitor() {}
|
||||
};
|
||||
|
|
@ -257,14 +257,14 @@ private:
|
|||
UINFO(9, " relinkFTask "<<nodep<<endl);
|
||||
nodep->name(nodep->taskp()->name());
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
if (nodep->varp()->user1()) { // It was converted
|
||||
UINFO(9, " relinVarRef "<<nodep<<endl);
|
||||
nodep->name(nodep->varp()->name());
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstIfaceRefDType* nodep) {
|
||||
// May have changed cell names
|
||||
|
|
@ -272,16 +272,16 @@ private:
|
|||
UINFO(8," IFACEREFDTYPE "<<nodep<<endl);
|
||||
if (nodep->cellp()) nodep->cellName(nodep->cellp()->name());
|
||||
UINFO(8," rename to "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
BeginRelinkVisitor(AstNetlist* nodep, BeginState*) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~BeginRelinkVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -82,12 +82,12 @@ private:
|
|||
{
|
||||
// Do if
|
||||
reset();
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
int ifLikely = m_likely;
|
||||
int ifUnlikely = m_unlikely;
|
||||
// Do else
|
||||
reset();
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
int elseLikely = m_likely;
|
||||
int elseUnlikely = m_unlikely;
|
||||
// Compute
|
||||
|
|
@ -104,16 +104,16 @@ private:
|
|||
virtual void visit(AstCCall* nodep) {
|
||||
checkUnlikely(nodep);
|
||||
nodep->funcp()->user1Inc();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
checkUnlikely(nodep);
|
||||
m_cfuncsp.push_back(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
checkUnlikely(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// METHODS
|
||||
|
|
@ -130,7 +130,7 @@ public:
|
|||
// CONSTUCTORS
|
||||
explicit BranchVisitor(AstNetlist* nodep) {
|
||||
reset();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
calc_tasks();
|
||||
}
|
||||
virtual ~BranchVisitor() {}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ private:
|
|||
// METHODS
|
||||
void processAndIterate(AstNode* nodep) {
|
||||
BrokenTable::addInTree(nodep, nodep->maybePointedTo());
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
}
|
||||
// VISITORS
|
||||
virtual void visit(AstNode* nodep) {
|
||||
|
|
@ -202,7 +202,7 @@ private:
|
|||
public:
|
||||
// CONSTUCTORS
|
||||
explicit BrokenMarkVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~BrokenMarkVisitor() {}
|
||||
};
|
||||
|
|
@ -239,7 +239,7 @@ private:
|
|||
if (const AstNodeDType* dnodep = VN_CAST(nodep, NodeDType)) checkWidthMin(dnodep);
|
||||
}
|
||||
checkWidthMin(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
BrokenTable::setUnder(nodep,false);
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
|
|
@ -257,7 +257,7 @@ private:
|
|||
public:
|
||||
// CONSTUCTORS
|
||||
explicit BrokenCheckVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~BrokenCheckVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ private:
|
|||
// Check for X/Z in non-casex statements
|
||||
{
|
||||
m_caseExprp = nodep;
|
||||
nodep->exprp()->accept(*this);
|
||||
iterate(nodep->exprp());
|
||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=VN_CAST(itemp->nextp(), CaseItem)) {
|
||||
itemp->condsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(itemp->condsp());
|
||||
}
|
||||
m_caseExprp = NULL;
|
||||
}
|
||||
|
|
@ -108,13 +108,13 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit CaseLintVisitor(AstNodeCase* nodep) {
|
||||
m_caseExprp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CaseLintVisitor() {}
|
||||
};
|
||||
|
|
@ -453,7 +453,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstCase* nodep) {
|
||||
V3Case::caseLint(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (debug()>=9) nodep->dumpTree(cout," case_old: ");
|
||||
if (isCaseTreeFast(nodep) && v3Global.opt.oCase()) {
|
||||
// It's a simple priority encoder or complete statement
|
||||
|
|
@ -468,14 +468,14 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit CaseVisitor(AstNetlist* nodep) {
|
||||
m_caseNoOverlapsAllCovered = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CaseVisitor() {
|
||||
V3Stats::addStat("Optimizations, Cases parallelized", m_statCaseFast);
|
||||
|
|
|
|||
|
|
@ -108,19 +108,19 @@ private:
|
|||
|
||||
// VISITORS
|
||||
virtual void visit(AstNodeUniop* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user1(nodep->lhsp()->user1());
|
||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||
}
|
||||
virtual void visit(AstNodeBiop* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user1(nodep->lhsp()->user1()
|
||||
| nodep->rhsp()->user1());
|
||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
||||
}
|
||||
virtual void visit(AstNodeTriop* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user1(nodep->lhsp()->user1()
|
||||
| nodep->rhsp()->user1()
|
||||
| nodep->thsp()->user1());
|
||||
|
|
@ -129,12 +129,12 @@ private:
|
|||
if (nodep->sizeMattersThs()) insureCast(nodep->thsp());
|
||||
}
|
||||
virtual void visit(AstCCast* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureLower32Cast(nodep);
|
||||
nodep->user1(1);
|
||||
}
|
||||
virtual void visit(AstNegate* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user1(nodep->lhsp()->user1());
|
||||
if (nodep->lhsp()->widthMin()==1) {
|
||||
// We want to avoid a GCC "converting of negative value" warning
|
||||
|
|
@ -171,13 +171,13 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit CastVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CastVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -145,13 +145,13 @@ private:
|
|||
*m_ofp<<nodep->prettyTypeName()<<" "<<endl;
|
||||
string lastPrefix = m_prefix;
|
||||
m_prefix = lastPrefix + "1:";
|
||||
nodep->op1p()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->op1p());
|
||||
m_prefix = lastPrefix + "2:";
|
||||
nodep->op2p()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->op2p());
|
||||
m_prefix = lastPrefix + "3:";
|
||||
nodep->op3p()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->op3p());
|
||||
m_prefix = lastPrefix + "4:";
|
||||
nodep->op4p()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->op4p());
|
||||
m_prefix = lastPrefix;
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ public:
|
|||
CdcDumpVisitor(AstNode* nodep, std::ofstream* ofp, const string& prefix) {
|
||||
m_ofp = ofp;
|
||||
m_prefix = prefix;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CdcDumpVisitor() {}
|
||||
};
|
||||
|
|
@ -173,7 +173,7 @@ private:
|
|||
size_t m_maxFilenameLen;
|
||||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Keeping line+filename lengths separate is much faster than calling ascii().length()
|
||||
if (nodep->fileline()->lineno() >= m_maxLineno) {
|
||||
m_maxLineno = nodep->fileline()->lineno()+1;
|
||||
|
|
@ -187,7 +187,7 @@ public:
|
|||
explicit CdcWidthVisitor(AstNode* nodep) {
|
||||
m_maxLineno = 0;
|
||||
m_maxFilenameLen = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CdcWidthVisitor() {}
|
||||
// ACCESSORS
|
||||
|
|
@ -241,7 +241,7 @@ private:
|
|||
m_logicVertexp->dstDomainp(m_domainp);
|
||||
m_logicVertexp->dstDomainSet(true);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_logicVertexp = NULL;
|
||||
|
||||
if (0 && debug()>=9) {
|
||||
|
|
@ -606,14 +606,14 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
UINFO(4," SCOPE "<<nodep<<endl);
|
||||
m_scopep = nodep;
|
||||
m_logicVertexp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
|
|
@ -657,14 +657,14 @@ private:
|
|||
}
|
||||
virtual void visit(AstAssignDly* nodep) {
|
||||
m_inDly = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inDly = false;
|
||||
}
|
||||
virtual void visit(AstSenItem* nodep) {
|
||||
// Note we look at only AstSenItems, not AstSenGate's
|
||||
// The gating term of a AstSenGate is normal logic
|
||||
m_inSenItem = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inSenItem = false;
|
||||
}
|
||||
virtual void visit(AstAlways* nodep) {
|
||||
|
|
@ -691,21 +691,21 @@ private:
|
|||
// Math that shouldn't cause us to clear hazard
|
||||
virtual void visit(AstConst* nodep) { }
|
||||
virtual void visit(AstReplicate* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstConcat* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNot* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSel* nodep) {
|
||||
if (!VN_IS(nodep->lsbp(), Const)) setNodeHazard(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeSel* nodep) {
|
||||
if (!VN_IS(nodep->bitp(), Const)) setNodeHazard(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// Ignores
|
||||
|
|
@ -718,10 +718,10 @@ private:
|
|||
// Default
|
||||
virtual void visit(AstNodeMath* nodep) {
|
||||
setNodeHazard(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -747,7 +747,7 @@ public:
|
|||
*m_ofp<<"repeating recursively forwards to the destination flop(s).\n";
|
||||
*m_ofp<<"%% Indicates the operator considered potentially hazardous.\n";
|
||||
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
analyze();
|
||||
if (debug()>=1) edgeReport(); // Not useful to users at the moment
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ private:
|
|||
m_newLvEqnp = new AstArraySel(nodep->fileline(), m_newLvEqnp->cloneTree(true), index);
|
||||
m_newRvEqnp = new AstArraySel(nodep->fileline(), m_newRvEqnp->cloneTree(true), index);
|
||||
|
||||
nodep->subDTypep()->skipRefp()->accept(*this);
|
||||
iterate(nodep->subDTypep()->skipRefp());
|
||||
|
||||
m_varEqnp->deleteTree();
|
||||
m_newLvEqnp->deleteTree();
|
||||
|
|
@ -181,7 +181,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (debug()) nodep->dumpTree(cout,"-DETECTARRAY-general-");
|
||||
m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable"
|
||||
" (probably with UNOPTFLAT warning suppressed): "
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
m_newLvEqnp = new AstVarRef(m_vscp->fileline(), m_newvscp, true);
|
||||
m_newRvEqnp = new AstVarRef(m_vscp->fileline(), m_newvscp, false);
|
||||
}
|
||||
vscp->dtypep()->skipRefp()->accept(*this);
|
||||
iterate(vscp->dtypep()->skipRefp());
|
||||
m_varEqnp->deleteTree();
|
||||
m_newLvEqnp->deleteTree();
|
||||
m_newRvEqnp->deleteTree();
|
||||
|
|
@ -248,7 +248,7 @@ private:
|
|||
if (nodep->isTop()) {
|
||||
m_statep->m_topModp = nodep;
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
|
|
@ -271,7 +271,7 @@ private:
|
|||
m_statep->maybeCreateChgFuncp();
|
||||
m_statep->m_chgFuncp->addStmtsp(new AstChangeDet(nodep->fileline(), NULL, NULL, false));
|
||||
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVarScope* nodep) {
|
||||
if (nodep->isCircular()) {
|
||||
|
|
@ -287,14 +287,14 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
ChangedVisitor(AstNetlist* nodep, ChangedState* statep) {
|
||||
m_statep = statep;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ChangedVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ private:
|
|||
|
||||
// Base type handling methods
|
||||
void operandBiop(AstNodeBiop* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
if (nodep->cleanLhs()) {
|
||||
insureClean(nodep->lhsp());
|
||||
|
|
@ -159,7 +159,7 @@ private:
|
|||
//no setClean.. must do it in each user routine.
|
||||
}
|
||||
void operandTriop(AstNodeTriop* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
if (nodep->cleanLhs()) {
|
||||
insureClean(nodep->lhsp());
|
||||
|
|
@ -176,11 +176,11 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeUniop* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
if (nodep->cleanLhs()) {
|
||||
insureClean(nodep->lhsp());
|
||||
|
|
@ -204,12 +204,12 @@ private:
|
|||
setClean (nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
|
||||
}
|
||||
virtual void visit(AstNodeMath* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
setClean (nodep, nodep->cleanOut());
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
if (nodep->cleanRhs()) {
|
||||
insureClean(nodep->rhsp());
|
||||
|
|
@ -226,7 +226,7 @@ private:
|
|||
setClean (nodep, nodep->cleanOut());
|
||||
}
|
||||
virtual void visit(AstUCFunc* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
setClean (nodep, false);
|
||||
// We always clean, as we don't trust those pesky users.
|
||||
|
|
@ -236,43 +236,43 @@ private:
|
|||
insureCleanAndNext (nodep->bodysp());
|
||||
}
|
||||
virtual void visit(AstTraceInc* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureCleanAndNext (nodep->valuep());
|
||||
}
|
||||
virtual void visit(AstTypedef* nodep) {
|
||||
// No cleaning, or would loose pointer to enum
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstParamTypeDType* nodep) {
|
||||
// No cleaning, or would loose pointer to enum
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// Control flow operators
|
||||
virtual void visit(AstNodeCond* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureClean(nodep->condp());
|
||||
setClean(nodep, isClean(nodep->expr1p()) && isClean(nodep->expr2p()));
|
||||
}
|
||||
virtual void visit(AstWhile* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureClean(nodep->condp());
|
||||
}
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureClean(nodep->condp());
|
||||
}
|
||||
virtual void visit(AstSFormatF* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureCleanAndNext (nodep->exprsp());
|
||||
setClean(nodep, true); // generates a string, so not relevant
|
||||
}
|
||||
virtual void visit(AstUCStmt* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureCleanAndNext (nodep->bodysp());
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
insureCleanAndNext (nodep->argsp());
|
||||
setClean (nodep, true);
|
||||
}
|
||||
|
|
@ -280,14 +280,14 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
computeCppWidth(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit CleanVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CleanVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ private:
|
|||
bool m_isSimple; // Set false when we know it isn't simple
|
||||
// METHODS
|
||||
inline void okIterate(AstNode* nodep) {
|
||||
if (m_isSimple) nodep->iterateChildren(*this);
|
||||
if (m_isSimple) iterateChildren(nodep);
|
||||
}
|
||||
// VISITORS
|
||||
virtual void visit(AstOr* nodep) { okIterate(nodep); }
|
||||
|
|
@ -213,13 +213,13 @@ private:
|
|||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
m_isSimple = false;
|
||||
//nodep->iterateChildren(*this);
|
||||
//iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit GaterCondVisitor(AstNode* nodep) {
|
||||
m_isSimple = true;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~GaterCondVisitor() {}
|
||||
// PUBLIC METHODS
|
||||
|
|
@ -283,7 +283,7 @@ class GaterBodyVisitor : public GaterBaseVisitor {
|
|||
uint32_t childstate;
|
||||
{
|
||||
m_state = STATE_UNKNOWN;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
childstate = m_state;
|
||||
}
|
||||
m_state = oldstate;
|
||||
|
|
@ -305,7 +305,7 @@ class GaterBodyVisitor : public GaterBaseVisitor {
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -315,7 +315,7 @@ public:
|
|||
m_state = STATE_UNKNOWN;
|
||||
m_cloning = false;
|
||||
if (debug()>=9) nodep->dumpTree(cout," GateBodyIn: ");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
if (debug()>=9) nodep->dumpTree(cout," GateBodyOut: ");
|
||||
// If there's no statements we shouldn't have had a resulting graph
|
||||
// vertex asking for this creation
|
||||
|
|
@ -802,17 +802,17 @@ class GaterVisitor : public GaterBaseVisitor {
|
|||
GaterIfVertex* vertexp = new GaterIfVertex(&m_graph, nodep);
|
||||
new GaterEdge(&m_graph, m_aboveVertexp, vertexp, m_aboveTrue);
|
||||
{
|
||||
nodep->condp()->iterateAndNext(*this); // directlyUnder stays as-is
|
||||
iterateAndNextNull(nodep->condp()); // directlyUnder stays as-is
|
||||
}
|
||||
{
|
||||
m_aboveVertexp = vertexp; // Vars will point at this edge
|
||||
m_aboveTrue = VU_IF;
|
||||
nodep->ifsp()->iterateAndNext(*this); // directlyUnder stays as-is (true)
|
||||
iterateAndNextNull(nodep->ifsp()); // directlyUnder stays as-is (true)
|
||||
}
|
||||
{
|
||||
m_aboveVertexp = vertexp; // Vars will point at this edge
|
||||
m_aboveTrue = VU_ELSE;
|
||||
nodep->elsesp()->iterateAndNext(*this); // directlyUnder stays as-is (true)
|
||||
iterateAndNextNull(nodep->elsesp()); // directlyUnder stays as-is (true)
|
||||
}
|
||||
m_aboveVertexp = lastabovep;
|
||||
m_aboveTrue = lasttrue;
|
||||
|
|
@ -868,7 +868,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
|||
scoreboardPli(nodep);
|
||||
}
|
||||
{
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_directlyUnderAlw = lastdua;
|
||||
if (VN_IS(nodep, NodeStmt)) { // Reset what set above; else propagate up to above statement
|
||||
|
|
@ -882,7 +882,7 @@ public:
|
|||
explicit GaterVisitor(AstNetlist* nodep) {
|
||||
// AstAlways visitor does the real work, so most zeroing needs to be in clear()
|
||||
clear();
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
void clear() {
|
||||
m_nonopt = "";
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ private:
|
|||
m_settleFuncp = funcp;
|
||||
}
|
||||
// Process the activates
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Done, clear so we can detect errors
|
||||
UINFO(4," TOPSCOPEDONE "<<nodep<<endl);
|
||||
clearLastSen();
|
||||
|
|
@ -249,13 +249,13 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
//UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp= NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
//UINFO(4," SCOPE "<<nodep<<endl);
|
||||
m_scopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (AstNode* movep = nodep->finalClksp()) {
|
||||
if (!m_topScopep) nodep->v3fatalSrc("Final clocks under non-top scope");
|
||||
movep->unlinkFrBackWithNext();
|
||||
|
|
@ -311,7 +311,7 @@ private:
|
|||
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Link to global function
|
||||
if (nodep->formCallTree()) {
|
||||
UINFO(4, " formCallTree "<<nodep<<endl);
|
||||
|
|
@ -380,7 +380,7 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -393,7 +393,7 @@ public:
|
|||
m_lastIfp = NULL;
|
||||
m_scopep = NULL;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
// Allow downstream modules to find _eval()
|
||||
// easily without iterating through the tree.
|
||||
nodep->evalp(m_evalFuncp);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ private:
|
|||
virtual void visit(AstNodeAssign* nodep) {}
|
||||
virtual void visit(AstNodeMath* nodep) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -150,7 +150,7 @@ public:
|
|||
}
|
||||
virtual ~CombCallVisitor() {}
|
||||
void main(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -165,12 +165,12 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->user3(true);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit CombMarkVisitor(AstNode* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CombMarkVisitor() {}
|
||||
};
|
||||
|
|
@ -214,7 +214,7 @@ private:
|
|||
CombineState oldState = m_state;
|
||||
{
|
||||
m_state = STATE_HASH;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
m_state = oldState;
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ private:
|
|||
//In V3Hashed AstNode::user4ClearTree(); // user4p() used on entire tree
|
||||
// Iterate modules backwards, in bottom-up order.
|
||||
// Required so that a module instantiating another can benefit from collapsing.
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
|
|
@ -405,7 +405,7 @@ private:
|
|||
m_hashed.clear();
|
||||
// Compute hash of all statement trees in the function
|
||||
m_state = STATE_HASH;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_state = STATE_IDLE;
|
||||
if (debug()>=9) {
|
||||
m_hashed.dumpFilePrefixed("combine");
|
||||
|
|
@ -421,7 +421,7 @@ private:
|
|||
// Walk the statements looking for large replicated code sections
|
||||
if (statementCombine()) {
|
||||
m_state = STATE_DUP;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_state = STATE_IDLE;
|
||||
}
|
||||
m_modp = NULL;
|
||||
|
|
@ -432,7 +432,7 @@ private:
|
|||
if (m_state == STATE_HASH) {
|
||||
hashStatement(nodep); // Hash the entire function - it might be identical
|
||||
} else if (m_state == STATE_DUP) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
m_funcp = NULL;
|
||||
|
|
@ -452,7 +452,7 @@ private:
|
|||
virtual void visit(AstTraceDecl*) {}
|
||||
virtual void visit(AstTraceInc*) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -461,7 +461,7 @@ public:
|
|||
m_modp=NULL;
|
||||
m_funcp = NULL;
|
||||
m_state = STATE_IDLE;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CombineVisitor() {
|
||||
V3Stats::addStat("Optimizations, Combined CFuncs", m_statCombs);
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ private:
|
|||
if (nodep->varp()) nodep->varp()->user4(1);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit ConstVarMarkVisitor(AstNode* nodep) {
|
||||
AstNode::user4ClearTree(); // Check marked InUse before we're called
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ConstVarMarkVisitor() {}
|
||||
};
|
||||
|
|
@ -73,13 +73,13 @@ private:
|
|||
if (nodep->varp() && nodep->varp()->user4()) m_found = true;
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit ConstVarFindVisitor(AstNode* nodep) {
|
||||
m_found = false;
|
||||
nodep->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep);
|
||||
}
|
||||
virtual ~ConstVarFindVisitor() {}
|
||||
// METHODS
|
||||
|
|
@ -430,7 +430,7 @@ private:
|
|||
if (m_doGenerate) {
|
||||
// Never checked yet
|
||||
V3Width::widthParamsEdit(nodep);
|
||||
nodep->iterateChildren(*this); // May need "constifying"
|
||||
iterateChildren(nodep); // May need "constifying"
|
||||
}
|
||||
// Find range of dtype we are selecting from
|
||||
// Similar code in V3Unknown::AstSel
|
||||
|
|
@ -686,14 +686,14 @@ private:
|
|||
//! Replace a ternary node with its RHS after iterating
|
||||
//! Used with short-circuting, where the RHS has not yet been iterated.
|
||||
void replaceWIteratedRhs(AstNodeTriop* nodep) {
|
||||
if (AstNode *rhsp = nodep->rhsp()) rhsp->iterateAndNext(*this);
|
||||
if (AstNode* rhsp = nodep->rhsp()) iterateAndNextNull(rhsp);
|
||||
replaceWChild(nodep, nodep->rhsp()); // May have changed
|
||||
}
|
||||
|
||||
//! Replace a ternary node with its THS after iterating
|
||||
//! Used with short-circuting, where the THS has not yet been iterated.
|
||||
void replaceWIteratedThs(AstNodeTriop* nodep) {
|
||||
if (AstNode *thsp = nodep->thsp()) thsp->iterateAndNext(*this);
|
||||
if (AstNode* thsp = nodep->thsp()) iterateAndNextNull(thsp);
|
||||
replaceWChild(nodep, nodep->thsp()); // May have changed
|
||||
}
|
||||
void replaceWLhs(AstNodeUniop* nodep) {
|
||||
|
|
@ -835,8 +835,8 @@ private:
|
|||
UINFO(5, "merged "<< nodep <<endl);
|
||||
rp->unlinkFrBack()->deleteTree(); VL_DANGLING(rp);
|
||||
nodep->replaceWith(lp->unlinkFrBack()); nodep->deleteTree(); VL_DANGLING(nodep);
|
||||
lp->lhsp()->accept(*this);
|
||||
lp->rhsp()->accept(*this);
|
||||
iterate(lp->lhsp());
|
||||
iterate(lp->rhsp());
|
||||
} else nodep->v3fatalSrc("tried to merge two Concat which are not adjacent");
|
||||
}
|
||||
void replaceExtend (AstNode* nodep, AstNode* arg0p) {
|
||||
|
|
@ -892,7 +892,7 @@ private:
|
|||
AstNodeBiop* newp = lhsp;
|
||||
newp->lhsp(shift1p); newp->rhsp(shift2p);
|
||||
handle.relink(newp);
|
||||
newp->accept(*this); // Further reduce, either node may have more reductions.
|
||||
iterate(newp); // Further reduce, either node may have more reductions.
|
||||
}
|
||||
void replaceShiftShift (AstNodeBiop* nodep) {
|
||||
UINFO(4,"SHIFT(SHIFT(a,s1),s2)->SHIFT(a,ADD(s1,s2)) "<<nodep<<endl);
|
||||
|
|
@ -910,7 +910,7 @@ private:
|
|||
shift2p->deleteTree(); VL_DANGLING(shift2p);
|
||||
nodep->lhsp(ap);
|
||||
nodep->rhsp(new AstConst(nodep->fileline(), newshift));
|
||||
nodep->accept(*this); // Further reduce, either node may have more reductions.
|
||||
iterate(nodep); // Further reduce, either node may have more reductions.
|
||||
} else {
|
||||
// We know shift amounts are constant, but might be a mixed left/right shift
|
||||
int shift1 = VN_CAST(shift1p, Const)->toUInt(); if (VN_IS(lhsp, ShiftR)) shift1=-shift1;
|
||||
|
|
@ -947,7 +947,7 @@ private:
|
|||
newp->dtypeFrom(nodep);
|
||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
||||
//newp->dumpTree(cout, " repShiftShift_new: ");
|
||||
newp->accept(*this); // Further reduce, either node may have more reductions.
|
||||
iterate(newp); // Further reduce, either node may have more reductions.
|
||||
}
|
||||
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
||||
}
|
||||
|
|
@ -1234,25 +1234,25 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Iterate modules backwards, in bottom-up order. That's faster
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
// No ASSIGNW removals under funcs, we've long eliminated INITIALs
|
||||
// (We should perhaps rename the assignw's to just assigns)
|
||||
m_wremove = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_wremove = true;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
// No ASSIGNW removals under scope, we've long eliminated INITIALs
|
||||
m_scopep = nodep;
|
||||
m_wremove = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_wremove = true;
|
||||
m_scopep = NULL;
|
||||
}
|
||||
|
|
@ -1264,7 +1264,7 @@ private:
|
|||
AstNode* rhsp = nodep->rhsp()->unlinkFrBackWithNext();
|
||||
nodep->lhsp(rhsp);
|
||||
nodep->rhsp(lhsp);
|
||||
nodep->accept(*this); // Again?
|
||||
iterate(nodep); // Again?
|
||||
}
|
||||
|
||||
int operandConcatMove(AstConcat* nodep) {
|
||||
|
|
@ -1325,13 +1325,13 @@ private:
|
|||
|
||||
virtual void visit(AstCell* nodep) {
|
||||
if (m_params) {
|
||||
nodep->paramsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->paramsp());
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstPin* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
void replaceSelSel(AstSel* nodep) {
|
||||
|
|
@ -1501,12 +1501,12 @@ private:
|
|||
virtual void visit(AstAttrOf* nodep) {
|
||||
AstAttrOf* oldAttr = m_attrp;
|
||||
m_attrp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_attrp = oldAttr;
|
||||
}
|
||||
|
||||
virtual void visit(AstArraySel* nodep) {
|
||||
nodep->bitp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bitp());
|
||||
if (VN_IS(nodep->bitp(), Const)
|
||||
&& VN_IS(nodep->fromp(), VarRef)
|
||||
// Need to make sure it's an array object so don't mis-allow a constant (bug509.)
|
||||
|
|
@ -1514,7 +1514,7 @@ private:
|
|||
&& VN_IS(VN_CAST(nodep->fromp(), VarRef)->varp()->valuep(), InitArray)) {
|
||||
m_selp = nodep; // Ask visit(AstVarRef) to replace varref with const
|
||||
}
|
||||
nodep->fromp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fromp());
|
||||
if (VN_IS(nodep->fromp(), Const)) { // It did.
|
||||
if (!m_selp) {
|
||||
nodep->v3error("Illegal assignment of constant to unpacked array");
|
||||
|
|
@ -1530,12 +1530,12 @@ private:
|
|||
m_selp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeVarRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->varp()) nodep->v3fatalSrc("Not linked");
|
||||
bool did=false;
|
||||
if (m_doV && nodep->varp()->valuep() && !m_attrp) {
|
||||
//if (debug()) valuep->dumpTree(cout," visitvaref: ");
|
||||
nodep->varp()->valuep()->iterateAndNext(*this); // May change nodep->varp()->valuep()
|
||||
iterateAndNextNull(nodep->varp()->valuep()); // May change nodep->varp()->valuep()
|
||||
AstNode* valuep = nodep->varp()->valuep();
|
||||
if (!nodep->lvalue()
|
||||
&& ((!m_params // Can reduce constant wires into equations
|
||||
|
|
@ -1590,12 +1590,12 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstEnumItemRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->itemp()) nodep->v3fatalSrc("Not linked");
|
||||
bool did=false;
|
||||
if (nodep->itemp()->valuep()) {
|
||||
//if (debug()) nodep->varp()->valuep()->dumpTree(cout," visitvaref: ");
|
||||
nodep->itemp()->valuep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->itemp()->valuep());
|
||||
if (AstConst* valuep = VN_CAST(nodep->itemp()->valuep(), Const)) {
|
||||
const V3Number& num = valuep->num();
|
||||
replaceNum(nodep, num); VL_DANGLING(nodep);
|
||||
|
|
@ -1616,7 +1616,7 @@ private:
|
|||
return (!nodep->nextp() && nodep->backp()->nextp() != nodep);
|
||||
}
|
||||
virtual void visit(AstSenItem* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_doNConst
|
||||
&& (VN_IS(nodep->sensp(), Const)
|
||||
|| VN_IS(nodep->sensp(), EnumItemRef)
|
||||
|
|
@ -1657,7 +1657,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstSenGate* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (AstConst* constp = VN_CAST(nodep->rhsp(), Const)) {
|
||||
if (constp->isZero()) {
|
||||
UINFO(4,"SENGATE(...,0)->NEVER"<<endl);
|
||||
|
|
@ -1706,7 +1706,7 @@ private:
|
|||
};
|
||||
|
||||
virtual void visit(AstSenTree* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_doExpensive) {
|
||||
//cout<<endl; nodep->dumpTree(cout,"ssin: ");
|
||||
// Optimize ideas for the future:
|
||||
|
|
@ -1811,7 +1811,7 @@ private:
|
|||
//-----
|
||||
// Zero elimination
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_doNConst && replaceNodeAssign(nodep)) return;
|
||||
}
|
||||
virtual void visit(AstAssignAlias* nodep) {
|
||||
|
|
@ -1821,7 +1821,7 @@ private:
|
|||
// Don't perform any optimizations, the node won't be linked yet
|
||||
}
|
||||
virtual void visit(AstAssignW* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_doNConst && replaceNodeAssign(nodep)) return;
|
||||
AstNodeVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef); // Not VarXRef, as different refs may set different values to each hierarchy
|
||||
if (m_wremove && !m_params && m_doNConst
|
||||
|
|
@ -1848,7 +1848,7 @@ private:
|
|||
}
|
||||
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_doNConst) {
|
||||
if (const AstConst* constp = VN_CAST(nodep->condp(), Const)) {
|
||||
AstNode* keepp = NULL;
|
||||
|
|
@ -1927,7 +1927,7 @@ private:
|
|||
|
||||
virtual void visit(AstDisplay* nodep) {
|
||||
// DISPLAY(SFORMAT(text1)),DISPLAY(SFORMAT(text2)) -> DISPLAY(SFORMAT(text1+text2))
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (stmtDisplayDisplay(nodep)) return;
|
||||
}
|
||||
bool stmtDisplayDisplay(AstDisplay* nodep) {
|
||||
|
|
@ -1974,7 +1974,7 @@ private:
|
|||
// Substitute constants into displays. The main point of this is to
|
||||
// simplify assertion methodologies which call functions with display's.
|
||||
// This eliminates a pile of wide temps, and makes the C a whole lot more readable.
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
bool anyconst = false;
|
||||
for (AstNode* argp = nodep->exprsp(); argp; argp=argp->nextp()) {
|
||||
if (VN_IS(argp, Const)) { anyconst=true; break; }
|
||||
|
|
@ -2033,20 +2033,20 @@ private:
|
|||
}
|
||||
|
||||
virtual void visit(AstFuncRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_params) { // Only parameters force us to do constant function call propagation
|
||||
replaceWithSimulation(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstArg* nodep) {
|
||||
// replaceWithSimulation on the Arg's parent FuncRef replaces these
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstWhile* nodep) {
|
||||
bool oldHasJumpGo = m_hasJumpGo;
|
||||
m_hasJumpGo = false;
|
||||
{
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
bool thisWhileHasJumpGo = m_hasJumpGo;
|
||||
m_hasJumpGo = thisWhileHasJumpGo || oldHasJumpGo;
|
||||
|
|
@ -2070,7 +2070,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstInitArray* nodep) {
|
||||
// Constant if all children are constant
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// These are converted by V3Param. Don't constify as we don't want the from() VARREF to disappear, if any
|
||||
|
|
@ -2079,7 +2079,7 @@ private:
|
|||
|
||||
// Ignored, can eliminate early
|
||||
virtual void visit(AstSysIgnore* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_doNConst) {
|
||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||
}
|
||||
|
|
@ -2087,7 +2087,7 @@ private:
|
|||
|
||||
// Simplify
|
||||
virtual void visit(AstBasicDType* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->cvtRangeConst();
|
||||
}
|
||||
|
||||
|
|
@ -2095,7 +2095,7 @@ private:
|
|||
// Jump elimination
|
||||
|
||||
virtual void visit(AstJumpGo* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_hasJumpGo = true;
|
||||
if (m_doExpensive) { nodep->labelp()->user4(true); }
|
||||
}
|
||||
|
|
@ -2104,7 +2104,7 @@ private:
|
|||
// Because JumpLabels disable many optimizations,
|
||||
// remove JumpLabels that are not pointed to by any AstJumpGos
|
||||
// Note this assumes all AstJumpGos are underneath the given label; V3Broken asserts this
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// AstJumpGo's below here that point to this node will set user4
|
||||
if (m_doExpensive && !nodep->user4()) {
|
||||
UINFO(4,"JUMPLABEL => unused "<<nodep<<endl);
|
||||
|
|
@ -2453,7 +2453,7 @@ private:
|
|||
if (m_params && !nodep->width()) {
|
||||
nodep = V3Width::widthParamsEdit(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2500,7 +2500,7 @@ public:
|
|||
virtual ~ConstVisitor() {}
|
||||
AstNode* mainAcceptEdit(AstNode* nodep) {
|
||||
// Operate starting at a random place
|
||||
return nodep->iterateSubtreeReturnEdits(*this);
|
||||
return iterateSubtreeReturnEdits(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ private:
|
|||
m_modp = nodep;
|
||||
m_inModOff = nodep->isTop(); // Ignore coverage on top module; it's a shell we created
|
||||
m_fileps.clear();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
m_inModOff = true;
|
||||
}
|
||||
|
|
@ -142,12 +142,12 @@ private:
|
|||
bool oldtog = m_inToggleOff;
|
||||
{
|
||||
m_inToggleOff = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_inToggleOff = oldtog;
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_modp && !m_inModOff && !m_inToggleOff
|
||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageToggle()) {
|
||||
const char* disablep = varIgnoreToggle(nodep);
|
||||
|
|
@ -288,7 +288,7 @@ private:
|
|||
&& !VN_CAST(nodep->elsesp(), If)->nextp());
|
||||
if (elsif) VN_CAST(nodep->elsesp(), If)->user1(true);
|
||||
//
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
if (m_checkBlock && !m_inModOff
|
||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) { // if a "if" branch didn't disable it
|
||||
UINFO(4," COVER: "<<nodep<<endl);
|
||||
|
|
@ -301,7 +301,7 @@ private:
|
|||
// Don't do empty else's, only empty if/case's
|
||||
if (nodep->elsesp()) {
|
||||
m_checkBlock = true;
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
if (m_checkBlock && !m_inModOff
|
||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) { // if a "else" branch didn't disable it
|
||||
UINFO(4," COVER: "<<nodep<<endl);
|
||||
|
|
@ -317,7 +317,7 @@ private:
|
|||
UINFO(4," CASEI: "<<nodep<<endl);
|
||||
if (m_checkBlock && !m_inModOff
|
||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) {
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
if (m_checkBlock) { // if the case body didn't disable it
|
||||
UINFO(4," COVER: "<<nodep<<endl);
|
||||
nodep->addBodysp(newCoverInc(nodep->fileline(), "", "v_line", "case"));
|
||||
|
|
@ -328,7 +328,7 @@ private:
|
|||
virtual void visit(AstPslCover* nodep) {
|
||||
UINFO(4," PSLCOVER: "<<nodep<<endl);
|
||||
m_checkBlock = true; // Always do cover blocks, even if there's a $stop
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->coverincp()) {
|
||||
// Note the name may be overridden by V3Assert processing
|
||||
nodep->coverincp(newCoverInc(nodep->fileline(), m_beginHier, "v_user", "cover"));
|
||||
|
|
@ -346,7 +346,7 @@ private:
|
|||
m_checkBlock = false;
|
||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||
} else {
|
||||
if (m_checkBlock) nodep->iterateChildren(*this);
|
||||
if (m_checkBlock) iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstBegin* nodep) {
|
||||
|
|
@ -362,7 +362,7 @@ private:
|
|||
if (nodep->name()!="") {
|
||||
m_beginHier = m_beginHier + (m_beginHier!=""?".":"") + nodep->name();
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_beginHier = oldHier;
|
||||
m_inToggleOff = oldtog;
|
||||
|
|
@ -372,7 +372,7 @@ private:
|
|||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
if (m_checkBlock) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_checkBlock = true; // Reset as a child may have cleared it
|
||||
}
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ public:
|
|||
m_beginHier = "";
|
||||
m_inToggleOff = false;
|
||||
m_inModOff = true;
|
||||
rootp->iterateChildren(*this);
|
||||
iterateChildren(rootp);
|
||||
}
|
||||
virtual ~CoverageVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -105,24 +105,24 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Find all Coverage's
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Simplify
|
||||
detectDuplicates();
|
||||
}
|
||||
virtual void visit(AstCoverToggle* nodep) {
|
||||
m_toggleps.push_back(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
//--------------------
|
||||
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit CoverageJoinVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~CoverageJoinVisitor() {
|
||||
V3Stats::addStat("Coverage, Toggle points joined", m_statToggleJoins);
|
||||
|
|
|
|||
|
|
@ -59,18 +59,18 @@ private:
|
|||
// ** Shared with DeadVisitor **
|
||||
// VISITORS
|
||||
virtual void visit(AstCell* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->modp()->user1Inc(-1);
|
||||
}
|
||||
//-----
|
||||
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit DeadModVisitor(AstNodeModule* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~DeadModVisitor() {}
|
||||
};
|
||||
|
|
@ -138,18 +138,18 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
if (!nodep->dead()) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
}
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->scopep()) nodep->scopep()->user1Inc();
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->aboveScopep()) nodep->aboveScopep()->user1Inc();
|
||||
|
||||
|
|
@ -158,14 +158,14 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstCell* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
m_cellsp.push_back(nodep);
|
||||
nodep->modp()->user1Inc();
|
||||
}
|
||||
|
||||
virtual void visit(AstNodeVarRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->varScopep()) {
|
||||
nodep->varScopep()->user1Inc();
|
||||
|
|
@ -180,7 +180,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->packagep()) {
|
||||
if (m_elimCells) nodep->packagep(NULL);
|
||||
|
|
@ -188,7 +188,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstRefDType* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkDType(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->packagep()) {
|
||||
|
|
@ -197,12 +197,12 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNodeDType* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkDType(nodep);
|
||||
checkAll(nodep);
|
||||
}
|
||||
virtual void visit(AstEnumItemRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->packagep()) {
|
||||
if (m_elimCells) nodep->packagep(NULL);
|
||||
|
|
@ -211,7 +211,7 @@ private:
|
|||
checkAll(nodep);
|
||||
}
|
||||
virtual void visit(AstModport* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_elimCells) {
|
||||
if (!nodep->varsp()) {
|
||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
||||
|
|
@ -221,7 +221,7 @@ private:
|
|||
checkAll(nodep);
|
||||
}
|
||||
virtual void visit(AstTypedef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_elimCells && !nodep->attrPublic()) {
|
||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
||||
return;
|
||||
|
|
@ -232,7 +232,7 @@ private:
|
|||
if (nodep->attrPublic() && m_modp && VN_IS(m_modp, Package)) m_modp->user1Inc();
|
||||
}
|
||||
virtual void visit(AstVarScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->scopep()) nodep->scopep()->user1Inc();
|
||||
if (mightElimVar(nodep->varp())) {
|
||||
|
|
@ -240,7 +240,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
if (nodep->isSigPublic() && m_modp && VN_IS(m_modp, Package)) m_modp->user1Inc();
|
||||
if (mightElimVar(nodep)) {
|
||||
|
|
@ -251,7 +251,7 @@ private:
|
|||
// See if simple assignments to variables may be eliminated because that variable is never used.
|
||||
// Similar code in V3Life
|
||||
m_sideEffect = false;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
checkAll(nodep);
|
||||
// Has to be direct assignment without any EXTRACTing.
|
||||
AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef);
|
||||
|
|
@ -260,7 +260,7 @@ private:
|
|||
m_assignMap.insert(make_pair(varrefp->varScopep(), nodep));
|
||||
checkAll(varrefp); // Must track reference to dtype()
|
||||
} else { // Track like any other statement
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
}
|
||||
checkAll(nodep);
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ private:
|
|||
//-----
|
||||
virtual void visit(AstNode* nodep) {
|
||||
if (nodep->isOutputter()) m_sideEffect=true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkAll(nodep);
|
||||
}
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ public:
|
|||
// Prepare to remove some datatypes
|
||||
nodep->typeTablep()->clearCache();
|
||||
// Operate on whole netlist
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
|
||||
deadCheckVar();
|
||||
// We only elimate scopes when in a flattened structure
|
||||
|
|
|
|||
|
|
@ -344,16 +344,16 @@ private:
|
|||
virtual void visit(AstNetlist* nodep) {
|
||||
//VV***** We reset all userp() on the netlist
|
||||
m_modVarMap.clear();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
AstNode::user3ClearTree();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
m_cfuncp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_cfuncp = NULL;
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
|
|
@ -361,7 +361,7 @@ private:
|
|||
bool oldinit = m_inInitial;
|
||||
m_inInitial = nodep->hasInitial();
|
||||
AstNode::user3ClearTree(); // Two sets to same variable in different actives must use different vars.
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inInitial = oldinit;
|
||||
}
|
||||
virtual void visit(AstAssignDly* nodep) {
|
||||
|
|
@ -382,7 +382,7 @@ private:
|
|||
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
||||
}
|
||||
else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_inDly = false;
|
||||
m_nextDlyp = NULL;
|
||||
|
|
@ -443,14 +443,14 @@ private:
|
|||
virtual void visit(AstWhile* nodep) {
|
||||
bool oldloop = m_inLoop;
|
||||
m_inLoop = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inLoop = oldloop;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -463,7 +463,7 @@ public:
|
|||
m_inLoop = false;
|
||||
m_inInitial = false;
|
||||
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~DelayedVisitor() {
|
||||
V3Stats::addStat("Optimizations, Delayed shared-sets", m_statSharedSet);
|
||||
|
|
|
|||
|
|
@ -89,21 +89,21 @@ private:
|
|||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_funcp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
m_funcp = nodep;
|
||||
m_depth = 0;
|
||||
m_maxdepth = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_funcp = NULL;
|
||||
}
|
||||
void visitStmt(AstNodeStmt* nodep) {
|
||||
m_depth = 0;
|
||||
m_maxdepth = 0;
|
||||
m_stmtp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_stmtp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeStmt* nodep) {
|
||||
|
|
@ -116,7 +116,7 @@ private:
|
|||
// We have some operator defines that use 2 parens, so += 2.
|
||||
m_depth += 2;
|
||||
if (m_depth>m_maxdepth) m_maxdepth=m_depth;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_depth -= 2;
|
||||
|
||||
if (m_stmtp
|
||||
|
|
@ -141,7 +141,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstUCFunc* nodep) {
|
||||
needNonStaticFunc(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstUCStmt* nodep) {
|
||||
needNonStaticFunc(nodep);
|
||||
|
|
@ -152,7 +152,7 @@ private:
|
|||
// Default: Just iterate
|
||||
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -164,7 +164,7 @@ public:
|
|||
m_depth=0;
|
||||
m_maxdepth=0;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~DepthVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ private:
|
|||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_deepNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
|
|
@ -90,7 +90,7 @@ private:
|
|||
{
|
||||
m_depth = 0;
|
||||
m_funcp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_depth = lastDepth;
|
||||
m_funcp = lastFuncp;
|
||||
|
|
@ -103,11 +103,11 @@ private:
|
|||
AstNode* backp = nodep->backp(); // Only for debug
|
||||
if (debug()>=9) backp->dumpTree(cout,"- pre : ");
|
||||
AstCFunc* funcp = createDeepFunc(nodep);
|
||||
funcp->accept(*this);
|
||||
iterate(funcp);
|
||||
if (debug()>=9) backp->dumpTree(cout,"- post: ");
|
||||
if (debug()>=9) funcp->dumpTree(cout,"- func: ");
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_depth--;
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ private:
|
|||
// Default: Just iterate
|
||||
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -129,7 +129,7 @@ public:
|
|||
m_modp=NULL;
|
||||
m_depth=0;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~DepthBlockVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -234,13 +234,13 @@ private:
|
|||
m_modp = nodep;
|
||||
m_modFuncs.clear();
|
||||
m_modSingleton = modIsSingleton(m_modp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
makePublicFuncWrappers();
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
m_scopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstVarScope* nodep) {
|
||||
|
|
@ -249,7 +249,7 @@ private:
|
|||
pushDeletep(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeVarRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Convert the hierch name
|
||||
if (!m_scopep) nodep->v3fatalSrc("Node not under scope");
|
||||
bool hierThis;
|
||||
|
|
@ -259,7 +259,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
//UINFO(9," "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Convert the hierch name
|
||||
if (!m_scopep) nodep->v3fatalSrc("Node not under scope");
|
||||
if (!nodep->funcp()->scopep()) nodep->v3fatalSrc("CFunc not under scope");
|
||||
|
|
@ -271,7 +271,7 @@ private:
|
|||
virtual void visit(AstCFunc* nodep) {
|
||||
if (!nodep->user1()) {
|
||||
m_needThis = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user1(true);
|
||||
if (m_needThis) {
|
||||
nodep->isStatic(false);
|
||||
|
|
@ -292,7 +292,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstVar*) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -301,7 +301,7 @@ public:
|
|||
m_scopep(NULL),
|
||||
m_modSingleton(false),
|
||||
m_needThis(false) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~DescopeVisitor() {}
|
||||
};
|
||||
|
|
|
|||
164
src/V3EmitC.cpp
164
src/V3EmitC.cpp
|
|
@ -123,7 +123,7 @@ public:
|
|||
for (AstEnumItem* itemp = adtypep->itemsp(); itemp; itemp=VN_CAST(itemp->nextp(), EnumItem)) {
|
||||
puts(itemp->name());
|
||||
puts(" = ");
|
||||
itemp->valuep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(itemp->valuep());
|
||||
if (VN_IS(itemp->nextp(), EnumItem)) puts(",");
|
||||
puts("\n");
|
||||
}
|
||||
|
|
@ -148,8 +148,8 @@ public:
|
|||
puts("I(");
|
||||
}
|
||||
puts(cvtToStr(nodep->widthMin())+",");
|
||||
selp->lsbp()->iterateAndNext(*this); puts(", ");
|
||||
selp->fromp()->iterateAndNext(*this); puts(", ");
|
||||
iterateAndNextNull(selp->lsbp()); puts(", ");
|
||||
iterateAndNextNull(selp->fromp()); puts(", ");
|
||||
} else {
|
||||
putbs("VL_ASSIGNSEL_");
|
||||
emitIQW (selp->fromp());
|
||||
|
|
@ -157,8 +157,8 @@ public:
|
|||
emitIQW(nodep->rhsp());
|
||||
puts("(");
|
||||
puts(cvtToStr(nodep->widthMin())+",");
|
||||
selp->lsbp()->iterateAndNext(*this); puts(", ");
|
||||
selp->fromp()->iterateAndNext(*this); puts(", ");
|
||||
iterateAndNextNull(selp->lsbp()); puts(", ");
|
||||
iterateAndNextNull(selp->fromp()); puts(", ");
|
||||
}
|
||||
} else if (AstVar* varp = AstVar::scVarRecurse(nodep->lhsp())) {
|
||||
putbs("VL_ASSIGN_"); // Set a systemC variable
|
||||
|
|
@ -166,14 +166,14 @@ public:
|
|||
emitIQW(nodep);
|
||||
puts("(");
|
||||
puts(cvtToStr(nodep->widthMin())+",");
|
||||
nodep->lhsp()->iterateAndNext(*this); puts(", ");
|
||||
iterateAndNextNull(nodep->lhsp()); puts(", ");
|
||||
} else if (AstVar* varp = AstVar::scVarRecurse(nodep->rhsp())) {
|
||||
putbs("VL_ASSIGN_"); // Get a systemC variable
|
||||
emitIQW(nodep);
|
||||
emitScIQW(varp);
|
||||
puts("(");
|
||||
puts(cvtToStr(nodep->widthMin())+",");
|
||||
nodep->lhsp()->iterateAndNext(*this); puts(", ");
|
||||
iterateAndNextNull(nodep->lhsp()); puts(", ");
|
||||
} else if (nodep->isWide()
|
||||
&& VN_IS(nodep->lhsp(), VarRef)
|
||||
&& !VN_IS(nodep->rhsp(), CMath)
|
||||
|
|
@ -185,16 +185,16 @@ public:
|
|||
} else if (nodep->isWide()) {
|
||||
putbs("VL_ASSIGN_W(");
|
||||
puts(cvtToStr(nodep->widthMin())+",");
|
||||
nodep->lhsp()->iterateAndNext(*this); puts(", ");
|
||||
iterateAndNextNull(nodep->lhsp()); puts(", ");
|
||||
} else {
|
||||
paren = false;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(" ");
|
||||
ofp()->blockInc(); decind = true;
|
||||
if (!VN_IS(nodep->rhsp(), Const)) ofp()->putBreak();
|
||||
puts("= ");
|
||||
}
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
if (paren) puts(")");
|
||||
if (decind) ofp()->blockDec();
|
||||
if (!m_suppressSemi) puts(";\n");
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
bool comma = (nodep->argTypes() != "");
|
||||
for (AstNode* subnodep=nodep->argsp(); subnodep; subnodep = subnodep->nextp()) {
|
||||
if (comma) puts(", ");
|
||||
subnodep->accept(*this);
|
||||
iterate(subnodep);
|
||||
comma = true;
|
||||
}
|
||||
if (VN_IS(nodep->backp(), NodeMath) || VN_IS(nodep->backp(), CReturn)) {
|
||||
|
|
@ -225,7 +225,7 @@ public:
|
|||
}
|
||||
virtual void visit(AstComment* nodep) {
|
||||
putsDecoration((string)"// "+nodep->name()+" at "+nodep->fileline()->ascii()+"\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCoverDecl* nodep) {
|
||||
puts("__vlCoverInsert("); // As Declared in emitCoverageDecl
|
||||
|
|
@ -252,7 +252,7 @@ public:
|
|||
}
|
||||
virtual void visit(AstCReturn* nodep) {
|
||||
puts("return (");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstDisplay* nodep) {
|
||||
|
|
@ -289,7 +289,7 @@ public:
|
|||
emitCvtPackStr(nodep->searchp());
|
||||
puts(",");
|
||||
putbs("");
|
||||
nodep->outp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->outp());
|
||||
puts(")");
|
||||
}
|
||||
virtual void visit(AstTestPlusArgs* nodep) {
|
||||
|
|
@ -308,7 +308,7 @@ public:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstFOpen* nodep) {
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
puts(" = VL_FOPEN_");
|
||||
emitIQW(nodep->filenamep());
|
||||
emitIQW(nodep->modep());
|
||||
|
|
@ -319,9 +319,9 @@ public:
|
|||
putbs(", ");
|
||||
}
|
||||
checkMaxWords(nodep->filenamep());
|
||||
nodep->filenamep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filenamep());
|
||||
putbs(", ");
|
||||
nodep->modep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->modep());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstNodeReadWriteMem* nodep) {
|
||||
|
|
@ -353,19 +353,19 @@ public:
|
|||
checkMaxWords(nodep->filenamep());
|
||||
putbs(", ");
|
||||
}
|
||||
nodep->filenamep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filenamep());
|
||||
putbs(", ");
|
||||
nodep->memp()->iterateAndNext(*this);
|
||||
putbs(","); if (nodep->lsbp()) { nodep->lsbp()->iterateAndNext(*this); }
|
||||
iterateAndNextNull(nodep->memp());
|
||||
putbs(","); if (nodep->lsbp()) { iterateAndNextNull(nodep->lsbp()); }
|
||||
else puts(cvtToStr(array_lsb));
|
||||
putbs(","); if (nodep->msbp()) { nodep->msbp()->iterateAndNext(*this); } else puts("~0");
|
||||
putbs(","); if (nodep->msbp()) { iterateAndNextNull(nodep->msbp()); } else puts("~0");
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstFClose* nodep) {
|
||||
puts("VL_FCLOSE_I(");
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
puts("); ");
|
||||
nodep->filep()->iterateAndNext(*this); // For saftey, so user doesn't later WRITE with it.
|
||||
iterateAndNextNull(nodep->filep()); // For saftey, so user doesn't later WRITE with it.
|
||||
puts("=0;\n");
|
||||
}
|
||||
virtual void visit(AstFFlush* nodep) {
|
||||
|
|
@ -373,15 +373,15 @@ public:
|
|||
puts("fflush (stdout);\n");
|
||||
} else {
|
||||
puts("if (");
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
puts(") { fflush (VL_CVT_I_FP(");
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
puts(")); }\n");
|
||||
}
|
||||
}
|
||||
virtual void visit(AstSysFuncAsTask* nodep) {
|
||||
if (!nodep->lhsp()->isWide()) puts("(void)");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
if (!nodep->lhsp()->isWide()) puts(";");
|
||||
}
|
||||
virtual void visit(AstSystemT* nodep) {
|
||||
|
|
@ -393,7 +393,7 @@ public:
|
|||
putbs(", ");
|
||||
}
|
||||
checkMaxWords(nodep->lhsp());
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstSystemF* nodep) {
|
||||
|
|
@ -405,7 +405,7 @@ public:
|
|||
putbs(", ");
|
||||
}
|
||||
checkMaxWords(nodep->lhsp());
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(")");
|
||||
}
|
||||
virtual void visit(AstJumpGo* nodep) {
|
||||
|
|
@ -413,18 +413,18 @@ public:
|
|||
}
|
||||
virtual void visit(AstJumpLabel* nodep) {
|
||||
puts("{\n");
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
puts("}\n");
|
||||
puts("__Vlabel"+cvtToStr(nodep->labelNum())+": ;\n");
|
||||
}
|
||||
virtual void visit(AstWhile* nodep) {
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
puts("while (");
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
puts(") {\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
iterateAndNextNull(nodep->precondsp()); // Need to recompute before next loop
|
||||
puts("}\n");
|
||||
}
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
|
|
@ -432,13 +432,13 @@ public:
|
|||
if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) {
|
||||
puts(nodep->branchPred().ascii()); puts("(");
|
||||
}
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) puts(")");
|
||||
puts(") {\n");
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
if (nodep->elsesp()) {
|
||||
puts("} else {\n");
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
}
|
||||
puts("}\n");
|
||||
}
|
||||
|
|
@ -465,21 +465,21 @@ public:
|
|||
}
|
||||
virtual void visit(AstCStmt* nodep) {
|
||||
putbs("");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
}
|
||||
virtual void visit(AstCMath* nodep) {
|
||||
putbs("");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
}
|
||||
virtual void visit(AstUCStmt* nodep) {
|
||||
putsDecoration("// $c statement at "+nodep->fileline()->ascii()+"\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
puts("\n");
|
||||
}
|
||||
virtual void visit(AstUCFunc* nodep) {
|
||||
puts("\n");
|
||||
putsDecoration("// $c function at "+nodep->fileline()->ascii()+"\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
puts("\n");
|
||||
}
|
||||
|
||||
|
|
@ -490,16 +490,16 @@ public:
|
|||
virtual void visit(AstNodeUniop* nodep) {
|
||||
if (emitSimpleOk(nodep)) {
|
||||
putbs("("); puts(nodep->emitSimpleOperator()); puts(" ");
|
||||
nodep->lhsp()->iterateAndNext(*this); puts(")");
|
||||
iterateAndNextNull(nodep->lhsp()); puts(")");
|
||||
} else {
|
||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), NULL, NULL);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstNodeBiop* nodep) {
|
||||
if (emitSimpleOk(nodep)) {
|
||||
putbs("("); nodep->lhsp()->iterateAndNext(*this);
|
||||
putbs("("); iterateAndNextNull(nodep->lhsp());
|
||||
puts(" "); putbs(nodep->emitSimpleOperator()); puts(" ");
|
||||
nodep->rhsp()->iterateAndNext(*this); puts(")");
|
||||
iterateAndNextNull(nodep->rhsp()); puts(")");
|
||||
} else {
|
||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ public:
|
|||
putbs("VL_REDXOR_");
|
||||
puts(cvtToStr(nodep->lhsp()->dtypep()->widthPow2()));
|
||||
puts("(");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(")");
|
||||
}
|
||||
}
|
||||
|
|
@ -557,7 +557,7 @@ public:
|
|||
} else {
|
||||
puts("(IData)(");
|
||||
}
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(")");
|
||||
}
|
||||
virtual void visit(AstNodeCond* nodep) {
|
||||
|
|
@ -566,9 +566,9 @@ public:
|
|||
emitOpName(nodep, nodep->emitC(), nodep->condp(), nodep->expr1p(), nodep->expr2p());
|
||||
} else {
|
||||
putbs("(");
|
||||
nodep->condp()->iterateAndNext(*this); putbs(" ? ");
|
||||
nodep->expr1p()->iterateAndNext(*this); putbs(" : ");
|
||||
nodep->expr2p()->iterateAndNext(*this); puts(")");
|
||||
iterateAndNextNull(nodep->condp()); putbs(" ? ");
|
||||
iterateAndNextNull(nodep->expr1p()); putbs(" : ");
|
||||
iterateAndNextNull(nodep->expr2p()); puts(")");
|
||||
}
|
||||
}
|
||||
virtual void visit(AstSel* nodep) {
|
||||
|
|
@ -587,8 +587,8 @@ public:
|
|||
if (nodep->lhsp()) { puts(","+cvtToStr(nodep->lhsp()->widthMin())); }
|
||||
if (nodep->rhsp()) { puts(","+cvtToStr(nodep->rhsp()->widthMin())); }
|
||||
puts(",");
|
||||
nodep->lhsp()->iterateAndNext(*this); puts(", ");
|
||||
nodep->rhsp()->iterateAndNext(*this); puts(")");
|
||||
iterateAndNextNull(nodep->lhsp()); puts(", ");
|
||||
iterateAndNextNull(nodep->rhsp()); puts(")");
|
||||
} else {
|
||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
||||
}
|
||||
|
|
@ -607,7 +607,7 @@ public:
|
|||
puts(","+cvtToStr(nodep->lhsp()->widthMin()));
|
||||
puts(","+cvtToStr(nodep->rhsp()->widthMin()));
|
||||
puts(",");
|
||||
nodep->lhsp()->iterateAndNext(*this); puts(", ");
|
||||
iterateAndNextNull(nodep->lhsp()); puts(", ");
|
||||
uint32_t rd_log2 = V3Number::log2b(VN_CAST(nodep->rhsp(), Const)->toUInt());
|
||||
puts(cvtToStr(rd_log2)+")");
|
||||
return;
|
||||
|
|
@ -633,7 +633,7 @@ public:
|
|||
puts(cvtToStr(nodep->widthWords())); // Note argument width, not node width (which is always 32)
|
||||
puts(",");
|
||||
}
|
||||
nodep->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep);
|
||||
puts(")");
|
||||
}
|
||||
}
|
||||
|
|
@ -675,7 +675,7 @@ public:
|
|||
puts(assigntop->hiername());
|
||||
puts(assigntop->varp()->name());
|
||||
} else {
|
||||
assigntop->iterateAndNext(*this);
|
||||
iterateAndNextNull(assigntop);
|
||||
}
|
||||
for (int word=VL_WORDS_I(upWidth)-1; word>=0; word--) {
|
||||
// Only 32 bits - llx + long long here just to appease CPP format warning
|
||||
|
|
@ -696,7 +696,7 @@ public:
|
|||
puts(assigntop->hiername());
|
||||
puts(assigntop->varp()->name());
|
||||
} else {
|
||||
assigntop->iterateAndNext(*this);
|
||||
iterateAndNextNull(assigntop);
|
||||
}
|
||||
for (int word=EMITC_NUM_CONSTW-1; word>=0; word--) {
|
||||
// Only 32 bits - llx + long long here just to appease CPP format warning
|
||||
|
|
@ -748,13 +748,13 @@ public:
|
|||
|
||||
// Just iterate
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
// NOPs
|
||||
virtual void visit(AstTypedef*) {}
|
||||
|
|
@ -768,7 +768,7 @@ public:
|
|||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->prettyTypeName());
|
||||
}
|
||||
|
||||
|
|
@ -799,7 +799,7 @@ class EmitCImp : EmitCStmts {
|
|||
if (!changep->rhsp()) {
|
||||
if (!gotOne) gotOne = true;
|
||||
else puts(" | ");
|
||||
changep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(changep->lhsp());
|
||||
}
|
||||
else {
|
||||
AstNode* lhsp = changep->lhsp();
|
||||
|
|
@ -818,11 +818,11 @@ class EmitCImp : EmitCStmts {
|
|||
} else {
|
||||
puts(" | (");
|
||||
}
|
||||
changep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(changep->lhsp());
|
||||
if (changep->lhsp()->isWide()) puts("["+cvtToStr(word)+"]");
|
||||
if (changep->lhsp()->isDouble()) puts(" != ");
|
||||
else puts(" ^ ");
|
||||
changep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(changep->rhsp());
|
||||
if (changep->lhsp()->isWide()) puts("["+cvtToStr(word)+"]");
|
||||
puts(")");
|
||||
}
|
||||
|
|
@ -909,14 +909,14 @@ class EmitCImp : EmitCStmts {
|
|||
emitVarList(nodep->initsp(), EVL_FUNC_ALL, "");
|
||||
emitVarList(nodep->stmtsp(), EVL_FUNC_ALL, "");
|
||||
|
||||
nodep->initsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->initsp());
|
||||
|
||||
if (nodep->stmtsp()) putsDecoration("// Body\n");
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
if (!m_blkChangeDetVec.empty()) emitChangeDet();
|
||||
|
||||
if (nodep->finalsp()) putsDecoration("// Final\n");
|
||||
nodep->finalsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->finalsp());
|
||||
//
|
||||
|
||||
if (!m_blkChangeDetVec.empty()) puts("return __req;\n");
|
||||
|
|
@ -1004,7 +1004,7 @@ public:
|
|||
virtual ~EmitCImp() {}
|
||||
void main(AstNodeModule* modp, bool slow, bool fast);
|
||||
void mainDoFunc(AstCFunc* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1197,7 +1197,7 @@ void EmitCStmts::emitOpName(AstNode* nodep, const string& format,
|
|||
case 'i':
|
||||
COMMA;
|
||||
if (!detailp) { nodep->v3fatalSrc("emitOperator() references undef node"); }
|
||||
else detailp->iterateAndNext(*this);
|
||||
else iterateAndNextNull(detailp);
|
||||
needComma = true;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -1253,7 +1253,7 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) {
|
|||
if (const AstFScanF* dispp = VN_CAST(nodep, FScanF)) {
|
||||
isStmt = false;
|
||||
puts("VL_FSCANF_IX(");
|
||||
dispp->filep()->iterate(*this);
|
||||
iterate(dispp->filep());
|
||||
puts(",");
|
||||
} else if (const AstSScanF* dispp = VN_CAST(nodep, SScanF)) {
|
||||
isStmt = false;
|
||||
|
|
@ -1261,13 +1261,13 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) {
|
|||
puts("VL_SSCANF_I"); emitIQW(dispp->fromp()); puts("X(");
|
||||
puts(cvtToStr(dispp->fromp()->widthMin()));
|
||||
puts(",");
|
||||
dispp->fromp()->iterate(*this);
|
||||
iterate(dispp->fromp());
|
||||
puts(",");
|
||||
} else if (const AstDisplay* dispp = VN_CAST(nodep, Display)) {
|
||||
isStmt = true;
|
||||
if (dispp->filep()) {
|
||||
puts("VL_FWRITEF(");
|
||||
dispp->filep()->iterate(*this);
|
||||
iterate(dispp->filep());
|
||||
puts(",");
|
||||
} else {
|
||||
puts("VL_WRITEF(");
|
||||
|
|
@ -1277,7 +1277,7 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) {
|
|||
puts("VL_SFORMAT_X(");
|
||||
puts(cvtToStr(dispp->lhsp()->widthMin()));
|
||||
putbs(",");
|
||||
dispp->lhsp()->iterate(*this);
|
||||
iterate(dispp->lhsp());
|
||||
putbs(",");
|
||||
} else if (const AstSFormatF* dispp = VN_CAST(nodep, SFormatF)) {
|
||||
isStmt = false;
|
||||
|
|
@ -1299,7 +1299,7 @@ void EmitCStmts::displayEmit(AstNode* nodep, bool isScan) {
|
|||
if (argp) {
|
||||
if (isScan) puts("&(");
|
||||
else if (fmt == '@') puts("&(");
|
||||
argp->iterate(*this);
|
||||
iterate(argp);
|
||||
if (isScan) puts(")");
|
||||
else if (fmt == '@') puts(")");
|
||||
}
|
||||
|
|
@ -2072,7 +2072,7 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||
puts("enum ");
|
||||
puts(varp->isQuad()?"_QData":"_IData");
|
||||
puts(""+varp->name()+" { "+varp->name()+" = ");
|
||||
varp->valuep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(varp->valuep());
|
||||
puts("};");
|
||||
}
|
||||
puts("\n");
|
||||
|
|
@ -2405,7 +2405,7 @@ class EmitCTrace : EmitCStmts {
|
|||
}
|
||||
|
||||
void emitTraceChangeOne(AstTraceInc* nodep, int arrayindex) {
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
string full = ((m_funcp->funcType() == AstCFuncType::TRACE_FULL
|
||||
|| m_funcp->funcType() == AstCFuncType::TRACE_FULL_SUB)
|
||||
? "full":"chg");
|
||||
|
|
@ -2437,7 +2437,7 @@ class EmitCTrace : EmitCStmts {
|
|||
puts("(");
|
||||
if (emitTraceIsScBigUint(nodep)) puts("(vluint32_t*)");
|
||||
else if (emitTraceIsScBv(nodep)) puts("VL_SC_BV_DATAP(");
|
||||
varrefp->iterate(*this); // Put var name out
|
||||
iterate(varrefp); // Put var name out
|
||||
// Tracing only supports 1D arrays
|
||||
if (nodep->declp()->arrayRange().ranged()) {
|
||||
if (arrayindex==-2) puts("[i]");
|
||||
|
|
@ -2451,7 +2451,7 @@ class EmitCTrace : EmitCStmts {
|
|||
puts(")");
|
||||
} else {
|
||||
puts("(");
|
||||
nodep->valuep()->iterate(*this);
|
||||
iterate(nodep->valuep());
|
||||
puts(")");
|
||||
}
|
||||
}
|
||||
|
|
@ -2460,10 +2460,10 @@ class EmitCTrace : EmitCStmts {
|
|||
using EmitCStmts::visit; // Suppress hidden overloaded virtual function warnng
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Top module only
|
||||
nodep->topModulep()->accept(*this);
|
||||
iterate(nodep->topModulep());
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
if (nodep->slow() != m_slow) return;
|
||||
|
|
@ -2499,14 +2499,14 @@ class EmitCTrace : EmitCStmts {
|
|||
|
||||
if (nodep->initsp()) putsDecoration("// Variables\n");
|
||||
emitVarList(nodep->initsp(), EVL_FUNC_ALL, "");
|
||||
nodep->initsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->initsp());
|
||||
|
||||
putsDecoration("// Body\n");
|
||||
puts("{\n");
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
puts("}\n");
|
||||
if (nodep->finalsp()) putsDecoration("// Final\n");
|
||||
nodep->finalsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->finalsp());
|
||||
puts("}\n");
|
||||
}
|
||||
m_funcp = NULL;
|
||||
|
|
@ -2549,7 +2549,7 @@ public:
|
|||
if (m_slow) emitTraceSlow();
|
||||
else emitTraceFast();
|
||||
|
||||
v3Global.rootp()->accept(*this);
|
||||
iterate(v3Global.rootp());
|
||||
|
||||
delete m_ofp; m_ofp=NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNode* nodep) {
|
||||
m_count++;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit EmitCBaseCounterVisitor(AstNode* nodep) {
|
||||
m_count = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~EmitCBaseCounterVisitor() {}
|
||||
int count() const { return m_count; }
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ class EmitCInlines : EmitCBaseVisitor {
|
|||
virtual void visit(AstNodeStmt*) {}
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
//---------------------------------------
|
||||
// ACCESSORS
|
||||
public:
|
||||
explicit EmitCInlines(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
if (v3Global.needHInlines()) {
|
||||
emitInt();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Collect list of scopes
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
varsExpand();
|
||||
|
||||
// Sort by names, so line/process order matters less
|
||||
|
|
@ -185,7 +185,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||
nameCheck(nodep);
|
||||
m_modp = nodep;
|
||||
m_labelNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
|
|
@ -210,7 +210,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
nameCheck(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isSigUserRdPublic()
|
||||
&& !nodep->isParam()) { // The VPI functions require a pointer to allow modification, but parameters are constants
|
||||
m_modVars.push_back(make_pair(m_modp, nodep));
|
||||
|
|
@ -224,7 +224,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||
}
|
||||
virtual void visit(AstJumpLabel* nodep) {
|
||||
nodep->labelNum(++m_labelNum);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
nameCheck(nodep);
|
||||
|
|
@ -232,14 +232,14 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||
m_dpis.push_back(nodep);
|
||||
}
|
||||
m_funcp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_funcp = NULL;
|
||||
}
|
||||
// NOPs
|
||||
virtual void visit(AstConst*) {}
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
//---------------------------------------
|
||||
// ACCESSORS
|
||||
|
|
@ -249,7 +249,7 @@ public:
|
|||
m_modp = NULL;
|
||||
m_coverBins = 0;
|
||||
m_labelNum = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
190
src/V3EmitV.cpp
190
src/V3EmitV.cpp
|
|
@ -63,11 +63,11 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
putfs(nodep, nodep->verilogKwd()+" "+modClassName(nodep)+";\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
putqs(nodep, "end"+nodep->verilogKwd()+"\n");
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
|
|
@ -76,7 +76,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
puts(nodep->prettyName());
|
||||
puts(";\n");
|
||||
putqs(nodep, "begin\n"); // Only putfs the first time for each visitor; later for same node is putqs
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
putqs(nodep, "end\n");
|
||||
}
|
||||
|
||||
|
|
@ -86,64 +86,64 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
} else {
|
||||
putbs("begin : "+nodep->name()+"\n");
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
puts("end\n");
|
||||
}
|
||||
virtual void visit(AstGenerate* nodep) {
|
||||
putfs(nodep, "generate\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
putqs(nodep, "end\n");
|
||||
}
|
||||
virtual void visit(AstFinal* nodep) {
|
||||
putfs(nodep, "final begin\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
putqs(nodep, "end\n");
|
||||
}
|
||||
virtual void visit(AstInitial* nodep) {
|
||||
putfs(nodep,"initial begin\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
putqs(nodep, "end\n");
|
||||
}
|
||||
virtual void visit(AstAlways* nodep) {
|
||||
putfs(nodep,"always ");
|
||||
if (m_sensesp) m_sensesp->iterateAndNext(*this); // In active
|
||||
else nodep->sensesp()->iterateAndNext(*this);
|
||||
if (m_sensesp) iterateAndNextNull(m_sensesp); // In active
|
||||
else iterateAndNextNull(nodep->sensesp());
|
||||
putbs(" begin\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
putqs(nodep,"end\n");
|
||||
}
|
||||
virtual void visit(AstAlwaysPublic* nodep) {
|
||||
putfs(nodep,"/*verilator public_flat_rw ");
|
||||
if (m_sensesp) m_sensesp->iterateAndNext(*this); // In active
|
||||
else nodep->sensesp()->iterateAndNext(*this);
|
||||
if (m_sensesp) iterateAndNextNull(m_sensesp); // In active
|
||||
else iterateAndNextNull(nodep->sensesp());
|
||||
putqs(nodep," ");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
putqs(nodep,"*/\n");
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
putfs(nodep," "+nodep->verilogKwd()+" ");
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
if (!m_suppressSemi) puts(";\n");
|
||||
}
|
||||
virtual void visit(AstAssignDly* nodep) {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
putfs(nodep," <= ");
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
puts(";\n");
|
||||
}
|
||||
virtual void visit(AstAssignAlias* nodep) {
|
||||
putbs("alias ");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
putfs(nodep," = ");
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
if (!m_suppressSemi) puts(";\n");
|
||||
}
|
||||
virtual void visit(AstAssignW* nodep) {
|
||||
putfs(nodep,"assign ");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
putbs(" = ");
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
if (!m_suppressSemi) puts(";\n");
|
||||
}
|
||||
virtual void visit(AstBreak* nodep) {
|
||||
|
|
@ -154,7 +154,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
// AstSenItem is called for dumping in isolation by V3Order
|
||||
putfs(nodep,"@(");
|
||||
for (AstNode* expp=nodep->sensesp(); expp; expp = expp->nextp()) {
|
||||
expp->accept(*this);
|
||||
iterate(expp);
|
||||
if (expp->nextp()) putqs(expp->nextp()," or ");
|
||||
}
|
||||
puts(")");
|
||||
|
|
@ -166,7 +166,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
putfs(nodep,"");
|
||||
puts(nodep->edgeType().verilogKwd());
|
||||
if (nodep->sensp()) puts(" ");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeCase* nodep) {
|
||||
putfs(nodep,"");
|
||||
|
|
@ -177,7 +177,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
}
|
||||
puts(nodep->verilogKwd());
|
||||
puts(" (");
|
||||
nodep->exprp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->exprp());
|
||||
puts(")\n");
|
||||
if (const AstCase* casep = VN_CAST(nodep, Case)) {
|
||||
if (casep->fullPragma() || casep->parallelPragma()) {
|
||||
|
|
@ -186,20 +186,20 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
if (casep->parallelPragma()) puts(" parallel_case");
|
||||
}
|
||||
}
|
||||
nodep->itemsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->itemsp());
|
||||
putqs(nodep,"endcase\n");
|
||||
}
|
||||
virtual void visit(AstCaseItem* nodep) {
|
||||
if (nodep->condsp()) {
|
||||
nodep->condsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condsp());
|
||||
} else putbs("default");
|
||||
putfs(nodep,": begin ");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
putqs(nodep,"end\n");
|
||||
}
|
||||
virtual void visit(AstComment* nodep) {
|
||||
puts((string)"// "+nodep->name()+"\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstContinue* nodep) {
|
||||
putbs("continue");
|
||||
|
|
@ -212,11 +212,11 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
void visitNodeDisplay(AstNode* nodep, AstNode* fileOrStrgp, const string& text, AstNode* exprsp) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
putbs(" (");
|
||||
if (fileOrStrgp) { fileOrStrgp->iterateAndNext(*this); putbs(","); }
|
||||
if (fileOrStrgp) { iterateAndNextNull(fileOrStrgp); putbs(","); }
|
||||
putsQuoted(text);
|
||||
for (AstNode* expp=exprsp; expp; expp = expp->nextp()) {
|
||||
puts(",");
|
||||
expp->iterateAndNext(*this);
|
||||
iterateAndNextNull(expp);
|
||||
}
|
||||
puts(");\n");
|
||||
}
|
||||
|
|
@ -241,23 +241,23 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
virtual void visit(AstFOpen* nodep) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
putbs(" (");
|
||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
||||
if (nodep->filep()) iterateAndNextNull(nodep->filep());
|
||||
putbs(",");
|
||||
if (nodep->filenamep()) nodep->filenamep()->iterateAndNext(*this);
|
||||
if (nodep->filenamep()) iterateAndNextNull(nodep->filenamep());
|
||||
putbs(",");
|
||||
if (nodep->modep()) nodep->modep()->iterateAndNext(*this);
|
||||
if (nodep->modep()) iterateAndNextNull(nodep->modep());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstFClose* nodep) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
putbs(" (");
|
||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
||||
if (nodep->filep()) iterateAndNextNull(nodep->filep());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstFFlush* nodep) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
putbs(" (");
|
||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
||||
if (nodep->filep()) iterateAndNextNull(nodep->filep());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstJumpGo* nodep) {
|
||||
|
|
@ -265,57 +265,57 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
}
|
||||
virtual void visit(AstJumpLabel* nodep) {
|
||||
putbs("begin : "+cvtToStr((void*)(nodep))+"\n");
|
||||
if (nodep->stmtsp()) nodep->stmtsp()->iterateAndNext(*this);
|
||||
if (nodep->stmtsp()) iterateAndNextNull(nodep->stmtsp());
|
||||
puts("end\n");
|
||||
}
|
||||
virtual void visit(AstNodeReadWriteMem* nodep) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
putbs(" (");
|
||||
if (nodep->filenamep()) nodep->filenamep()->iterateAndNext(*this);
|
||||
if (nodep->filenamep()) iterateAndNextNull(nodep->filenamep());
|
||||
putbs(",");
|
||||
if (nodep->memp()) nodep->memp()->iterateAndNext(*this);
|
||||
if (nodep->lsbp()) { putbs(","); nodep->lsbp()->iterateAndNext(*this); }
|
||||
if (nodep->msbp()) { putbs(","); nodep->msbp()->iterateAndNext(*this); }
|
||||
if (nodep->memp()) iterateAndNextNull(nodep->memp());
|
||||
if (nodep->lsbp()) { putbs(","); iterateAndNextNull(nodep->lsbp()); }
|
||||
if (nodep->msbp()) { putbs(","); iterateAndNextNull(nodep->msbp()); }
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstSysFuncAsTask* nodep) {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(";\n");
|
||||
}
|
||||
virtual void visit(AstSysIgnore* nodep) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
putbs(" (");
|
||||
nodep->exprsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->exprsp());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstNodeFor* nodep) {
|
||||
putfs(nodep,"for (");
|
||||
m_suppressSemi = true;
|
||||
nodep->initsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->initsp());
|
||||
puts(";");
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
puts(";");
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
m_suppressSemi = false;
|
||||
puts(") begin\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
putqs(nodep,"end\n");
|
||||
}
|
||||
virtual void visit(AstRepeat* nodep) {
|
||||
putfs(nodep,"repeat (");
|
||||
nodep->countp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->countp());
|
||||
puts(") begin\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
putfs(nodep,"end\n");
|
||||
}
|
||||
virtual void visit(AstWhile* nodep) {
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
putfs(nodep,"while (");
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
puts(") begin\n");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
iterateAndNextNull(nodep->precondsp()); // Need to recompute before next loop
|
||||
putfs(nodep,"end\n");
|
||||
}
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
|
|
@ -326,19 +326,19 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
if (ifp->unique0Pragma()) puts("unique0 ");
|
||||
}
|
||||
puts("if (");
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
puts(") begin\n");
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
if (nodep->elsesp()) {
|
||||
putqs(nodep,"end\n");
|
||||
putqs(nodep,"else begin\n");
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
}
|
||||
putqs(nodep,"end\n");
|
||||
}
|
||||
virtual void visit(AstReturn* nodep) {
|
||||
putfs(nodep,"return ");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
puts(";\n");
|
||||
}
|
||||
virtual void visit(AstStop* nodep) {
|
||||
|
|
@ -354,22 +354,22 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
}
|
||||
virtual void visit(AstCStmt* nodep) {
|
||||
putfs(nodep,"$_CSTMT(");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstCMath* nodep) {
|
||||
putfs(nodep,"$_CMATH(");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstUCStmt* nodep) {
|
||||
putfs(nodep,"$c(");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
puts(");\n");
|
||||
}
|
||||
virtual void visit(AstUCFunc* nodep) {
|
||||
putfs(nodep,"$c(");
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
puts(")");
|
||||
}
|
||||
|
||||
|
|
@ -399,22 +399,22 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
case 'k': putbs(""); break;
|
||||
case 'l': {
|
||||
if (!lhsp) { nodep->v3fatalSrc("emitVerilog() references undef node"); }
|
||||
else lhsp->iterateAndNext(*this);
|
||||
else iterateAndNextNull(lhsp);
|
||||
break;
|
||||
}
|
||||
case 'r': {
|
||||
if (!rhsp) { nodep->v3fatalSrc("emitVerilog() references undef node"); }
|
||||
else rhsp->iterateAndNext(*this);
|
||||
else iterateAndNextNull(rhsp);
|
||||
break;
|
||||
}
|
||||
case 't': {
|
||||
if (!thsp) { nodep->v3fatalSrc("emitVerilog() references undef node"); }
|
||||
else thsp->iterateAndNext(*this);
|
||||
else iterateAndNextNull(thsp);
|
||||
break;
|
||||
}
|
||||
case 'd': {
|
||||
if (!nodep->dtypep()) { nodep->v3fatalSrc("emitVerilog() references undef node"); }
|
||||
else nodep->dtypep()->iterateAndNext(*this);
|
||||
else iterateAndNextNull(nodep->dtypep());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -439,10 +439,10 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
}
|
||||
virtual void visit(AstAttrOf* nodep) {
|
||||
putfs(nodep,"$_ATTROF(");
|
||||
nodep->fromp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fromp());
|
||||
if (nodep->dimp()) {
|
||||
putbs(",");
|
||||
nodep->dimp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->dimp());
|
||||
}
|
||||
puts(")");
|
||||
}
|
||||
|
|
@ -453,16 +453,16 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
int index = nodep->posIndex(pos);
|
||||
puts(cvtToStr(index));
|
||||
puts(":");
|
||||
itemp->accept(*this);
|
||||
iterate(itemp);
|
||||
if (itemp->nextp()) putbs(",");
|
||||
}
|
||||
puts("}");
|
||||
}
|
||||
virtual void visit(AstNodeCond* nodep) {
|
||||
putbs("(");
|
||||
nodep->condp()->iterateAndNext(*this); putfs(nodep," ? ");
|
||||
nodep->expr1p()->iterateAndNext(*this); putbs(" : ");
|
||||
nodep->expr2p()->iterateAndNext(*this); puts(")");
|
||||
iterateAndNextNull(nodep->condp()); putfs(nodep," ? ");
|
||||
iterateAndNextNull(nodep->expr1p()); putbs(" : ");
|
||||
iterateAndNextNull(nodep->expr2p()); puts(")");
|
||||
}
|
||||
virtual void visit(AstRange* nodep) {
|
||||
puts("[");
|
||||
|
|
@ -471,18 +471,18 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
puts(cvtToStr(VN_CAST(nodep->leftp(), Const)->toSInt())); puts(":");
|
||||
puts(cvtToStr(VN_CAST(nodep->rightp(), Const)->toSInt())); puts("]");
|
||||
} else {
|
||||
nodep->leftp()->iterateAndNext(*this); puts(":");
|
||||
nodep->rightp()->iterateAndNext(*this); puts("]");
|
||||
iterateAndNextNull(nodep->leftp()); puts(":");
|
||||
iterateAndNextNull(nodep->rightp()); puts("]");
|
||||
}
|
||||
}
|
||||
virtual void visit(AstSel* nodep) {
|
||||
nodep->fromp()->iterateAndNext(*this); puts("[");
|
||||
iterateAndNextNull(nodep->fromp()); puts("[");
|
||||
if (VN_IS(nodep->lsbp(), Const)) {
|
||||
if (nodep->widthp()->isOne()) {
|
||||
if (VN_IS(nodep->lsbp(), Const)) {
|
||||
puts(cvtToStr(VN_CAST(nodep->lsbp(), Const)->toSInt()));
|
||||
} else {
|
||||
nodep->lsbp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lsbp());
|
||||
}
|
||||
} else {
|
||||
puts(cvtToStr(VN_CAST(nodep->lsbp(), Const)->toSInt()
|
||||
|
|
@ -492,44 +492,44 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
puts(cvtToStr(VN_CAST(nodep->lsbp(), Const)->toSInt()));
|
||||
}
|
||||
} else {
|
||||
nodep->lsbp()->iterateAndNext(*this); putfs(nodep,"+:");
|
||||
nodep->widthp()->iterateAndNext(*this); puts("]");
|
||||
iterateAndNextNull(nodep->lsbp()); putfs(nodep,"+:");
|
||||
iterateAndNextNull(nodep->widthp()); puts("]");
|
||||
}
|
||||
puts("]");
|
||||
}
|
||||
virtual void visit(AstSliceSel* nodep) {
|
||||
nodep->fromp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fromp());
|
||||
puts(cvtToStr(nodep->declRange()));
|
||||
}
|
||||
virtual void visit(AstTypedef* nodep) {
|
||||
putfs(nodep,"typedef ");
|
||||
nodep->dtypep()->iterateAndNext(*this); puts(" ");
|
||||
iterateAndNextNull(nodep->dtypep()); puts(" ");
|
||||
puts(nodep->prettyName());
|
||||
puts(";\n");
|
||||
}
|
||||
virtual void visit(AstBasicDType* nodep) {
|
||||
if (nodep->isSigned()) putfs(nodep,"signed ");
|
||||
putfs(nodep,nodep->prettyName());
|
||||
if (nodep->rangep()) { puts(" "); nodep->rangep()->iterateAndNext(*this); puts(" "); }
|
||||
if (nodep->rangep()) { puts(" "); iterateAndNextNull(nodep->rangep()); puts(" "); }
|
||||
else if (nodep->isRanged()) { puts(" ["); puts(cvtToStr(nodep->msb())); puts(":0] "); }
|
||||
}
|
||||
virtual void visit(AstConstDType* nodep) {
|
||||
putfs(nodep,"const ");
|
||||
nodep->subDTypep()->accept(*this);
|
||||
iterate(nodep->subDTypep());
|
||||
}
|
||||
virtual void visit(AstNodeArrayDType* nodep) {
|
||||
nodep->subDTypep()->accept(*this);
|
||||
nodep->rangep()->iterateAndNext(*this);
|
||||
iterate(nodep->subDTypep());
|
||||
iterateAndNextNull(nodep->rangep());
|
||||
}
|
||||
virtual void visit(AstNodeClassDType* nodep) {
|
||||
puts(nodep->verilogKwd()+" ");
|
||||
if (nodep->packed()) puts("packed ");
|
||||
puts("\n");
|
||||
nodep->membersp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->membersp());
|
||||
puts("}");
|
||||
}
|
||||
virtual void visit(AstMemberDType* nodep) {
|
||||
nodep->subDTypep()->accept(*this);
|
||||
iterate(nodep->subDTypep());
|
||||
puts(" ");
|
||||
puts(nodep->name());
|
||||
puts("}");
|
||||
|
|
@ -538,11 +538,11 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
if (nodep->dotted()!="") { putfs(nodep,nodep->dotted()); puts("."); puts(nodep->prettyName()); }
|
||||
else { putfs(nodep,nodep->prettyName()); }
|
||||
puts("(");
|
||||
nodep->pinsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->pinsp());
|
||||
puts(")");
|
||||
}
|
||||
virtual void visit(AstArg* nodep) {
|
||||
nodep->exprp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->exprp());
|
||||
}
|
||||
// Terminals
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
|
|
@ -564,21 +564,21 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
|
||||
// Just iterate
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
putfs(nodep,nodep->verilogKwd());
|
||||
puts(" ");
|
||||
nodep->dtypep()->iterate(*this); puts(" ");
|
||||
iterate(nodep->dtypep()); puts(" ");
|
||||
puts(nodep->prettyName());
|
||||
puts(";\n");
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
m_sensesp = nodep->sensesp();
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
m_sensesp = NULL;
|
||||
}
|
||||
virtual void visit(AstVarScope*) {}
|
||||
|
|
@ -591,7 +591,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Not v3fatalSrc so we keep processing
|
||||
nodep->v3error("Internal: Unknown node type reached emitter: "<<nodep->prettyTypeName());
|
||||
}
|
||||
|
|
@ -620,7 +620,7 @@ class EmitVFileVisitor : public EmitVBaseVisitor {
|
|||
public:
|
||||
EmitVFileVisitor(AstNode* nodep, V3OutFile* ofp) {
|
||||
m_ofp = ofp;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~EmitVFileVisitor() {}
|
||||
};
|
||||
|
|
@ -640,7 +640,7 @@ class EmitVStreamVisitor : public EmitVBaseVisitor {
|
|||
public:
|
||||
EmitVStreamVisitor(AstNode* nodep, std::ostream& os)
|
||||
: m_os(os) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~EmitVStreamVisitor() {}
|
||||
};
|
||||
|
|
@ -711,7 +711,7 @@ public:
|
|||
AstSenTree* domainp, bool user3mark)
|
||||
: EmitVBaseVisitor(domainp), m_formatter(os, prefix, flWidth) {
|
||||
if (user3mark) { AstUser3InUse::check(); }
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~EmitVPrefixedVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
|
|||
if (tag=="") tag = VString::downcase(nodep->typeName());
|
||||
if (nodep->op1p() || nodep->op2p() || nodep->op3p() || nodep->op4p()) {
|
||||
puts(">\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
puts("</"+tag+">\n");
|
||||
} else {
|
||||
puts("/>\n");
|
||||
|
|
@ -108,7 +108,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
|
|||
}
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
puts("<netlist>\n");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
puts("</netlist>\n");
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
|
|
@ -154,7 +154,7 @@ public:
|
|||
EmitXmlFileVisitor(AstNode* nodep, V3OutFile* ofp) {
|
||||
m_ofp = ofp;
|
||||
m_id = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~EmitXmlFileVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstExtend* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isWide()) {
|
||||
// See under ASSIGN(EXTEND)
|
||||
} else {
|
||||
|
|
@ -351,7 +351,7 @@ private:
|
|||
|
||||
virtual void visit(AstSel* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Remember, Sel's may have non-integer rhs, so need to optimize for that!
|
||||
if (nodep->widthMin()!=(int)nodep->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
||||
if (VN_IS(nodep->backp(), NodeAssign) && nodep==VN_CAST(nodep->backp(), NodeAssign)->lhsp()) {
|
||||
|
|
@ -652,7 +652,7 @@ private:
|
|||
|
||||
virtual void visit(AstConcat* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isWide()) {
|
||||
// See under ASSIGN(WIDE)
|
||||
} else {
|
||||
|
|
@ -692,7 +692,7 @@ private:
|
|||
|
||||
virtual void visit(AstReplicate* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isWide()) {
|
||||
// See under ASSIGN(WIDE)
|
||||
} else {
|
||||
|
|
@ -753,7 +753,7 @@ private:
|
|||
|
||||
virtual void visit(AstChangeXor* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(8," Wordize ChangeXor "<<nodep<<endl);
|
||||
// -> (0=={or{for each_word{WORDSEL(lhs,#)^WORDSEL(rhs,#)}}}
|
||||
AstNode* newp = NULL;
|
||||
|
|
@ -768,7 +768,7 @@ private:
|
|||
|
||||
void visitEqNeq(AstNodeBiop* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->lhsp()->isWide()) {
|
||||
UINFO(8," Wordize EQ/NEQ "<<nodep<<endl);
|
||||
// -> (0=={or{for each_word{WORDSEL(lhs,#)^WORDSEL(rhs,#)}}}
|
||||
|
|
@ -794,7 +794,7 @@ private:
|
|||
|
||||
virtual void visit(AstRedOr* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->lhsp()->isWide()) {
|
||||
UINFO(8," Wordize REDOR "<<nodep<<endl);
|
||||
// -> (0!={or{for each_word{WORDSEL(lhs,#)}}}
|
||||
|
|
@ -818,7 +818,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstRedAnd* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->lhsp()->isWide()) {
|
||||
UINFO(8," Wordize REDAND "<<nodep<<endl);
|
||||
// -> (0!={and{for each_word{WORDSEL(lhs,#)}}}
|
||||
|
|
@ -847,7 +847,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstRedXor* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->lhsp()->isWide()) {
|
||||
UINFO(8," Wordize REDXOR "<<nodep<<endl);
|
||||
// -> (0!={redxor{for each_word{XOR(WORDSEL(lhs,#))}}}
|
||||
|
|
@ -867,13 +867,13 @@ private:
|
|||
virtual void visit(AstNodeStmt* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
m_stmtp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_stmtp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
m_stmtp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
bool did = false;
|
||||
if (nodep->isWide() && ((VN_IS(nodep->lhsp(), VarRef)
|
||||
|| VN_IS(nodep->lhsp(), ArraySel)))
|
||||
|
|
@ -918,14 +918,14 @@ private:
|
|||
// Default: Just iterate
|
||||
virtual void visit(AstVar*) {} // Don't hit varrefs under vars
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit ExpandVisitor(AstNetlist* nodep) {
|
||||
m_stmtp=NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ExpandVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNodeVarRef* nodep) {
|
||||
++m_ops;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// We only allow a LHS ref for the var being set, and a RHS ref for something else being read.
|
||||
if (nodep->varScopep()->varp()->isSc()) {
|
||||
clearSimple("SystemC sig"); // Don't want to eliminate the VL_ASSIGN_SI's
|
||||
|
|
@ -236,7 +236,7 @@ private:
|
|||
m_substTreep = nodep->rhsp();
|
||||
if (!VN_IS(nodep->lhsp(), NodeVarRef))
|
||||
clearSimple("ASSIGN(non-VARREF)");
|
||||
else nodep->iterateChildren(*this);
|
||||
else iterateChildren(nodep);
|
||||
// We don't push logic other then assignments/NOTs into SenItems
|
||||
// This avoids a mess in computing what exactly a POSEDGE is
|
||||
// V3Const cleans up any NOTs by flipping the edges for us
|
||||
|
|
@ -265,7 +265,7 @@ private:
|
|||
UINFO(5, "Non optimizable type: "<<nodep<<endl);
|
||||
clearSimple("Non optimizable type");
|
||||
}
|
||||
else nodep->iterateChildren(*this);
|
||||
else iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -277,7 +277,7 @@ public:
|
|||
m_dedupe = dedupe;
|
||||
m_ops = 0;
|
||||
// Iterate
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
// Check results
|
||||
if (!m_substTreep) {
|
||||
clearSimple("No assignment found\n");
|
||||
|
|
@ -343,7 +343,7 @@ private:
|
|||
}
|
||||
if (consumeReason) m_logicVertexp->setConsumed(consumeReason);
|
||||
if (VN_IS(nodep, SenItem)) m_logicVertexp->setConsumed("senItem");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_logicVertexp = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -384,7 +384,7 @@ private:
|
|||
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
//if (debug()>6) m_graph.dump();
|
||||
if (debug()>6) m_graph.dumpDotFilePrefixed("gate_pre");
|
||||
warnSignals(); // Before loss of sync/async pointers
|
||||
|
|
@ -411,14 +411,14 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
m_activeReducible = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
UINFO(4," SCOPE "<<nodep<<endl);
|
||||
m_scopep = nodep;
|
||||
m_logicVertexp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
|
|
@ -427,7 +427,7 @@ private:
|
|||
m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible
|
||||
m_activep = nodep;
|
||||
AstNode::user2ClearTree();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
AstNode::user2ClearTree();
|
||||
m_activep = NULL;
|
||||
m_activeReducible = true;
|
||||
|
|
@ -475,7 +475,7 @@ private:
|
|||
// The gating term of a AstSenGate is normal logic
|
||||
m_inSenItem = true;
|
||||
if (m_logicVertexp) { // Already under logic; presumably a SenGate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else { // Standalone item, probably right under a SenTree
|
||||
iterateNewStmt(nodep, NULL, NULL);
|
||||
}
|
||||
|
|
@ -511,13 +511,13 @@ private:
|
|||
if (VN_IS(nodep->backp(), NodeAssign) && VN_CAST(nodep->backp(), NodeAssign)->lhsp()==nodep) {
|
||||
nodep->v3fatalSrc("Concat on LHS of assignment; V3Const should have deleted it");
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isOutputter() && m_logicVertexp) m_logicVertexp->setConsumed("outputter");
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ public:
|
|||
m_activeReducible = true;
|
||||
m_inSenItem = false;
|
||||
m_inSlow = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~GateVisitor() {
|
||||
V3Stats::addStat("Optimizations, Gate sigs deleted", m_statSigs);
|
||||
|
|
@ -848,7 +848,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -857,7 +857,7 @@ public:
|
|||
m_didReplace = false;
|
||||
m_elimVarScp = varscp;
|
||||
m_replaceTreep = replaceTreep;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
bool didReplace() const { return m_didReplace; }
|
||||
};
|
||||
|
|
@ -971,7 +971,7 @@ private:
|
|||
if (m_dedupable) {
|
||||
if (!m_always) {
|
||||
m_always = true;
|
||||
alwaysp->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(alwaysp->bodysp());
|
||||
} else {
|
||||
m_dedupable = false;
|
||||
}
|
||||
|
|
@ -985,7 +985,7 @@ private:
|
|||
if (m_dedupable) {
|
||||
if (m_always && !m_ifCondp && !ifp->elsesp()) { //we're under an always, this is the first IF, and there's no else
|
||||
m_ifCondp = ifp->condp();
|
||||
ifp->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(ifp->ifsp());
|
||||
} else {
|
||||
m_dedupable = false;
|
||||
}
|
||||
|
|
@ -1013,7 +1013,7 @@ public:
|
|||
m_ifCondp = NULL;
|
||||
m_always = false;
|
||||
m_dedupable = true;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
if (m_dedupable && m_assignp) {
|
||||
AstNode* lhsp = m_assignp->lhsp();
|
||||
// Possible todo, handle more complex lhs expressions
|
||||
|
|
@ -1292,13 +1292,13 @@ private:
|
|||
}
|
||||
virtual void visit(AstConcat* nodep) {
|
||||
UINFO(9,"CLK DECOMP Concat search (off = "<<m_offset<<") - "<<nodep<<endl);
|
||||
nodep->rhsp()->iterate(*this);
|
||||
nodep->lhsp()->iterate(*this);
|
||||
iterate(nodep->rhsp());
|
||||
iterate(nodep->lhsp());
|
||||
}
|
||||
//--------------------
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -1315,7 +1315,7 @@ public:
|
|||
m_offset = 0;
|
||||
m_found = false;
|
||||
// Iterate
|
||||
concatp->accept(*this);
|
||||
iterate(concatp);
|
||||
UINFO(9,"CLK DECOMP Concat Offset (found = "<<m_found<<") ("<<m_found_offset<<") - "<<concatp<<" : "<<vscp<<endl);
|
||||
offsetr = m_found_offset;
|
||||
return m_found;
|
||||
|
|
@ -1480,13 +1480,13 @@ private:
|
|||
virtual void visit(AstVar* nodep) {}
|
||||
virtual void visit(AstActive* nodep) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit GateDeassignVisitor(AstNode* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~GateDeassignVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ private:
|
|||
if (!scopep) nodep->v3fatalSrc("No scope found on top level");
|
||||
m_scopetopp = scopep;
|
||||
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
//----
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
|
|
@ -115,17 +115,18 @@ private:
|
|||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
m_activep = nodep;
|
||||
nodep->sensesp()->iterateChildren(*this); // iterateAndNext?
|
||||
if (!nodep->sensesp()) nodep->v3fatalSrc("Unlinked");
|
||||
iterateChildren(nodep->sensesp()); // iterateAndNext?
|
||||
m_activep = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//-----
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -133,7 +134,7 @@ public:
|
|||
m_topModp = topModp;
|
||||
m_scopetopp = NULL;
|
||||
m_activep = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~GenClkRenameVisitor() {}
|
||||
};
|
||||
|
|
@ -157,7 +158,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
AstNode::user1ClearTree(); // user1p() used on entire tree
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
{
|
||||
// Make the new clock signals and replace any activate references
|
||||
// See rename, it does some AstNode::userClearTree()'s
|
||||
|
|
@ -168,15 +169,15 @@ private:
|
|||
// Only track the top scopes, not lower level functions
|
||||
if (nodep->isTop()) {
|
||||
m_topModp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->funcp()->entryPoint()) {
|
||||
// Enter the function and trace it
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
iterate(nodep->funcp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
|
|
@ -187,7 +188,7 @@ private:
|
|||
return;
|
||||
}
|
||||
m_tracingCall = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
//----
|
||||
|
||||
|
|
@ -209,21 +210,22 @@ private:
|
|||
virtual void visit(AstNodeAssign* nodep) {
|
||||
//UINFO(8,"ASS "<<nodep<<endl);
|
||||
m_assignp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_assignp = NULL;
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
UINFO(8,"ACTIVE "<<nodep<<endl);
|
||||
m_activep = nodep;
|
||||
nodep->sensesp()->iterateChildren(*this); // iterateAndNext?
|
||||
if (!nodep->sensesp()) nodep->v3fatalSrc("Unlinked");
|
||||
iterateChildren(nodep->sensesp()); // iterateAndNext?
|
||||
m_activep = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//-----
|
||||
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -232,7 +234,7 @@ public:
|
|||
, m_tracingCall(false)
|
||||
, m_assignp(NULL)
|
||||
, m_topModp(NULL) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~GenClkReadVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private:
|
|||
// For identical nodes, the type should be the same thus dtypep should be the same too
|
||||
m_lowerHash = V3Hash(m_lowerHash, V3Hash(nodep->type()<<6, V3Hash(nodep->dtypep())));
|
||||
// Now update m_lowerHash for our children's (and next children) contributions
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Store the hash value
|
||||
nodep->user4(m_lowerHash.fullValue());
|
||||
//UINFO(9, " hashnode "<<m_lowerHash<<" "<<nodep<<endl);
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@ private:
|
|||
}
|
||||
if (m_modp->modPublic()) cantInline("modPublic",false);
|
||||
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCell* nodep) {
|
||||
nodep->modp()->user3Inc(); // Inc refs
|
||||
m_instances[m_modp][nodep->modp()]++;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstPragma* nodep) {
|
||||
if (nodep->pragType() == AstPragmaType::INLINE_MODULE) {
|
||||
|
|
@ -143,7 +143,7 @@ private:
|
|||
}
|
||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); // Remove so don't propagate to upper cell...
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstVarXRef* nodep) {
|
||||
|
|
@ -153,23 +153,23 @@ private:
|
|||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
// Cleanup link until V3LinkDot can correct it
|
||||
if (!nodep->packagep()) nodep->taskp(NULL);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstAlways* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp->user4Inc(); // statement count
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
// Don't count assignments, as they'll likely flatten out
|
||||
// Still need to iterate though to nullify VarXRefs
|
||||
int oldcnt = m_modp->user4();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp->user4(oldcnt);
|
||||
}
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Build user2, user3, and user4 for all modules.
|
||||
// Also build m_allMods and m_instances.
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
|
||||
// Iterate through all modules in bottom-up order.
|
||||
// Make a final inlining decision for each.
|
||||
|
|
@ -210,7 +210,7 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_modp) {
|
||||
m_modp->user4Inc(); // Inc statement count
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ public:
|
|||
// CONSTUCTORS
|
||||
explicit InlineMarkVisitor(AstNode* nodep) {
|
||||
m_modp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InlineMarkVisitor() {
|
||||
V3Stats::addStat("Optimizations, Inline unsupported", m_statUnsup);
|
||||
|
|
@ -255,13 +255,13 @@ private:
|
|||
virtual void visit(AstNodeStmt* nodep) {}
|
||||
virtual void visit(AstNodeMath* nodep) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit InlineCollectVisitor(AstNodeModule* nodep) { // passed OLD module, not new one
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InlineCollectVisitor() {}
|
||||
};
|
||||
|
|
@ -298,17 +298,17 @@ private:
|
|||
nodep->name(name);
|
||||
UINFO(6, " Inline "<<nodep<<endl);
|
||||
// Do CellInlines under this, but don't move them
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCell* nodep) {
|
||||
// Cell under the inline cell, need to rename to avoid conflicts
|
||||
string name = m_cellp->name() + "__DOT__" + nodep->name();
|
||||
nodep->name(name);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstModule* nodep) {
|
||||
m_renamedInterfaces.clear();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
if (nodep->user2p()) {
|
||||
|
|
@ -376,17 +376,17 @@ private:
|
|||
if (!m_cellp->isTrace()) nodep->trace(false);
|
||||
if (debug()>=9) { nodep->dumpTree(cout,"varchanged:"); }
|
||||
if (debug()>=9 && nodep->valuep()) { nodep->valuep()->dumpTree(cout,"varchangei:"); }
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
// Function under the inline cell, need to rename to avoid conflicts
|
||||
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstTypedef* nodep) {
|
||||
// Typedef under the inline cell, need to rename to avoid conflicts
|
||||
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
if (nodep->varp()->user2p() // It's being converted to an alias.
|
||||
|
|
@ -407,7 +407,7 @@ private:
|
|||
}
|
||||
}
|
||||
nodep->name(nodep->varp()->name());
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVarXRef* nodep) {
|
||||
// Track what scope it was originally under so V3LinkDot can resolve it
|
||||
|
|
@ -426,7 +426,7 @@ private:
|
|||
tryname = tryname.substr(0, pos);
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
// Track what scope it was originally under so V3LinkDot can resolve it
|
||||
|
|
@ -436,7 +436,7 @@ private:
|
|||
nodep->dotted(m_cellp->name() + "__DOT__" + nodep->dotted());
|
||||
}
|
||||
UINFO(8," "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// Not needed, as V3LinkDot doesn't care about typedefs
|
||||
|
|
@ -454,15 +454,15 @@ private:
|
|||
if (afterp) afterp->unlinkFrBackWithNext();
|
||||
nodep->scopeEntrp(new AstText(nodep->fileline(), (string)"__DOT__"+m_cellp->name()));
|
||||
if (afterp) nodep->scopeEntrp(afterp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCoverDecl* nodep) {
|
||||
// Fix path in coverage statements
|
||||
nodep->hier(VString::dot(m_cellp->prettyName(), ".", nodep->hier()));
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -470,7 +470,7 @@ public:
|
|||
InlineRelinkVisitor(AstNodeModule* cloneModp, AstNodeModule* oldModp, AstCell* cellp) {
|
||||
m_modp = oldModp;
|
||||
m_cellp = cellp;
|
||||
cloneModp->accept(*this);
|
||||
iterate(cloneModp);
|
||||
}
|
||||
virtual ~InlineRelinkVisitor() {}
|
||||
};
|
||||
|
|
@ -508,7 +508,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Iterate modules backwards, in bottom-up order. Required!
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
virtual void visit(AstIfaceRefDType* nodep) {
|
||||
if (nodep->user5()) {
|
||||
|
|
@ -520,7 +520,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCell* nodep) {
|
||||
if (nodep->modp()->user1()) { // Marked with inline request
|
||||
|
|
@ -605,14 +605,14 @@ private:
|
|||
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||
virtual void visit(AstNodeStmt* nodep) {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit InlineVisitor(AstNode* nodep) {
|
||||
m_modp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InlineVisitor() {
|
||||
V3Stats::addStat("Optimizations, Inlined cells", m_statCells);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ private:
|
|||
m_cellp = nodep;
|
||||
//VV***** We reset user1p() on each cell!!!
|
||||
AstNode::user1ClearTree();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_cellp = NULL;
|
||||
}
|
||||
virtual void visit(AstPin* nodep) {
|
||||
|
|
@ -132,14 +132,14 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit InstVisitor(AstNetlist* nodep) {
|
||||
m_cellp=NULL;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InstVisitor() {}
|
||||
};
|
||||
|
|
@ -165,13 +165,13 @@ private:
|
|||
UINFO(8," dm-1-VAR "<<nodep<<endl);
|
||||
insert(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
// Save some time
|
||||
virtual void visit(AstNodeMath*) {}
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// METHODS
|
||||
|
|
@ -198,7 +198,7 @@ public:
|
|||
void main(AstNodeModule* nodep) {
|
||||
UINFO(8," dmMODULE "<<nodep<<endl);
|
||||
m_modVarNameMap.clear();
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InstDeModVarVisitor() {}
|
||||
};
|
||||
|
|
@ -251,7 +251,7 @@ private:
|
|||
if (prevp) nodep->addNextHere(prevp);
|
||||
if (prevp && debug()==9) { prevp->dumpTree(cout, "newintf: "); cout << endl; }
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstCell* nodep) {
|
||||
|
|
@ -302,7 +302,7 @@ private:
|
|||
if (debug()==9) { varNewp->dumpTree(cout, "newintf: "); cout << endl; }
|
||||
}
|
||||
// Fixup pins
|
||||
newp->pinsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(newp->pinsp());
|
||||
if (debug()==9) { newp->dumpTree(cout,"newcell: "); cout<<endl; }
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ private:
|
|||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||
} else {
|
||||
m_cellRangep = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -456,7 +456,7 @@ public:
|
|||
m_cellRangep=NULL;
|
||||
m_instSelNum=0;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InstDeVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ private:
|
|||
// Similar code in V3Dead
|
||||
vluint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited
|
||||
m_sideEffect = false;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
if (lastEdit != AstNode::editCountGbl()) {
|
||||
// We changed something, try to constant propagate, but don't delete the
|
||||
// assignment as we still need nodep to remain.
|
||||
|
|
@ -334,30 +334,30 @@ private:
|
|||
if (!vscp) nodep->v3fatalSrc("Scope lost on variable");
|
||||
m_lifep->simpleAssign(vscp, nodep);
|
||||
} else {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstAssignDly* nodep) {
|
||||
// Don't treat as normal assign; V3Life doesn't understand time sense
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//---- Track control flow changes
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
UINFO(4," IF "<<nodep<<endl);
|
||||
// Condition is part of PREVIOUS block
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
LifeBlock* prevLifep = m_lifep;
|
||||
LifeBlock* ifLifep = new LifeBlock (prevLifep, m_statep);
|
||||
LifeBlock* elseLifep = new LifeBlock (prevLifep, m_statep);
|
||||
{
|
||||
m_lifep = ifLifep;
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
m_lifep = prevLifep;
|
||||
}
|
||||
{
|
||||
m_lifep = elseLifep;
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
m_lifep = prevLifep;
|
||||
}
|
||||
UINFO(4," join "<<endl);
|
||||
|
|
@ -383,14 +383,14 @@ private:
|
|||
LifeBlock* bodyLifep = new LifeBlock (prevLifep, m_statep);
|
||||
{
|
||||
m_lifep = condLifep;
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
iterateAndNextNull(nodep->condp());
|
||||
m_lifep = prevLifep;
|
||||
}
|
||||
{
|
||||
m_lifep = bodyLifep;
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
m_lifep = prevLifep;
|
||||
}
|
||||
UINFO(4," joinfor"<<endl);
|
||||
|
|
@ -410,7 +410,7 @@ private:
|
|||
{
|
||||
m_lifep = bodyLifep;
|
||||
m_noopt = true;
|
||||
nodep->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
m_lifep = prevLifep;
|
||||
m_noopt = prev_noopt;
|
||||
}
|
||||
|
|
@ -421,11 +421,11 @@ private:
|
|||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
//UINFO(4," CCALL "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Enter the function and trace it
|
||||
if (!nodep->funcp()->entryPoint()) { // else is non-inline or public function we optimize separately
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
iterate(nodep->funcp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
|
|
@ -435,20 +435,20 @@ private:
|
|||
if (nodep->dpiImport() && !nodep->pure()) {
|
||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstUCFunc* nodep) {
|
||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCMath* nodep) {
|
||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -461,7 +461,7 @@ public:
|
|||
m_tracingCall = false;
|
||||
{
|
||||
m_lifep = new LifeBlock (NULL, m_statep);
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
if (m_lifep) { delete m_lifep; m_lifep=NULL; }
|
||||
}
|
||||
}
|
||||
|
|
@ -502,13 +502,13 @@ private:
|
|||
virtual void visit(AstNodeStmt*) {} // Accelerate
|
||||
virtual void visit(AstNodeMath*) {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
LifeTopVisitor(AstNetlist* nodep, LifeState* statep) {
|
||||
m_statep = statep;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LifeTopVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -75,30 +75,30 @@ private:
|
|||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
// Only track the top scopes, not lower level functions
|
||||
if (nodep->isTop()) nodep->iterateChildren(*this);
|
||||
if (nodep->isTop()) iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->funcp()->entryPoint()) {
|
||||
// Enter the function and trace it
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
iterate(nodep->funcp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
if (!m_tracingCall && !nodep->entryPoint()) return;
|
||||
m_tracingCall = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit LifePostElimVisitor(AstTopScope* nodep)
|
||||
: m_tracingCall(false) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LifePostElimVisitor() {}
|
||||
};
|
||||
|
|
@ -128,7 +128,7 @@ private:
|
|||
AstNode::user2ClearTree(); // user2p() used on entire tree
|
||||
AstNode::user4ClearTree(); // user4p() used on entire tree
|
||||
m_sequence = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
|
||||
// Replace any node4p varscopes with the new scope
|
||||
LifePostElimVisitor visitor (nodep);
|
||||
|
|
@ -190,32 +190,32 @@ private:
|
|||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
// Only track the top scopes, not lower level functions
|
||||
if (nodep->isTop()) nodep->iterateChildren(*this);
|
||||
if (nodep->isTop()) iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->funcp()->entryPoint()) {
|
||||
// Enter the function and trace it
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
iterate(nodep->funcp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
if (!m_tracingCall && !nodep->entryPoint()) return;
|
||||
m_tracingCall = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//-----
|
||||
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit LifePostDlyVisitor(AstNetlist* nodep)
|
||||
: m_tracingCall(false) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LifePostDlyVisitor() {
|
||||
V3Stats::addStat("Optimizations, Lifetime postassign deletions", m_statAssnDel);
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ private:
|
|||
virtual void visit(AstNetlist* nodep) {
|
||||
AstNode::user1ClearTree();
|
||||
readModNames();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Find levels in graph
|
||||
m_graph.removeRedundantEdges(&V3GraphEdge::followAlwaysTrue);
|
||||
m_graph.dumpDotFilePrefixed("linkcells");
|
||||
|
|
@ -219,7 +219,7 @@ private:
|
|||
new V3GraphEdge(&m_graph, m_libVertexp, vertex(nodep), 1, false);
|
||||
}
|
||||
// Note AstBind also has iteration on cells
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->checkTree();
|
||||
m_modp = NULL;
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ private:
|
|||
|
||||
virtual void visit(AstPackageImport* nodep) {
|
||||
// Package Import: We need to do the package before the use of a package
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->packagep()) nodep->v3fatalSrc("Unlinked package"); // Parser should set packagep
|
||||
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false);
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ private:
|
|||
{
|
||||
m_modp = modp;
|
||||
modp->addStmtp(cellsp); // Important that this adds to end, as next iterate assumes does all cells
|
||||
cellsp->iterateAndNext(*this);
|
||||
iterateAndNextNull(cellsp);
|
||||
}
|
||||
m_modp = oldModp;
|
||||
}
|
||||
|
|
@ -428,7 +428,7 @@ private:
|
|||
}
|
||||
}
|
||||
if (nodep->modp()) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
UINFO(4," Link Cell done: "<<nodep<<endl);
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ private:
|
|||
virtual void visit(AstNodeMath* nodep) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// METHODS
|
||||
|
|
@ -470,7 +470,7 @@ public:
|
|||
m_modp = NULL;
|
||||
m_libVertexp = NULL;
|
||||
m_topVertexp = NULL;
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkCellsVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -653,7 +653,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
m_statep->insertDUnit(nodep);
|
||||
|
||||
// First back iterate, to find all packages. Backward as must do base packages before using packages
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
|
||||
// The first module in the list is always the top module (sorted before this is called).
|
||||
// This may not be the module with isTop() set, as early in the steps,
|
||||
|
|
@ -666,7 +666,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
m_scope = "TOP";
|
||||
m_curSymp = m_modSymp = m_statep->insertTopCell(topmodp, m_scope);
|
||||
{
|
||||
topmodp->accept(*this);
|
||||
iterate(topmodp);
|
||||
}
|
||||
m_scope = "";
|
||||
m_curSymp = m_modSymp = NULL;
|
||||
|
|
@ -712,7 +712,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
// m_modSymp/m_curSymp for non-packages set by AstCell above this module
|
||||
// Iterate
|
||||
nodep->user2(true);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user2(false);
|
||||
nodep->user4(true);
|
||||
// Interfaces need another pass when signals are resolved
|
||||
|
|
@ -741,7 +741,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
UINFO(5," CELL under "<<m_scope<<" is "<<nodep<<endl);
|
||||
// Process XREFs/etc inside pins
|
||||
if (nodep->recursive() && m_inRecursion) return;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Recurse in, preserving state
|
||||
string oldscope = m_scope;
|
||||
AstBegin* oldbeginp = m_beginp;
|
||||
|
|
@ -769,7 +769,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
m_beginp = NULL;
|
||||
m_inRecursion = nodep->recursive();
|
||||
// We don't report NotFoundModule, as may be a unused module in a generate
|
||||
if (nodep->modp()) nodep->modp()->accept(*this);
|
||||
if (nodep->modp()) iterate(nodep->modp());
|
||||
}
|
||||
m_scope = oldscope;
|
||||
m_beginp = oldbeginp;
|
||||
|
|
@ -800,7 +800,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
}
|
||||
virtual void visit(AstDefParam* nodep) {
|
||||
nodep->user1p(m_curSymp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstGenerate* nodep) {
|
||||
// Begin: ... blocks often replicate under genif/genfor, so simply suppress duplicate checks
|
||||
|
|
@ -808,7 +808,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
bool lastInGen = m_inGenerate;
|
||||
{
|
||||
m_inGenerate = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_inGenerate = lastInGen;
|
||||
}
|
||||
|
|
@ -848,7 +848,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
m_curSymp = m_statep->insertBlock(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||
m_curSymp->fallbackp(oldCurSymp);
|
||||
// Iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_curSymp = oldCurSymp;
|
||||
m_beginp = oldbegin;
|
||||
|
|
@ -884,7 +884,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
m_statep->insertSym(m_curSymp, newvarp->name(), newvarp, NULL/*packagep*/);
|
||||
}
|
||||
m_ftaskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ftaskp = NULL;
|
||||
}
|
||||
m_curSymp = oldCurSymp;
|
||||
|
|
@ -892,7 +892,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
virtual void visit(AstVar* nodep) {
|
||||
// Var: Remember its name for later resolution
|
||||
if (!m_curSymp || !m_modSymp) nodep->v3fatalSrc("Var not under module?");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!m_statep->forScopeCreation()) {
|
||||
// Find under either a task or the module's vars
|
||||
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
||||
|
|
@ -976,12 +976,12 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
virtual void visit(AstTypedef* nodep) {
|
||||
// Remember its name for later resolution
|
||||
if (!m_curSymp) nodep->v3fatalSrc("Typedef not under module?");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||
}
|
||||
virtual void visit(AstParamTypeDType* nodep) {
|
||||
if (!m_curSymp) nodep->v3fatalSrc("Parameter type not under module?");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
|
|
@ -990,7 +990,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
}
|
||||
virtual void visit(AstEnumItem* nodep) {
|
||||
// EnumItem: Remember its name for later resolution
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Find under either a task or the module's vars
|
||||
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
||||
if (!foundp && m_modSymp && nodep->name() == m_modSymp->nodep()->name()) foundp = m_modSymp; // Conflicts with modname?
|
||||
|
|
@ -1052,7 +1052,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -1070,7 +1070,7 @@ public:
|
|||
m_beginNum = 0;
|
||||
m_modBeginNum = 0;
|
||||
//
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkDotFindVisitor() {}
|
||||
};
|
||||
|
|
@ -1127,7 +1127,7 @@ private:
|
|||
nodep->dead(true);
|
||||
} else {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1140,7 +1140,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstDefParam* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->prettyName()<<"(...etc...))");
|
||||
VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path());
|
||||
AstCell* cellp = foundp ? VN_CAST(foundp->nodep(), Cell) : NULL;
|
||||
|
|
@ -1184,7 +1184,7 @@ private:
|
|||
// We used to nodep->allowImplicit() here, but it turns out
|
||||
// normal "assigns" can also make implicit wires. Yuk.
|
||||
pinImplicitExprRecurse(nodep->lhsp());
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstAssignAlias* nodep) {
|
||||
// tran gates need implicit creation
|
||||
|
|
@ -1196,7 +1196,7 @@ private:
|
|||
if (AstVarRef* forrefp = VN_CAST(nodep->rhsp(), VarRef)) {
|
||||
pinImplicitExprRecurse(forrefp);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstImplicit* nodep) {
|
||||
// Unsupported gates need implicit creation
|
||||
|
|
@ -1206,7 +1206,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -1216,7 +1216,7 @@ public:
|
|||
m_statep = statep;
|
||||
m_modp = NULL;
|
||||
//
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkDotParamVisitor() {}
|
||||
};
|
||||
|
|
@ -1236,7 +1236,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||
// VISITs
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Recurse..., backward as must do packages before using packages
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
UINFO(8," SCOPE "<<nodep<<endl);
|
||||
|
|
@ -1245,7 +1245,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||
// up with the hierarchy created by the CELL names.
|
||||
m_modSymp = m_statep->getScopeSym(nodep);
|
||||
m_scopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modSymp = NULL;
|
||||
m_scopep = NULL;
|
||||
}
|
||||
|
|
@ -1289,7 +1289,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||
AstVarScope* toVscp = VN_CAST(nodep->rhsp(), VarRef)->varScopep();
|
||||
if (!fromVscp || !toVscp) nodep->v3fatalSrc("Bad alias scopes");
|
||||
fromVscp->user2p(toVscp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstAssignVarScope* nodep) {
|
||||
UINFO(5,"ASSIGNVARSCOPE "<<nodep<<endl);
|
||||
|
|
@ -1341,7 +1341,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||
virtual void visit(AstNodeMath*) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -1352,7 +1352,7 @@ public:
|
|||
m_scopep = NULL;
|
||||
m_statep = statep;
|
||||
//
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkDotScopeVisitor() {}
|
||||
};
|
||||
|
|
@ -1377,13 +1377,13 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
|||
// Create symbol table for the vars
|
||||
m_curSymp = m_statep->insertBlock(m_curSymp, nodep->name(), nodep, NULL);
|
||||
m_curSymp->fallbackp(oldCurSymp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_curSymp = oldCurSymp;
|
||||
}
|
||||
virtual void visit(AstModportFTaskRef* nodep) {
|
||||
UINFO(5," fif: "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isExport()) nodep->v3error("Unsupported: modport export");
|
||||
VSymEnt* symp = m_curSymp->findIdFallback(nodep->name());
|
||||
if (!symp) {
|
||||
|
|
@ -1404,7 +1404,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
|||
}
|
||||
virtual void visit(AstModportVarRef* nodep) {
|
||||
UINFO(5," fiv: "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
VSymEnt* symp = m_curSymp->findIdFallback(nodep->name());
|
||||
if (!symp) {
|
||||
nodep->v3error("Modport item not found: "<<nodep->prettyName());
|
||||
|
|
@ -1428,7 +1428,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
|||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -1437,7 +1437,7 @@ public:
|
|||
UINFO(4,__FUNCTION__<<": "<<endl);
|
||||
m_curSymp = curSymp;
|
||||
m_statep = statep;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LinkDotIfaceVisitor() {}
|
||||
};
|
||||
|
|
@ -1582,7 +1582,7 @@ private:
|
|||
// VISITs
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Recurse..., backward as must do packages before using packages
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
virtual void visit(AstTypeTable* nodep) {}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
|
|
@ -1594,7 +1594,7 @@ private:
|
|||
m_cellp = NULL;
|
||||
m_modp = nodep;
|
||||
m_modportNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL;
|
||||
}
|
||||
|
|
@ -1604,7 +1604,7 @@ private:
|
|||
VSymEnt* oldCurSymp = m_curSymp;
|
||||
checkNoDot(nodep);
|
||||
m_ds.m_dotSymp = m_curSymp = m_modSymp = m_statep->getScopeSym(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL;
|
||||
m_modSymp = oldModSymp;
|
||||
m_curSymp = oldCurSymp;
|
||||
|
|
@ -1636,7 +1636,7 @@ private:
|
|||
UINFO(4,"(Backto) Link Cell: "<<nodep<<endl);
|
||||
//if (debug()) { nodep->dumpTree(cout,"linkcell:"); }
|
||||
//if (debug()) { nodep->modp()->dumpTree(cout,"linkcemd:"); }
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_pinSymp = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1647,7 +1647,7 @@ private:
|
|||
virtual void visit(AstPin* nodep) {
|
||||
// Pin: Link to submodule's port
|
||||
checkNoDot(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->modVarp()) {
|
||||
if (!m_pinSymp) nodep->v3fatalSrc("Pin not under cell?");
|
||||
VSymEnt* foundp = m_pinSymp->findIdFlat(nodep->name());
|
||||
|
|
@ -1701,7 +1701,7 @@ private:
|
|||
m_ds.m_dotPos = DP_PACKAGE;
|
||||
} else {
|
||||
m_ds.m_dotPos = DP_SCOPE;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
//if (debug()>=9) nodep->dumpTree("-dot-lho: ");
|
||||
}
|
||||
if (m_ds.m_unresolved && (VN_IS(nodep->lhsp(), CellRef) || VN_IS(nodep->lhsp(), CellArrayRef))) {
|
||||
|
|
@ -1709,7 +1709,7 @@ private:
|
|||
}
|
||||
if (!m_ds.m_dotErr) { // Once something wrong, give up
|
||||
if (start && m_ds.m_dotPos==DP_SCOPE) m_ds.m_dotPos = DP_FINAL; // Top 'final' dot RHS is final RHS, else it's a DOT(DOT(x,*here*),real-rhs) which we consider a RHS
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
//if (debug()>=9) nodep->dumpTree("-dot-rho: ");
|
||||
}
|
||||
if (start) {
|
||||
|
|
@ -1952,7 +1952,7 @@ private:
|
|||
// ParseRefs are used the first pass (forPrimary) so we shouldn't get can't find
|
||||
// errors here now that we have a VarRef.
|
||||
// No checkNoDot; created and iterated from a parseRef
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->varp()) {
|
||||
UINFO(9," linkVarRef se"<<(void*)m_curSymp<<" n="<<nodep<<endl);
|
||||
if (!m_curSymp) nodep->v3fatalSrc("NULL lookup symbol table");
|
||||
|
|
@ -2034,20 +2034,20 @@ private:
|
|||
}
|
||||
virtual void visit(AstEnumItemRef* nodep) {
|
||||
// EnumItemRef may be under a dot. Should already be resolved.
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstMethodSel* nodep) {
|
||||
// Created here so should already be resolved.
|
||||
DotStates lastStates = m_ds;
|
||||
{
|
||||
m_ds.init(m_curSymp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_ds = lastStates;
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
checkNoDot(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_statep->forPrimary() && nodep->isIO() && !m_ftaskp && !nodep->user4()) {
|
||||
nodep->v3error("Input/output/inout does not appear in port list: "<<nodep->prettyName());
|
||||
}
|
||||
|
|
@ -2138,13 +2138,13 @@ private:
|
|||
DotStates lastStates = m_ds;
|
||||
{
|
||||
m_ds.init(m_curSymp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_ds = lastStates;
|
||||
}
|
||||
virtual void visit(AstSelBit* nodep) {
|
||||
if (nodep->user3SetOnce()) return;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
||||
UINFO(9," deferring until after a V3Param pass: "<<nodep<<endl);
|
||||
m_ds.m_dotText += "__BRA__??__KET__";
|
||||
|
|
@ -2152,12 +2152,12 @@ private:
|
|||
// And pass up m_ds.m_dotText
|
||||
}
|
||||
// Pass dot state down to fromp()
|
||||
nodep->fromp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fromp());
|
||||
DotStates lastStates = m_ds;
|
||||
{
|
||||
m_ds.init(m_curSymp);
|
||||
nodep->bitp()->iterateAndNext(*this);
|
||||
nodep->attrp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bitp());
|
||||
iterateAndNextNull(nodep->attrp());
|
||||
}
|
||||
m_ds = lastStates;
|
||||
if (m_ds.m_unresolved && m_ds.m_dotPos == DP_SCOPE) {
|
||||
|
|
@ -2174,19 +2174,19 @@ private:
|
|||
m_ds.m_dotErr = true;
|
||||
return;
|
||||
}
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
DotStates lastStates = m_ds;
|
||||
{
|
||||
m_ds.init(m_curSymp);
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
nodep->thsp()->iterateAndNext(*this);
|
||||
nodep->attrp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
iterateAndNextNull(nodep->thsp());
|
||||
iterateAndNextNull(nodep->attrp());
|
||||
}
|
||||
m_ds = lastStates;
|
||||
}
|
||||
virtual void visit(AstMemberSel* nodep) {
|
||||
// checkNoDot not appropriate, can be under a dot
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstBegin* nodep) {
|
||||
UINFO(5," "<<nodep<<endl);
|
||||
|
|
@ -2195,7 +2195,7 @@ private:
|
|||
{
|
||||
m_ds.m_dotSymp = m_curSymp = m_statep->getNodeSym(nodep);
|
||||
UINFO(5," cur=se"<<(void*)m_curSymp<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
|
||||
UINFO(5," cur=se"<<(void*)m_curSymp<<endl);
|
||||
|
|
@ -2207,7 +2207,7 @@ private:
|
|||
{
|
||||
m_ftaskp = nodep;
|
||||
m_ds.m_dotSymp = m_curSymp = m_statep->getNodeSym(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
|
||||
m_ftaskp = NULL;
|
||||
|
|
@ -2243,11 +2243,11 @@ private:
|
|||
nodep->v3error("Can't find typedef: "<<nodep->prettyName());
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstDpiExport* nodep) {
|
||||
// AstDpiExport: Make sure the function referenced exists, then dump it
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkNoDot(nodep);
|
||||
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
||||
AstNodeFTask* taskp = foundp ? VN_CAST(foundp->nodep(), NodeFTask) : NULL;
|
||||
|
|
@ -2277,7 +2277,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstCellRef* nodep) {
|
||||
UINFO(5," AstCellRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCellArrayRef* nodep) {
|
||||
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
||||
|
|
@ -2291,7 +2291,7 @@ private:
|
|||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
checkNoDot(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -2306,7 +2306,7 @@ public:
|
|||
m_ftaskp = NULL;
|
||||
m_modportNum = 0;
|
||||
//
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkDotResolveVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -117,18 +117,18 @@ private:
|
|||
if (nodep->dead()) return;
|
||||
m_modp = nodep;
|
||||
m_repeatNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
m_ftaskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ftaskp = NULL;
|
||||
}
|
||||
virtual void visit(AstBegin* nodep) {
|
||||
UINFO(8," "<<nodep<<endl);
|
||||
m_beginStack.push_back(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_beginStack.pop_back();
|
||||
}
|
||||
virtual void visit(AstRepeat* nodep) {
|
||||
|
|
@ -167,16 +167,16 @@ private:
|
|||
bool lastInc = m_loopInc;
|
||||
m_loopp = nodep;
|
||||
m_loopInc = false;
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
iterateAndNextNull(nodep->condp());
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
m_loopInc = true;
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
m_loopInc = lastInc;
|
||||
m_loopp = lastLoopp;
|
||||
}
|
||||
virtual void visit(AstReturn* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
AstFunc* funcp = VN_CAST(m_ftaskp, Func);
|
||||
if (!m_ftaskp) { nodep->v3error("Return isn't underneath a task or function"); }
|
||||
else if (funcp && !nodep->lhsp()) { nodep->v3error("Return underneath a function should have return value"); }
|
||||
|
|
@ -195,7 +195,7 @@ private:
|
|||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||
}
|
||||
virtual void visit(AstBreak* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!m_loopp) { nodep->v3error("break isn't underneath a loop"); }
|
||||
else {
|
||||
// Jump to the end of the loop
|
||||
|
|
@ -205,7 +205,7 @@ private:
|
|||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||
}
|
||||
virtual void visit(AstContinue* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!m_loopp) { nodep->v3error("continue isn't underneath a loop"); }
|
||||
else {
|
||||
// Jump to the end of this iteration
|
||||
|
|
@ -217,7 +217,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstDisable* nodep) {
|
||||
UINFO(8," DISABLE "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
AstBegin* beginp = NULL;
|
||||
for (BeginStack::reverse_iterator it = m_beginStack.rbegin(); it != m_beginStack.rend(); ++it) {
|
||||
UINFO(9," UNDERBLK "<<*it<<endl);
|
||||
|
|
@ -242,7 +242,7 @@ private:
|
|||
|
||||
virtual void visit(AstConst* nodep) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -252,7 +252,7 @@ public:
|
|||
m_loopp = NULL;
|
||||
m_loopInc = false;
|
||||
m_repeatNum = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LinkJumpVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// Nodes that start propagating down lvalues
|
||||
|
|
@ -76,19 +76,19 @@ private:
|
|||
// When the varref's were created, we didn't know the I/O state
|
||||
// Now that we do, and it's from a output, we know it's a lvalue
|
||||
m_setRefLvalue = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_setRefLvalue = false;
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_setRefLvalue = false;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -96,10 +96,10 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
m_setRefLvalue = false;
|
||||
nodep->filenamep()->iterateAndNext(*this);
|
||||
nodep->modep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filenamep());
|
||||
iterateAndNextNull(nodep->modep());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -131,8 +131,8 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
nodep->strgp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
iterateAndNextNull(nodep->strgp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -140,8 +140,8 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->filep()->iterateAndNext(*this);
|
||||
nodep->exprsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filep());
|
||||
iterateAndNextNull(nodep->exprsp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -149,25 +149,25 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->exprsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->exprsp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
virtual void visit(AstSysIgnore* nodep) {
|
||||
// Can't know if lvalue or not; presume so as stricter
|
||||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
virtual void visit(AstReadMem* nodep) {
|
||||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->memp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->memp());
|
||||
m_setRefLvalue = false;
|
||||
nodep->filenamep()->iterateAndNext(*this);
|
||||
nodep->lsbp()->iterateAndNext(*this);
|
||||
nodep->msbp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->filenamep());
|
||||
iterateAndNextNull(nodep->lsbp());
|
||||
iterateAndNextNull(nodep->msbp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -175,9 +175,9 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = false;
|
||||
nodep->searchp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->searchp());
|
||||
m_setRefLvalue = true;
|
||||
nodep->outp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->outp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -185,9 +185,9 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
m_setRefLvalue = true;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_setRefLvalue = false;
|
||||
nodep->fmtp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fmtp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -196,20 +196,20 @@ private:
|
|||
virtual void visit(AstSel* nodep) {
|
||||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
// Only set lvalues on the from
|
||||
m_setRefLvalue = false;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
nodep->thsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
iterateAndNextNull(nodep->thsp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
virtual void visit(AstNodeSel* nodep) {
|
||||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{ // Only set lvalues on the from
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_setRefLvalue = false;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
|
|
@ -217,23 +217,23 @@ private:
|
|||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{ // selp is not an lvalue
|
||||
m_setRefLvalue = false;
|
||||
nodep->selp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->selp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
virtual void visit(AstNodePreSel* nodep) {
|
||||
bool last_setRefLvalue = m_setRefLvalue;
|
||||
{ // Only set lvalues on the from
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_setRefLvalue = false;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
nodep->thsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
iterateAndNextNull(nodep->thsp());
|
||||
}
|
||||
m_setRefLvalue = last_setRefLvalue;
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
m_ftaskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ftaskp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
|
|
@ -245,10 +245,10 @@ private:
|
|||
if (const AstVar* portp = VN_CAST(stmtp, Var)) {
|
||||
if (portp->isIO()) {
|
||||
if (portp->isInput()) {
|
||||
pinp->iterate(*this);
|
||||
iterate(pinp);
|
||||
} else { // Output or Inout
|
||||
m_setRefLvalue = true;
|
||||
pinp->iterate(*this);
|
||||
iterate(pinp);
|
||||
m_setRefLvalue = false;
|
||||
}
|
||||
// Advance pin
|
||||
|
|
@ -260,7 +260,7 @@ private:
|
|||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -268,7 +268,7 @@ public:
|
|||
LinkLValueVisitor(AstNode* nodep, bool start) {
|
||||
m_setRefLvalue = start;
|
||||
m_ftaskp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LinkLValueVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ private:
|
|||
if (!nodep->user1SetOnce()) { // Process only once.
|
||||
cleanFileline(nodep);
|
||||
m_ftaskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ftaskp = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ private:
|
|||
UINFO(5," "<<nodep<<endl);
|
||||
AstNodeModule* upperValueModp = m_valueModp;
|
||||
m_valueModp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_valueModp = upperValueModp;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,14 +110,14 @@ private:
|
|||
cleanFileline(nodep);
|
||||
AstNodeDType* upperDtypep = m_dtypep;
|
||||
m_dtypep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_dtypep = upperDtypep;
|
||||
}
|
||||
}
|
||||
virtual void visit(AstEnumItem* nodep) {
|
||||
// Expand ranges
|
||||
cleanFileline(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->rangep()) {
|
||||
if (!VN_IS(nodep->rangep()->msbp(), Const)
|
||||
|| !VN_IS(nodep->rangep()->lsbp(), Const)) nodep->v3error("Enum ranges must be integral, per spec");
|
||||
|
|
@ -166,7 +166,7 @@ private:
|
|||
nodep->trace(false);
|
||||
}
|
||||
m_varp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_varp = NULL;
|
||||
// temporaries under an always aren't expected to be blocking
|
||||
if (m_inAlways) nodep->fileline()->modifyWarnOff(V3ErrorCode::BLKSEQ, true);
|
||||
|
|
@ -202,7 +202,7 @@ private:
|
|||
|
||||
virtual void visit(AstAttrOf* nodep) {
|
||||
cleanFileline(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->attrType() == AstAttrType::DT_PUBLIC) {
|
||||
AstTypedef* typep = VN_CAST(nodep->backp(), Typedef);
|
||||
if (!typep) nodep->v3fatalSrc("Attribute not attached to typedef");
|
||||
|
|
@ -270,7 +270,7 @@ private:
|
|||
// AlwaysPublic was attached under a var, but it's a statement that should be
|
||||
// at the same level as the var
|
||||
cleanFileline(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_varp) {
|
||||
nodep->unlinkFrBack();
|
||||
m_varp->addNext(nodep);
|
||||
|
|
@ -383,7 +383,7 @@ private:
|
|||
//
|
||||
m_modp = nodep;
|
||||
m_valueModp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
m_valueModp = NULL;
|
||||
}
|
||||
|
|
@ -393,7 +393,7 @@ private:
|
|||
//
|
||||
AstNodeModule* upperValueModp = m_valueModp;
|
||||
m_valueModp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_valueModp = upperValueModp;
|
||||
}
|
||||
virtual void visit(AstInitial* nodep) {
|
||||
|
|
@ -414,7 +414,7 @@ private:
|
|||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
cleanFileline(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -428,7 +428,7 @@ public:
|
|||
m_inGenerate = false;
|
||||
m_needStart = false;
|
||||
m_valueModp = NULL;
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkParseVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ private:
|
|||
if (nodep->dead()) return;
|
||||
m_modp = nodep;
|
||||
m_senitemCvtNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstInitial* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Initial assignments under function/tasks can just be simple assignments without the initial
|
||||
if (m_ftaskp) {
|
||||
nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()); VL_DANGLING(nodep);
|
||||
|
|
@ -89,12 +89,12 @@ private:
|
|||
virtual void visit(AstVAssert* nodep) {
|
||||
if (m_assertp) nodep->v3error("Assert not allowed under another assert");
|
||||
m_assertp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_assertp = NULL;
|
||||
}
|
||||
|
||||
virtual void visit(AstVar* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_ftaskp) nodep->funcLocal(true);
|
||||
if (nodep->isSigModPublic()) {
|
||||
nodep->sigModPublic(false); // We're done with this attribute
|
||||
|
|
@ -107,21 +107,21 @@ private:
|
|||
if (nodep->varp()) {
|
||||
nodep->varp()->usedParam(true);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
// NodeTask: Remember its name for later resolution
|
||||
// Remember the existing symbol table scope
|
||||
m_ftaskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ftaskp = NULL;
|
||||
if (nodep->dpiExport()) {
|
||||
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
||||
}
|
||||
}
|
||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->taskp() && (nodep->taskp()->dpiContext() || nodep->taskp()->dpiExport())) {
|
||||
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ private:
|
|||
|
||||
virtual void visit(AstSenItem* nodep) {
|
||||
// Remove bit selects, and bark if it's not a simple variable
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isClocked()) {
|
||||
// If it's not a simple variable wrap in a temporary
|
||||
// This is a bit unfortunate as we haven't done width resolution
|
||||
|
|
@ -197,7 +197,7 @@ private:
|
|||
|
||||
virtual void visit(AstNodePreSel* nodep) {
|
||||
if (!nodep->attrp()) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Constification may change the fromp() to a constant, which will lose the
|
||||
// variable we're extracting from (to determine MSB/LSB/endianness/etc.)
|
||||
// So we replicate it in another node
|
||||
|
|
@ -225,7 +225,7 @@ private:
|
|||
virtual void visit(AstCaseItem* nodep) {
|
||||
// Move default caseItems to the bottom of the list
|
||||
// That saves us from having to search each case list twice, for non-defaults and defaults
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->user2() && nodep->isDefault() && nodep->nextp()) {
|
||||
nodep->user2(true);
|
||||
AstNode* nextp = nodep->nextp();
|
||||
|
|
@ -252,7 +252,7 @@ private:
|
|||
}
|
||||
}
|
||||
else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -356,27 +356,27 @@ private:
|
|||
}
|
||||
|
||||
virtual void visit(AstFOpen* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
|
||||
}
|
||||
virtual void visit(AstFClose* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
|
||||
}
|
||||
virtual void visit(AstFEof* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef));
|
||||
}
|
||||
virtual void visit(AstFScanF* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
|
||||
}
|
||||
virtual void visit(AstSScanF* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
|
||||
}
|
||||
virtual void visit(AstSFormatF* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Cleanup old-school displays without format arguments
|
||||
if (!nodep->hasFormat()) {
|
||||
if (nodep->text()!="") nodep->v3fatalSrc("Non-format $sformatf should have \"\" format");
|
||||
|
|
@ -397,7 +397,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstDisplay* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstUdpTable* nodep) {
|
||||
|
|
@ -430,22 +430,22 @@ private:
|
|||
virtual void visit(AstScCtor* nodep) {
|
||||
// Constructor info means the module must remain public
|
||||
m_modp->modPublic(true);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScDtor* nodep) {
|
||||
// Destructor info means the module must remain public
|
||||
m_modp->modPublic(true);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScInt* nodep) {
|
||||
// Special class info means the module must remain public
|
||||
m_modp->modPublic(true);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -456,7 +456,7 @@ public:
|
|||
m_assertp = NULL;
|
||||
m_senitemCvtNum = 0;
|
||||
//
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkResolveVisitor() {}
|
||||
};
|
||||
|
|
@ -481,11 +481,11 @@ private:
|
|||
// VISITs
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Iterate modules backwards, in bottom-up order.
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCell* nodep) {
|
||||
|
|
@ -498,14 +498,14 @@ private:
|
|||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit LinkBotupVisitor(AstNetlist* rootp) {
|
||||
m_modp = NULL;
|
||||
//
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~LinkBotupVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit LocalizeDehierVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LocalizeDehierVisitor() {}
|
||||
};
|
||||
|
|
@ -157,7 +157,7 @@ private:
|
|||
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
moveVars();
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
|
|
@ -167,7 +167,7 @@ private:
|
|||
searchFuncStmts(nodep->initsp());
|
||||
searchFuncStmts(nodep->stmtsp());
|
||||
searchFuncStmts(nodep->finalsp());
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_cfuncp = NULL;
|
||||
}
|
||||
void searchFuncStmts(AstNode* nodep) {
|
||||
|
|
@ -230,13 +230,13 @@ private:
|
|||
// No iterate; Don't want varrefs under it
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit LocalizeVisitor(AstNetlist* nodep) {
|
||||
m_cfuncp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~LocalizeVisitor() {
|
||||
V3Stats::addStat("Optimizations, Vars localized", m_statLocVars);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
// Add __PVT__ to names of local signals
|
||||
|
|
@ -91,54 +91,54 @@ private:
|
|||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
if (!nodep->user1()) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
rename(nodep, false);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
if (nodep->varp()) {
|
||||
nodep->varp()->iterate(*this);
|
||||
iterate(nodep->varp());
|
||||
nodep->name(nodep->varp()->name());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCell* nodep) {
|
||||
if (!nodep->user1()) {
|
||||
rename(nodep, !nodep->modp()->modPublic());
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstMemberDType* nodep) {
|
||||
if (!nodep->user1()) {
|
||||
rename(nodep, false);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstMemberSel* nodep) {
|
||||
if (!nodep->user1()) {
|
||||
rename(nodep, false);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
if (!nodep->user1SetOnce()) {
|
||||
if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this);
|
||||
if (nodep->aboveCellp()) nodep->aboveCellp()->iterate(*this);
|
||||
if (nodep->aboveScopep()) iterate(nodep->aboveScopep());
|
||||
if (nodep->aboveCellp()) iterate(nodep->aboveCellp());
|
||||
// Always recompute name (as many level above scope may have changed)
|
||||
// Same formula as V3Scope
|
||||
nodep->name(nodep->isTop() ? "TOP"
|
||||
: (nodep->aboveScopep()->name()+"."+nodep->aboveCellp()->name()));
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit NameVisitor(AstNetlist* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~NameVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ private:
|
|||
} else {
|
||||
m_inAss = true;
|
||||
m_childClkWidth = 0;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
m_rightClkWidth = m_childClkWidth;
|
||||
m_inAss = false;
|
||||
}
|
||||
|
|
@ -320,29 +320,29 @@ private:
|
|||
}
|
||||
virtual void visit(AstConcat* nodep) {
|
||||
if (m_inAss) {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
int lw = m_childClkWidth;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
int rw = m_childClkWidth;
|
||||
m_childClkWidth = lw + rw; // Pass up
|
||||
}
|
||||
}
|
||||
virtual void visit(AstNodeSel* nodep) {
|
||||
if (m_inAss) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Pass up result width
|
||||
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
|
||||
}
|
||||
}
|
||||
virtual void visit(AstSel* nodep) {
|
||||
if (m_inAss) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
|
||||
}
|
||||
}
|
||||
virtual void visit(AstReplicate* nodep) {
|
||||
if (m_inAss) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (VN_IS(nodep->rhsp(), Const)) {
|
||||
m_childClkWidth = m_childClkWidth * VN_CAST(nodep->rhsp(), Const)->toUInt();
|
||||
} else {
|
||||
|
|
@ -352,11 +352,11 @@ private:
|
|||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
m_inClocked = nodep->hasClocked();
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inClocked = false;
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -369,7 +369,7 @@ public:
|
|||
m_rightClkWidth = 0;
|
||||
do {
|
||||
m_newClkMarked = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
} while (m_newClkMarked);
|
||||
}
|
||||
virtual ~OrderClkMarkVisitor() {}
|
||||
|
|
@ -394,7 +394,7 @@ private:
|
|||
m_clkAss = true;
|
||||
UINFO(6, "node was marked as clocker "<<varrefp<<endl);
|
||||
}
|
||||
nodep->rhsp()->iterateChildren(*this);
|
||||
iterateChildren(nodep->rhsp());
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
if (nodep->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
||||
|
|
@ -403,14 +403,14 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit OrderClkAssVisitor(AstNode* nodep) {
|
||||
m_clkAss = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~OrderClkAssVisitor() {}
|
||||
|
||||
|
|
@ -502,7 +502,7 @@ private:
|
|||
new OrderEdge(&m_graph, m_activeSenVxp, m_logicVxp, WEIGHT_NORMAL);
|
||||
}
|
||||
nodep->user1p(m_modp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_logicVxp = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -695,7 +695,7 @@ private:
|
|||
virtual void visit(AstNetlist* nodep) {
|
||||
{
|
||||
AstUser4InUse m_inuser4; // Used only when building tree, so below
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
// We're finished, complete the topscopes
|
||||
if (m_topScopep) { process(); m_topScopep=NULL; }
|
||||
|
|
@ -732,7 +732,7 @@ private:
|
|||
m_activeSenVxp = NULL;
|
||||
m_inputsVxp = new OrderInputsVertex(&m_graph, NULL);
|
||||
//
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Done topscope, erase extra user information
|
||||
// user1p passed to next process() operation
|
||||
AstNode::user3ClearTree();
|
||||
|
|
@ -740,7 +740,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
|
|
@ -750,7 +750,7 @@ private:
|
|||
m_activeSenVxp = NULL;
|
||||
nodep->user1p(m_modp);
|
||||
// Iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstActive* nodep) {
|
||||
|
|
@ -761,9 +761,9 @@ private:
|
|||
m_inClocked = nodep->hasClocked();
|
||||
// Grab the sensitivity list
|
||||
if (nodep->sensesStorep()) nodep->v3fatalSrc("Senses should have been activeTop'ed to be global!");
|
||||
nodep->sensesp()->accept(*this);
|
||||
iterate(nodep->sensesp());
|
||||
// Collect statements under it
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_activep = NULL;
|
||||
}
|
||||
virtual void visit(AstVarScope* nodep) {
|
||||
|
|
@ -906,7 +906,7 @@ private:
|
|||
if (!m_activeSenVxp) {
|
||||
m_activeSenVxp = new OrderLogicVertex(&m_graph, m_scopep, nodep, m_activep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_inSenTree = false;
|
||||
}
|
||||
|
|
@ -964,7 +964,7 @@ private:
|
|||
//--------------------
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -1004,7 +1004,7 @@ public:
|
|||
m_graph.debug(V3Error::debugDefault());
|
||||
}
|
||||
void main(AstNode* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ private:
|
|||
if (!nodep->user5SetOnce()) { // Process once; note clone() must clear so we do it again
|
||||
m_modp = nodep;
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Note above iterate may add to m_todoModps
|
||||
//
|
||||
// Process interface cells, then non-interface which may ref an interface cell
|
||||
|
|
@ -244,7 +244,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
// Modules must be done in top-down-order
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
if (nodep->dead()) {
|
||||
|
|
@ -271,7 +271,7 @@ private:
|
|||
// Make sure all parameters are constantified
|
||||
virtual void visit(AstVar* nodep) {
|
||||
if (!nodep->user5SetOnce()) { // Process once
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->isParam()) {
|
||||
if (!nodep->valuep()) { nodep->v3fatalSrc("Parameter without initial value"); }
|
||||
V3Const::constifyParamsEdit(nodep); // The variable, not just the var->init()
|
||||
|
|
@ -288,7 +288,7 @@ private:
|
|||
}
|
||||
// Make sure varrefs cause vars to constify before things above
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
if (nodep->varp()) nodep->varp()->iterate(*this);
|
||||
if (nodep->varp()) iterate(nodep->varp());
|
||||
}
|
||||
bool ifaceParamReplace(AstVarXRef* nodep, AstNode* candp) {
|
||||
for (; candp; candp = candp->nextp()) {
|
||||
|
|
@ -357,7 +357,7 @@ private:
|
|||
nodep->v3fatalSrc("Unexpected AstUnlinkedRef node");
|
||||
return;
|
||||
}
|
||||
nodep->cellrefp()->iterate(*this);
|
||||
iterate(nodep->cellrefp());
|
||||
|
||||
if (varxrefp) {
|
||||
varxrefp->dotted(m_unlinkedTxt);
|
||||
|
|
@ -387,7 +387,7 @@ private:
|
|||
// Generate Statements
|
||||
virtual void visit(AstGenerate* nodep) {
|
||||
if (debug()>=9) nodep->dumpTree(cout,"-genin: ");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// After expanding the generate, all statements under it can be moved
|
||||
// up, and the generate block deleted as it's not relevant
|
||||
if (AstNode* stmtsp = nodep->stmtsp()) {
|
||||
|
|
@ -401,7 +401,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstGenIf* nodep) {
|
||||
UINFO(9," GENIF "<<nodep<<endl);
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
// We suppress errors when widthing params since short-circuiting in
|
||||
// the conditional evaluation may mean these error can never occur. We
|
||||
// then make sure that short-circuiting is used by constifyParamsEdit.
|
||||
|
|
@ -454,7 +454,7 @@ private:
|
|||
// Note this clears nodep->genforp(), so begin is no longer special
|
||||
}
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstGenFor* nodep) {
|
||||
|
|
@ -463,7 +463,7 @@ private:
|
|||
virtual void visit(AstGenCase* nodep) {
|
||||
UINFO(9," GENCASE "<<nodep<<endl);
|
||||
AstNode* keepp = NULL;
|
||||
nodep->exprp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->exprp());
|
||||
V3Case::caseLint(nodep);
|
||||
V3Width::widthParamsEdit(nodep); // Param typed widthing will NOT recurse the body,
|
||||
// don't trigger errors yet.
|
||||
|
|
@ -473,7 +473,7 @@ private:
|
|||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=VN_CAST(itemp->nextp(), CaseItem)) {
|
||||
for (AstNode* ep = itemp->condsp(); ep; ) {
|
||||
AstNode* nextp = ep->nextp(); //May edit list
|
||||
ep->iterateAndNext(*this);
|
||||
iterateAndNextNull(ep);
|
||||
V3Const::constifyParamsEdit(ep); VL_DANGLING(ep); // ep may change
|
||||
ep = nextp;
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ private:
|
|||
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -520,7 +520,7 @@ public:
|
|||
m_longId = 0;
|
||||
m_modp = NULL;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ParamVisitor() {}
|
||||
};
|
||||
|
|
@ -530,7 +530,7 @@ public:
|
|||
|
||||
void ParamVisitor::visitCell(AstCell* nodep) {
|
||||
// Cell: Check for parameters in the instantiation.
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->modp()) nodep->v3fatalSrc("Not linked?");
|
||||
// We always run this, even if no parameters, as need to look for interfaces,
|
||||
// and remove any recursive references
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ private:
|
|||
virtual void visit(AstNodeAssign* nodep) {
|
||||
//AstNode::user4ClearTree(); // Implied by AstUser4InUse
|
||||
// LHS first as fewer varrefs
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
// Now find vars marked as lhs
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
// it's LHS var is used so need a deep temporary
|
||||
|
|
@ -80,7 +80,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
explicit PremitAssignVisitor(AstNodeAssign* nodep) {
|
||||
UINFO(4," PremitAssignVisitor on "<<nodep<<endl);
|
||||
m_noopt = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~PremitAssignVisitor() {}
|
||||
bool noOpt() const { return m_noopt; }
|
||||
|
|
@ -209,12 +209,12 @@ private:
|
|||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_funcp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
m_funcp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_funcp = NULL;
|
||||
}
|
||||
void startStatement(AstNode* nodep) {
|
||||
|
|
@ -224,14 +224,14 @@ private:
|
|||
virtual void visit(AstWhile* nodep) {
|
||||
UINFO(4," WHILE "<<nodep<<endl);
|
||||
startStatement(nodep);
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
startStatement(nodep);
|
||||
m_inWhilep = nodep;
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
m_inWhilep = NULL;
|
||||
startStatement(nodep);
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
m_stmtp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeAssign* nodep) {
|
||||
|
|
@ -244,22 +244,22 @@ private:
|
|||
createDeepTemp(nodep->rhsp(), false);
|
||||
}
|
||||
}
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
m_assignLhs = true;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_assignLhs = false;
|
||||
m_stmtp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeStmt* nodep) {
|
||||
UINFO(4," STMT "<<nodep<<endl);
|
||||
startStatement(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_stmtp = NULL;
|
||||
}
|
||||
virtual void visit(AstTraceInc* nodep) {
|
||||
startStatement(nodep);
|
||||
m_inTracep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inTracep = NULL;
|
||||
m_stmtp = NULL;
|
||||
}
|
||||
|
|
@ -308,7 +308,7 @@ private:
|
|||
replaceHandle.relink(newp);
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this); checkNode(nodep);
|
||||
iterateChildren(nodep); checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstShiftL* nodep) {
|
||||
visitShift(nodep);
|
||||
|
|
@ -321,43 +321,43 @@ private:
|
|||
}
|
||||
// Operators
|
||||
virtual void visit(AstNodeTermop* nodep) {
|
||||
nodep->iterateChildren(*this); checkNode(nodep);
|
||||
iterateChildren(nodep); checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeUniop* nodep) {
|
||||
nodep->iterateChildren(*this); checkNode(nodep);
|
||||
iterateChildren(nodep); checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeBiop* nodep) {
|
||||
nodep->iterateChildren(*this); checkNode(nodep);
|
||||
iterateChildren(nodep); checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstUCFunc* nodep) {
|
||||
nodep->iterateChildren(*this); checkNode(nodep);
|
||||
iterateChildren(nodep); checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstSel* nodep) {
|
||||
nodep->fromp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fromp());
|
||||
{ // Only the 'from' is part of the assignment LHS
|
||||
bool prevAssign = m_assignLhs;
|
||||
m_assignLhs = false;
|
||||
nodep->lsbp()->iterateAndNext(*this);
|
||||
nodep->widthp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lsbp());
|
||||
iterateAndNextNull(nodep->widthp());
|
||||
m_assignLhs = prevAssign;
|
||||
}
|
||||
checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstArraySel* nodep) {
|
||||
nodep->fromp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->fromp());
|
||||
{ // Only the 'from' is part of the assignment LHS
|
||||
bool prevAssign = m_assignLhs;
|
||||
m_assignLhs = false;
|
||||
nodep->bitp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bitp());
|
||||
m_assignLhs = prevAssign;
|
||||
}
|
||||
checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstConst* nodep) {
|
||||
nodep->iterateChildren(*this); checkNode(nodep);
|
||||
iterateChildren(nodep); checkNode(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeCond* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->expr1p()->isWide()
|
||||
&& !VN_IS(nodep->condp(), Const)
|
||||
&& !VN_IS(nodep->condp(), VarRef)) {
|
||||
|
|
@ -371,7 +371,7 @@ private:
|
|||
// Autoflush
|
||||
virtual void visit(AstDisplay* nodep) {
|
||||
startStatement(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_stmtp = NULL;
|
||||
if (v3Global.opt.autoflush()) {
|
||||
AstNode* searchp = nodep->nextp();
|
||||
|
|
@ -388,7 +388,7 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstSFormatF* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Any strings sent to a display must be var of string data type,
|
||||
// to avoid passing a pointer to a temporary.
|
||||
for (AstNode* expp=nodep->exprsp(); expp; expp = expp->nextp()) {
|
||||
|
|
@ -403,7 +403,7 @@ private:
|
|||
// Default: Just iterate
|
||||
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -414,7 +414,7 @@ public:
|
|||
m_stmtp = NULL;
|
||||
m_inWhilep = NULL;
|
||||
m_inTracep = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~PremitVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ private:
|
|||
// Operate starting at the top of the hierarchy
|
||||
m_aboveCellp = NULL;
|
||||
m_aboveScopep = NULL;
|
||||
modp->accept(*this);
|
||||
iterate(modp);
|
||||
cleanupVarRefs();
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
|
|
@ -126,7 +126,7 @@ private:
|
|||
m_aboveScopep = m_scopep;
|
||||
AstNodeModule* modp = cellp->modp();
|
||||
if (!modp) cellp->v3fatalSrc("Unlinked mod");
|
||||
modp->accept(*this); // Recursive call to visit(AstNodeModule)
|
||||
iterate(modp); // Recursive call to visit(AstNodeModule)
|
||||
}
|
||||
// Done, restore vars
|
||||
m_scopep = oldScopep;
|
||||
|
|
@ -148,7 +148,7 @@ private:
|
|||
|
||||
// Copy blocks into this scope
|
||||
// If this is the first usage of the block ever, we can simply move the reference
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
|
||||
// ***Note m_scopep is passed back to the caller of the routine (above)
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ private:
|
|||
AstInitial* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstFinal* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -169,7 +169,7 @@ private:
|
|||
AstFinal* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstAssignAlias* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -177,7 +177,7 @@ private:
|
|||
AstNode* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstAssignVarScope* nodep) {
|
||||
// Copy under the scope but don't recurse
|
||||
|
|
@ -185,7 +185,7 @@ private:
|
|||
AstNode* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstAssignW* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -193,7 +193,7 @@ private:
|
|||
AstNode* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstAlways* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -201,7 +201,7 @@ private:
|
|||
AstNode* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstAlwaysPublic* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -209,7 +209,7 @@ private:
|
|||
AstNode* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstCoverToggle* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -217,7 +217,7 @@ private:
|
|||
AstNode* clonep = nodep->cloneTree(false);
|
||||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||
iterateChildren(clonep); // We iterate under the *clone*
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -227,7 +227,7 @@ private:
|
|||
m_scopep->addActivep(clonep);
|
||||
clonep->scopep(m_scopep);
|
||||
// We iterate under the *clone*
|
||||
clonep->iterateChildren(*this);
|
||||
iterateChildren(clonep);
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) {
|
||||
// Add to list of blocks under this scope
|
||||
|
|
@ -236,7 +236,7 @@ private:
|
|||
nodep->user2p(clonep);
|
||||
m_scopep->addActivep(clonep);
|
||||
// We iterate under the *clone*
|
||||
clonep->iterateChildren(*this);
|
||||
iterateChildren(clonep);
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
// Make new scope variable
|
||||
|
|
@ -284,7 +284,7 @@ private:
|
|||
if (afterp) afterp->unlinkFrBackWithNext();
|
||||
nodep->scopeEntrp(new AstText(nodep->fileline(), prefix));
|
||||
if (afterp) nodep->scopeEntrp(afterp);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
// Scope that was made by this module for different cell;
|
||||
|
|
@ -293,7 +293,7 @@ private:
|
|||
//--------------------
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -303,7 +303,7 @@ public:
|
|||
m_modp = NULL;
|
||||
m_scopep = NULL;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ScopeVisitor() {}
|
||||
};
|
||||
|
|
@ -327,14 +327,14 @@ private:
|
|||
virtual void visit(AstScope* nodep) {
|
||||
// Want to ignore blocks under it
|
||||
m_scopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
|
||||
virtual void movedDeleteOrIterate(AstNode* nodep) {
|
||||
if (m_scopep) {
|
||||
// The new block; repair varrefs
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
// A block that was just moved under a scope, Kill it.
|
||||
// Certain nodes can be referenced later in this pass, notably
|
||||
|
|
@ -392,24 +392,24 @@ private:
|
|||
nodep->taskp(NULL);
|
||||
UINFO(9," New pkg-taskref "<<nodep<<endl);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstModportFTaskRef* nodep) {
|
||||
// The crossrefs are dealt with in V3LinkDot
|
||||
nodep->ftaskp(NULL);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// Default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit ScopeCleanupVisitor(AstNetlist* nodep) {
|
||||
m_scopep = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~ScopeCleanupVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
// Only do the top
|
||||
if (nodep->isTop()) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
m_topscopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Don't clear topscopep, the namer persists beyond this visit
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
|
|
@ -79,7 +79,7 @@ private:
|
|||
// Memorize existing block names
|
||||
virtual void visit(AstActive* nodep) {
|
||||
// Don't grab SenTrees under Actives, only those that are global (under Scope directly)
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSenTree* nodep) {
|
||||
m_treesp.push_back(nodep);
|
||||
|
|
@ -87,7 +87,7 @@ private:
|
|||
// Empty visitors, speed things up
|
||||
virtual void visit(AstNodeStmt* nodep) { }
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
// METHODS
|
||||
public:
|
||||
|
|
@ -129,7 +129,7 @@ public:
|
|||
}
|
||||
virtual ~SenTreeFinder() {}
|
||||
void main(AstTopScope* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
103
src/V3Simulate.h
103
src/V3Simulate.h
|
|
@ -327,7 +327,7 @@ private:
|
|||
virtual void visit(AstAlways* nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSenTree* nodep) {
|
||||
// Sensitivities aren't inputs per se; we'll keep our tree under the same sens.
|
||||
|
|
@ -335,7 +335,8 @@ private:
|
|||
virtual void visit(AstVarRef* nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
if (!optimizable()) return; // Accelerate
|
||||
nodep->varp()->iterateChildren(*this);
|
||||
if (!nodep->varp()) nodep->v3fatalSrc("Unlinked");
|
||||
iterateChildren(nodep->varp());
|
||||
AstNode* vscp = varOrScope(nodep);
|
||||
|
||||
// We can't have non-delayed assignments with same value on LHS and RHS
|
||||
|
|
@ -401,21 +402,21 @@ private:
|
|||
if (!m_params) { badNodeType(nodep); return; }
|
||||
if (nodep->dpiImport()) { clearOptimizable(nodep,"DPI import functions aren't simulatable"); }
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
UINFO(5," IF "<<nodep<<endl);
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
if (optimizable()) {
|
||||
if (fetchNumber(nodep->condp())->isNeqZero()) {
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
} else {
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -432,7 +433,7 @@ private:
|
|||
if (!m_checkOnly && optimizable()) {
|
||||
AstNode* valuep = nodep->itemp()->valuep();
|
||||
if (valuep) {
|
||||
valuep->iterateAndNext(*this);
|
||||
iterateAndNextNull(valuep);
|
||||
if (optimizable()) {
|
||||
newNumber(nodep)->opAssign(*fetchNumber(valuep));
|
||||
}
|
||||
|
|
@ -444,7 +445,7 @@ private:
|
|||
virtual void visit(AstNodeUniop* nodep) {
|
||||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!m_checkOnly && optimizable()) {
|
||||
nodep->numberOperate(*newNumber(nodep), *fetchNumber(nodep->lhsp()));
|
||||
}
|
||||
|
|
@ -452,7 +453,7 @@ private:
|
|||
virtual void visit(AstNodeBiop* nodep) {
|
||||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!m_checkOnly && optimizable()) {
|
||||
nodep->numberOperate(*newNumber(nodep), *fetchNumber(nodep->lhsp()), *fetchNumber(nodep->rhsp()));
|
||||
}
|
||||
|
|
@ -460,7 +461,7 @@ private:
|
|||
virtual void visit(AstNodeTriop* nodep) {
|
||||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!m_checkOnly && optimizable()) {
|
||||
nodep->numberOperate(*newNumber(nodep),
|
||||
*fetchNumber(nodep->lhsp()),
|
||||
|
|
@ -473,12 +474,12 @@ private:
|
|||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->lhsp()->accept(*this);
|
||||
iterate(nodep->lhsp());
|
||||
if (optimizable()) {
|
||||
if (fetchNumber(nodep->lhsp())->isNeqZero()) {
|
||||
nodep->rhsp()->accept(*this);
|
||||
iterate(nodep->rhsp());
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->rhsp()));
|
||||
} else {
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->lhsp())); // a zero
|
||||
|
|
@ -491,14 +492,14 @@ private:
|
|||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->lhsp()->accept(*this);
|
||||
iterate(nodep->lhsp());
|
||||
if (optimizable()) {
|
||||
if (fetchNumber(nodep->lhsp())->isNeqZero()) {
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->lhsp())); // a one
|
||||
} else {
|
||||
nodep->rhsp()->accept(*this);
|
||||
iterate(nodep->rhsp());
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->rhsp()));
|
||||
}
|
||||
}
|
||||
|
|
@ -509,14 +510,14 @@ private:
|
|||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->lhsp()->accept(*this);
|
||||
iterate(nodep->lhsp());
|
||||
if (optimizable()) {
|
||||
if (fetchNumber(nodep->lhsp())->isEqZero()) {
|
||||
newNumber(nodep)->opAssign(V3Number(nodep->fileline(), 1, 1)); // a one
|
||||
} else {
|
||||
nodep->rhsp()->accept(*this);
|
||||
iterate(nodep->rhsp());
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->rhsp()));
|
||||
}
|
||||
}
|
||||
|
|
@ -528,15 +529,15 @@ private:
|
|||
if (!optimizable()) return; // Accelerate
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->condp()->accept(*this);
|
||||
iterate(nodep->condp());
|
||||
if (optimizable()) {
|
||||
if (fetchNumber(nodep->condp())->isNeqZero()) {
|
||||
nodep->expr1p()->accept(*this);
|
||||
iterate(nodep->expr1p());
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->expr1p()));
|
||||
} else {
|
||||
nodep->expr2p()->accept(*this);
|
||||
iterate(nodep->expr2p());
|
||||
newNumber(nodep)->opAssign(*fetchNumber(nodep->expr2p()));
|
||||
}
|
||||
}
|
||||
|
|
@ -546,7 +547,7 @@ private:
|
|||
void handleAssignSel(AstNodeAssign* nodep, AstSel* selp) {
|
||||
AstVarRef* varrefp = NULL;
|
||||
V3Number lsb = V3Number(nodep->fileline());
|
||||
nodep->rhsp()->iterateAndNext(*this); // Value to assign
|
||||
iterateAndNextNull(nodep->rhsp()); // Value to assign
|
||||
handleAssignSelRecurse(nodep, selp, varrefp/*ref*/, lsb/*ref*/, 0);
|
||||
if (!m_checkOnly && optimizable()) {
|
||||
if (!varrefp) nodep->v3fatalSrc("Indicated optimizable, but no variable found on RHS of select");
|
||||
|
|
@ -575,7 +576,7 @@ private:
|
|||
int depth) {
|
||||
// Recurse down to find final variable being set (outVarrefp), with value to write on nodep->rhsp()
|
||||
checkNodeInfo(selp);
|
||||
selp->lsbp()->iterateAndNext(*this); // Bit index
|
||||
iterateAndNextNull(selp->lsbp()); // Bit index
|
||||
if (AstVarRef* varrefp = VN_CAST(selp->fromp(), VarRef)) {
|
||||
outVarrefpRef = varrefp;
|
||||
lsbRef = *fetchNumber(selp->lsbp());
|
||||
|
|
@ -612,10 +613,10 @@ private:
|
|||
clearOptimizable(nodep, "LHS isn't simple variable");
|
||||
}
|
||||
else if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
else if (optimizable()) {
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
if (optimizable()) {
|
||||
AstNode* vscp = varOrScope(VN_CAST(nodep->lhsp(), VarRef));
|
||||
assignOutNumber(nodep, vscp, fetchNumber(nodep->rhsp()));
|
||||
|
|
@ -625,27 +626,27 @@ private:
|
|||
}
|
||||
virtual void visit(AstBegin* nodep) {
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeCase* nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
UINFO(5," CASE "<<nodep<<endl);
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else if (optimizable()) {
|
||||
nodep->exprp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->exprp());
|
||||
bool hit = false;
|
||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=VN_CAST(itemp->nextp(), CaseItem)) {
|
||||
if (!itemp->isDefault()) {
|
||||
for (AstNode* ep = itemp->condsp(); ep; ep=ep->nextp()) {
|
||||
if (hit) break;
|
||||
ep->iterateAndNext(*this);
|
||||
iterateAndNextNull(ep);
|
||||
if (optimizable()) {
|
||||
V3Number match (nodep->fileline(), 1);
|
||||
match.opEq(*fetchNumber(nodep->exprp()), *fetchNumber(ep));
|
||||
if (match.isNeqZero()) {
|
||||
itemp->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(itemp->bodysp());
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -656,7 +657,7 @@ private:
|
|||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=VN_CAST(itemp->nextp(), CaseItem)) {
|
||||
if (hit) break;
|
||||
if (!hit && itemp->isDefault()) {
|
||||
itemp->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(itemp->bodysp());
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -667,7 +668,7 @@ private:
|
|||
// Real handling is in AstNodeCase
|
||||
if (jumpingOver(nodep)) return;
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstComment*) {}
|
||||
|
|
@ -683,7 +684,7 @@ private:
|
|||
virtual void visit(AstJumpLabel* nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
checkNodeInfo(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_jumpp && m_jumpp->labelp() == nodep) {
|
||||
UINFO(5," JUMP DONE "<<nodep<<endl);
|
||||
m_jumpp = NULL;
|
||||
|
|
@ -704,19 +705,19 @@ private:
|
|||
if (!m_params) { badNodeType(nodep); return; }
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else if (optimizable()) {
|
||||
int loops = 0;
|
||||
nodep->initsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->initsp());
|
||||
while (1) {
|
||||
UINFO(5," FOR-ITER "<<nodep<<endl);
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
if (!optimizable()) break;
|
||||
if (!fetchNumber(nodep->condp())->isNeqZero()) {
|
||||
break;
|
||||
}
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
if (loops++ > unrollCount()*16) {
|
||||
clearOptimizable(nodep, "Loop unrolling took too long; probably this is an"
|
||||
"infinite loop, or set --unroll-count above "
|
||||
|
|
@ -734,22 +735,22 @@ private:
|
|||
if (!m_params) { badNodeType(nodep); return; }
|
||||
checkNodeInfo(nodep);
|
||||
if (m_checkOnly) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else if (optimizable()) {
|
||||
int loops = 0;
|
||||
while (1) {
|
||||
UINFO(5," WHILE-ITER "<<nodep<<endl);
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
if (jumpingOver(nodep)) break;
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
if (jumpingOver(nodep)) break;
|
||||
if (!optimizable()) break;
|
||||
if (!fetchNumber(nodep->condp())->isNeqZero()) {
|
||||
break;
|
||||
}
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
if (jumpingOver(nodep)) break;
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
if (jumpingOver(nodep)) break;
|
||||
|
||||
// Prep for next loop
|
||||
|
|
@ -783,7 +784,7 @@ private:
|
|||
return;
|
||||
}
|
||||
// Evaluate pin value
|
||||
pinp->accept(*this);
|
||||
iterate(pinp);
|
||||
}
|
||||
}
|
||||
for (V3TaskConnects::iterator it=tconnects.begin(); it!=tconnects.end(); ++it) {
|
||||
|
|
@ -799,7 +800,7 @@ private:
|
|||
SimulateStackNode stackNode(nodep, &tconnects);
|
||||
m_callStack.push_front(&stackNode);
|
||||
// Evaluate the function
|
||||
funcp->accept(*this);
|
||||
iterate(funcp);
|
||||
m_callStack.pop_front();
|
||||
if (!m_checkOnly && optimizable()) {
|
||||
// Grab return value from output variable (if it's a function)
|
||||
|
|
@ -822,7 +823,7 @@ private:
|
|||
virtual void visit(AstSFormatF *nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
if (!optimizable()) return; // Accelerate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_params) {
|
||||
AstNode* nextArgp = nodep->exprsp();
|
||||
|
||||
|
|
@ -875,7 +876,7 @@ private:
|
|||
virtual void visit(AstDisplay *nodep) {
|
||||
if (jumpingOver(nodep)) return;
|
||||
if (!optimizable()) return; // Accelerate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_params) {
|
||||
V3Number* textp = fetchNumber(nodep->fmtp());
|
||||
switch (nodep->displayType()) {
|
||||
|
|
@ -916,7 +917,7 @@ private:
|
|||
m_params = params;
|
||||
}
|
||||
void mainGuts(AstNode* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
if (m_jumpp) {
|
||||
m_jumpp->v3fatalSrc("JumpGo branched to label that wasn't found");
|
||||
m_jumpp = NULL;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class SliceVisitor : public AstNVisitor {
|
|||
return;
|
||||
}
|
||||
m_assignp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_assignp = NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ class SliceVisitor : public AstNVisitor {
|
|||
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||
nodep = logp;
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstEq* nodep) {
|
||||
|
|
@ -226,7 +226,7 @@ class SliceVisitor : public AstNVisitor {
|
|||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
// Default: Just iterate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -234,7 +234,7 @@ public:
|
|||
explicit SliceVisitor(AstNetlist* rootp) {
|
||||
m_assignp = NULL;
|
||||
m_assignError = false;
|
||||
rootp->accept(*this);
|
||||
iterate(rootp);
|
||||
}
|
||||
virtual ~SliceVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ protected:
|
|||
// Iterate across current block, making the scoreboard
|
||||
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
||||
scoreboardPushStmt(nextp);
|
||||
nextp->accept(*this);
|
||||
iterate(nextp);
|
||||
scoreboardPopStmt();
|
||||
}
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ protected:
|
|||
virtual void visit(AstAssignDly* nodep) {
|
||||
m_inDly = true;
|
||||
UINFO(4," ASSIGNDLY "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inDly = false;
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
|
|
@ -434,7 +434,7 @@ protected:
|
|||
// in always, so the performance gain probably isn't worth the work.
|
||||
UINFO(9," NoReordering "<<nodep<<endl);
|
||||
m_noReorderWhy = "JumpGo";
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
|
@ -445,7 +445,7 @@ protected:
|
|||
UINFO(9," NotSplittable "<<nodep<<endl);
|
||||
scoreboardPli(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -457,7 +457,7 @@ class ReorderVisitor : public SplitReorderBaseVisitor {
|
|||
public:
|
||||
explicit ReorderVisitor(AstNetlist* nodep)
|
||||
: SplitReorderBaseVisitor() {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
|
||||
virtual ~ReorderVisitor() {}
|
||||
|
|
@ -585,7 +585,7 @@ protected:
|
|||
// Process it
|
||||
if (!nodep->nextp()) {
|
||||
// Just one, so can't reorder. Just look for more blocks/statements.
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
} else {
|
||||
UINFO(9," processBlock "<<nodep<<endl);
|
||||
// Process block and followers
|
||||
|
|
@ -618,7 +618,7 @@ protected:
|
|||
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
UINFO(4," IF "<<nodep<<endl);
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
processBlock(nodep->ifsp());
|
||||
processBlock(nodep->elsesp());
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ public:
|
|||
// Visit through *nodep and map each AstNodeIf within to the set of
|
||||
// colors it will participate in. Also find the whole set of colors.
|
||||
explicit IfColorVisitor(AstAlways* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~IfColorVisitor() {}
|
||||
|
||||
|
|
@ -660,7 +660,7 @@ public:
|
|||
protected:
|
||||
virtual void visit(AstNodeIf* nodep) {
|
||||
m_ifStack.push_back(nodep);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_ifStack.pop_back();
|
||||
}
|
||||
|
||||
|
|
@ -677,7 +677,7 @@ protected:
|
|||
m_ifColors[*it].insert(color);
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
static int debug() {
|
||||
|
|
@ -737,7 +737,7 @@ public:
|
|||
// Scan the body of the always. We'll handle if/else
|
||||
// specially, everything else is a leaf node that we can
|
||||
// just clone into one of the split always blocks.
|
||||
m_origAlwaysp->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(m_origAlwaysp->bodysp());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
@ -803,14 +803,14 @@ protected:
|
|||
m_addAfter[*color] = if_placeholderp;
|
||||
}
|
||||
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
|
||||
for (ColorSet::const_iterator color = colors.begin();
|
||||
color != colors.end(); ++color) {
|
||||
m_addAfter[*color] = clones[*color]->elsesp();
|
||||
}
|
||||
|
||||
nodep->elsesp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
|
||||
for (ColorSet::const_iterator color = colors.begin();
|
||||
color != colors.end(); ++color) {
|
||||
|
|
@ -827,7 +827,7 @@ class RemovePlaceholdersVisitor : public AstNVisitor {
|
|||
NodeSet m_removeSet; // placeholders to be removed
|
||||
public:
|
||||
explicit RemovePlaceholdersVisitor(AstNode* nodep) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
for (NodeSet::const_iterator it = m_removeSet.begin();
|
||||
it != m_removeSet.end(); ++it) {
|
||||
AstNode* np = *it;
|
||||
|
|
@ -837,7 +837,7 @@ public:
|
|||
}
|
||||
virtual ~RemovePlaceholdersVisitor() {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSplitPlaceholder* nodep) {
|
||||
m_removeSet.insert(nodep);
|
||||
|
|
@ -862,7 +862,7 @@ public:
|
|||
explicit SplitVisitor(AstNetlist* nodep)
|
||||
: SplitReorderBaseVisitor()
|
||||
, m_curIfConditional(NULL) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
|
||||
// Splice newly-split blocks into the tree. Remove placeholders
|
||||
// from newly-split blocks. Delete the original always blocks
|
||||
|
|
@ -1000,7 +1000,7 @@ protected:
|
|||
virtual void visit(AstNodeIf* nodep) {
|
||||
UINFO(4," IF "<<nodep<<endl);
|
||||
m_curIfConditional = nodep;
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
m_curIfConditional = NULL;
|
||||
scanBlock(nodep->ifsp());
|
||||
scanBlock(nodep->elsesp());
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ private:
|
|||
}
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit SplitAsFindVisitor(AstAlways* nodep) {
|
||||
m_splitVscp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~SplitAsFindVisitor() {}
|
||||
// METHODS
|
||||
|
|
@ -107,7 +107,7 @@ private:
|
|||
m_matches = false;
|
||||
m_keepStmt = false;
|
||||
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
|
||||
if (m_keepStmt
|
||||
|| (m_modeMatch ? m_matches : !m_matches)) {
|
||||
|
|
@ -123,14 +123,14 @@ private:
|
|||
UINFO(9," upKeep="<<m_keepStmt<<" STMT "<<nodep<<endl);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
SplitAsCleanVisitor(AstAlways* nodep, AstVarScope* vscp, bool modeMatch) {
|
||||
m_splitVscp = vscp;
|
||||
m_modeMatch = modeMatch;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~SplitAsCleanVisitor() {}
|
||||
};
|
||||
|
|
@ -195,7 +195,7 @@ private:
|
|||
virtual void visit(AstNodeMath* nodep) {}
|
||||
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -203,7 +203,7 @@ public:
|
|||
explicit SplitAsVisitor(AstNetlist* nodep) {
|
||||
m_splitVscp = NULL;
|
||||
AstNode::user1ClearTree(); // user1p() used on entire tree
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~SplitAsVisitor() {
|
||||
V3Stats::addStat("Optimizations, isolate_assignments blocks", m_statSplits);
|
||||
|
|
|
|||
|
|
@ -91,14 +91,14 @@ private:
|
|||
allNodes(nodep);
|
||||
if (!m_fast) {
|
||||
// Count all CFuncs below this module
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
}
|
||||
// Else we recursively trace fast CFuncs from the top _eval
|
||||
// func, see visit(AstNetlist*)
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
if (m_counting && nodep->dtypep()) {
|
||||
if (nodep->isUsedClock()) ++m_statVarClock;
|
||||
if (VN_IS(nodep->dtypeSkipRefp(), UnpackArrayDType)) ++m_statVarArray;
|
||||
|
|
@ -121,7 +121,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstVarScope* nodep) {
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
if (m_counting) {
|
||||
if (VN_IS(nodep->varp()->dtypeSkipRefp(), BasicDType)) {
|
||||
m_statVarScpBytes += nodep->varp()->dtypeSkipRefp()->widthTotalBytes();
|
||||
|
|
@ -132,14 +132,14 @@ private:
|
|||
UINFO(4," IF i="<<m_instrs<<" "<<nodep<<endl);
|
||||
allNodes(nodep);
|
||||
// Condition is part of cost allocated to PREVIOUS block
|
||||
nodep->condp()->iterateAndNextConst(*this);
|
||||
iterateAndNextConstNull(nodep->condp());
|
||||
// Track prediction
|
||||
if (m_counting) {
|
||||
++m_statPred[nodep->branchPred()];
|
||||
}
|
||||
if (!m_fast) {
|
||||
// Count everything
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
} else {
|
||||
// See which path we want to take
|
||||
// Need to do even if !m_counting because maybe determining upstream if/else
|
||||
|
|
@ -151,7 +151,7 @@ private:
|
|||
{
|
||||
m_counting = false;
|
||||
m_instrs = 0.0;
|
||||
nodep->ifsp()->iterateAndNextConst(*this);
|
||||
iterateAndNextConstNull(nodep->ifsp());
|
||||
ifInstrs = m_instrs;
|
||||
}
|
||||
m_instrs = prevInstr;
|
||||
|
|
@ -163,7 +163,7 @@ private:
|
|||
{
|
||||
m_counting = false;
|
||||
m_instrs = 0.0;
|
||||
nodep->elsesp()->iterateAndNextConst(*this);
|
||||
iterateAndNextConstNull(nodep->elsesp());
|
||||
elseInstrs = m_instrs;
|
||||
}
|
||||
m_instrs = prevInstr;
|
||||
|
|
@ -172,9 +172,9 @@ private:
|
|||
// Now collect the stats
|
||||
if (m_counting) {
|
||||
if (ifInstrs >= elseInstrs) {
|
||||
nodep->ifsp()->iterateAndNextConst(*this);
|
||||
iterateAndNextConstNull(nodep->ifsp());
|
||||
} else {
|
||||
nodep->elsesp()->iterateAndNextConst(*this);
|
||||
iterateAndNextConstNull(nodep->elsesp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -184,11 +184,11 @@ private:
|
|||
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
if (m_fast && !nodep->funcp()->entryPoint()) {
|
||||
// Enter the function and trace it
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
iterate(nodep->funcp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
|
|
@ -198,22 +198,22 @@ private:
|
|||
}
|
||||
m_cfuncp = nodep;
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
m_cfuncp = NULL;
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
}
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
if (m_fast && nodep->evalp()) {
|
||||
m_instrs = 0;
|
||||
m_counting = true;
|
||||
nodep->evalp()->iterateChildrenConst(*this);
|
||||
if (nodep->evalp()) iterateChildrenConst(nodep->evalp());
|
||||
m_counting = false;
|
||||
}
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
iterateChildrenConst(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -227,7 +227,7 @@ public:
|
|||
// Initialize arrays
|
||||
m_statTypeCount.resize(AstType::_ENUM_END);
|
||||
// Process
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~StatsVisitor() {
|
||||
// Done. Publish statistics
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstConst* nodep) {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -218,7 +218,7 @@ public:
|
|||
UINFO(9, " SubstUseVisitor "<<origStep<<" "<<nodep<<endl);
|
||||
m_ok = true;
|
||||
m_origStep = origStep;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~SubstUseVisitor() {}
|
||||
// METHODS
|
||||
|
|
@ -266,7 +266,7 @@ private:
|
|||
virtual void visit(AstNodeAssign* nodep) {
|
||||
m_ops = 0;
|
||||
m_assignStep++;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
bool hit=false;
|
||||
if (AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef)) {
|
||||
if (isSubstVar(varrefp->varp())) {
|
||||
|
|
@ -299,7 +299,7 @@ private:
|
|||
}
|
||||
}
|
||||
if (!hit) {
|
||||
nodep->lhsp()->accept(*this);
|
||||
iterate(nodep->lhsp());
|
||||
}
|
||||
}
|
||||
void replaceSubstEtc(AstNode* nodep, AstNode* substp) {
|
||||
|
|
@ -314,7 +314,7 @@ private:
|
|||
++m_statSubsts;
|
||||
}
|
||||
virtual void visit(AstWordSel* nodep) {
|
||||
nodep->rhsp()->accept(*this);
|
||||
iterate(nodep->rhsp());
|
||||
AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef);
|
||||
AstConst* constp = VN_CAST(nodep->rhsp(), Const);
|
||||
if (varrefp && isSubstVar(varrefp->varp())
|
||||
|
|
@ -337,7 +337,7 @@ private:
|
|||
entryp->consumeWord(word);
|
||||
}
|
||||
} else {
|
||||
nodep->lhsp()->accept(*this);
|
||||
iterate(nodep->lhsp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
|
|
@ -375,7 +375,7 @@ private:
|
|||
if (!nodep->isSubstOptimizable()) {
|
||||
m_ops = SUBST_MAX_OPS_NA;
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -384,7 +384,7 @@ public:
|
|||
AstNode::user2ClearTree(); // user2p() used on entire tree
|
||||
m_ops = 0;
|
||||
m_assignStep = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~SubstVisitor() {
|
||||
V3Stats::addStat("Optimizations, Substituted temps", m_statSubsts);
|
||||
|
|
|
|||
|
|
@ -406,19 +406,19 @@ private:
|
|||
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
m_modTables = 0;
|
||||
m_modTableVscs.clear();
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
UINFO(4," SCOPE "<<nodep<<endl);
|
||||
m_scopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstAlways* nodep) {
|
||||
|
|
@ -436,7 +436,7 @@ private:
|
|||
}
|
||||
// default
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -448,7 +448,7 @@ public:
|
|||
m_inWidth = 0;
|
||||
m_outWidth = 0;
|
||||
m_totalBytes = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TableVisitor() {
|
||||
V3Stats::addStat("Optimizations, Tables created", m_statTablesCre);
|
||||
|
|
|
|||
|
|
@ -179,11 +179,11 @@ private:
|
|||
taskp->user3p(nodep);
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstAssignW* nodep) {
|
||||
m_assignwp = nodep;
|
||||
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
||||
iterateChildren(nodep); VL_DANGLING(nodep); // May delete nodep.
|
||||
m_assignwp = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
|
|
@ -202,7 +202,7 @@ private:
|
|||
TaskBaseVertex* lastVxp = m_curVxp;
|
||||
m_curVxp = getFTaskVertex(nodep);
|
||||
if (nodep->dpiImport()) m_curVxp->noInline(true);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_curVxp = lastVxp;
|
||||
}
|
||||
virtual void visit(AstPragma* nodep) {
|
||||
|
|
@ -212,15 +212,15 @@ private:
|
|||
nodep->unlinkFrBack()->deleteTree();
|
||||
}
|
||||
else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->user4p(m_curVxp); // Remember what task it's under
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->varp()->user4u().toGraphVertex() != m_curVxp) {
|
||||
if (m_curVxp->pure()
|
||||
&& !nodep->varp()->isXTemp()) {
|
||||
|
|
@ -231,7 +231,7 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -241,7 +241,7 @@ public:
|
|||
AstNode::user3ClearTree();
|
||||
AstNode::user4ClearTree();
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
//
|
||||
m_callGraph.removeRedundantEdgesSum(&TaskEdge::followAlwaysTrue);
|
||||
m_callGraph.dumpDotFilePrefixed("task_call");
|
||||
|
|
@ -269,17 +269,17 @@ private:
|
|||
nodep->varp(nodep->varScopep()->varp());
|
||||
nodep->name(nodep->varp()->name());
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
explicit TaskRelinkVisitor(AstBegin* nodep) { // Passed temporary tree
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TaskRelinkVisitor() {}
|
||||
};
|
||||
|
|
@ -1076,7 +1076,7 @@ private:
|
|||
InsertMode prevInsMode = m_insMode;
|
||||
AstNode* prevInsStmtp = m_insStmtp;
|
||||
m_scopep = m_statep->getScope(nodep);
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
m_scopep = oldscopep;
|
||||
m_insMode = prevInsMode;
|
||||
m_insStmtp = prevInsStmtp;
|
||||
|
|
@ -1113,17 +1113,17 @@ private:
|
|||
m_modp = nodep;
|
||||
m_insStmtp = NULL;
|
||||
m_modNCalls = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
m_topScopep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstScope* nodep) {
|
||||
m_scopep = nodep;
|
||||
m_insStmtp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||
|
|
@ -1224,15 +1224,15 @@ private:
|
|||
// Special, as statements need to be put in different places
|
||||
// Preconditions insert first just before themselves (the normal rule for other statement types)
|
||||
m_insStmtp = NULL; // First thing should be new statement
|
||||
nodep->precondsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->precondsp());
|
||||
// Conditions insert first at end of precondsp.
|
||||
m_insMode = IM_WHILE_PRECOND;
|
||||
m_insStmtp = nodep;
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condp());
|
||||
// Body insert just before themselves
|
||||
m_insStmtp = NULL; // First thing should be new statement
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
nodep->incsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
iterateAndNextNull(nodep->incsp());
|
||||
// Done the loop
|
||||
m_insStmtp = NULL; // Next thing should be new statement
|
||||
}
|
||||
|
|
@ -1242,13 +1242,13 @@ private:
|
|||
virtual void visit(AstNodeStmt* nodep) {
|
||||
m_insMode = IM_BEFORE;
|
||||
m_insStmtp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_insStmtp = NULL; // Next thing should be new statement
|
||||
}
|
||||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -1260,7 +1260,7 @@ public:
|
|||
m_scopep = NULL;
|
||||
m_insStmtp = NULL;
|
||||
AstNode::user1ClearTree();
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TaskVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -569,11 +569,11 @@ private:
|
|||
|
||||
// Add vertexes for all TRACES, and edges from VARs each trace looks at
|
||||
m_finding = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
|
||||
// Add vertexes for all CFUNCs, and edges to VARs the func sets
|
||||
m_finding = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_finding = false;
|
||||
|
||||
// Detect and remove duplicate values
|
||||
|
|
@ -590,13 +590,13 @@ private:
|
|||
}
|
||||
virtual void visit(AstNodeModule* nodep) {
|
||||
if (nodep->isTop()) m_topModp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
AstScope* scopep = nodep->scopep();
|
||||
if (!scopep) nodep->v3fatalSrc("No scope found on top level");
|
||||
m_highScopep = scopep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
UINFO(8," CCALL "<<nodep<<endl);
|
||||
|
|
@ -614,7 +614,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
UINFO(8," CFUNC "<<nodep<<endl);
|
||||
|
|
@ -636,7 +636,7 @@ private:
|
|||
}
|
||||
}
|
||||
m_funcp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_funcp = NULL;
|
||||
}
|
||||
virtual void visit(AstTraceInc* nodep) {
|
||||
|
|
@ -649,7 +649,7 @@ private:
|
|||
|
||||
if (!m_funcp || (!m_chgFuncp || !m_fullFuncp)) nodep->v3fatalSrc("Trace not under func");
|
||||
m_tracep = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_tracep = NULL;
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) {
|
||||
|
|
@ -679,7 +679,7 @@ private:
|
|||
}
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -701,7 +701,7 @@ public:
|
|||
m_chgSubParentp = NULL;
|
||||
m_chgSubStmts = 0;
|
||||
m_funcNum = 0;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TraceVisitor() {
|
||||
V3Stats::addStat("Tracing, Unique changing signals", m_statChgSigs);
|
||||
|
|
|
|||
|
|
@ -146,10 +146,10 @@ private:
|
|||
//
|
||||
m_initSubFuncp = newCFuncSub(m_initFuncp);
|
||||
// And find variables
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstVarScope* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Avoid updating this if (), instead see varp->isTrace()
|
||||
if (!nodep->varp()->isTemp() && !nodep->varp()->isFuncLocal()) {
|
||||
UINFO(5, " vsc "<<nodep<<endl);
|
||||
|
|
@ -172,7 +172,7 @@ private:
|
|||
else m_traValuep = new AstVarRef(nodep->fileline(), nodep, false);
|
||||
{
|
||||
// Recurse into data type of the signal; the visitors will call addTraceDecl()
|
||||
varp->dtypeSkipRefp()->accept(*this);
|
||||
iterate(varp->dtypeSkipRefp());
|
||||
}
|
||||
// Cleanup
|
||||
if (m_traValuep) { m_traValuep->deleteTree(); m_traValuep=NULL; }
|
||||
|
|
@ -185,12 +185,12 @@ private:
|
|||
// VISITORS - Data types when tracing
|
||||
virtual void visit(AstConstDType* nodep) {
|
||||
if (m_traVscp) {
|
||||
nodep->subDTypep()->skipRefp()->accept(*this);
|
||||
iterate(nodep->subDTypep()->skipRefp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstRefDType* nodep) {
|
||||
if (m_traVscp) {
|
||||
nodep->subDTypep()->skipRefp()->accept(*this);
|
||||
iterate(nodep->subDTypep()->skipRefp());
|
||||
}
|
||||
}
|
||||
virtual void visit(AstUnpackArrayDType* nodep) {
|
||||
|
|
@ -214,7 +214,7 @@ private:
|
|||
m_traValuep = new AstArraySel(nodep->fileline(), m_traValuep->cloneTree(true),
|
||||
i - nodep->lsb());
|
||||
|
||||
subtypep->accept(*this);
|
||||
iterate(subtypep);
|
||||
m_traValuep->deleteTree(); m_traValuep = NULL;
|
||||
}
|
||||
m_traShowname = oldShowname;
|
||||
|
|
@ -239,7 +239,7 @@ private:
|
|||
m_traValuep = new AstSel(nodep->fileline(), m_traValuep->cloneTree(true),
|
||||
(i - nodep->lsb())*subtypep->width(),
|
||||
subtypep->width());
|
||||
subtypep->accept(*this);
|
||||
iterate(subtypep);
|
||||
m_traValuep->deleteTree(); m_traValuep = NULL;
|
||||
}
|
||||
m_traShowname = oldShowname;
|
||||
|
|
@ -267,10 +267,10 @@ private:
|
|||
if (VN_IS(nodep, StructDType)) {
|
||||
m_traValuep = new AstSel(nodep->fileline(), m_traValuep->cloneTree(true),
|
||||
itemp->lsb(), subtypep->width());
|
||||
subtypep->accept(*this);
|
||||
iterate(subtypep);
|
||||
m_traValuep->deleteTree(); m_traValuep = NULL;
|
||||
} else { // Else union, replicate fields
|
||||
subtypep->accept(*this);
|
||||
iterate(subtypep);
|
||||
}
|
||||
}
|
||||
m_traShowname = oldShowname;
|
||||
|
|
@ -297,7 +297,7 @@ private:
|
|||
|
||||
//--------------------
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -312,7 +312,7 @@ public:
|
|||
m_funcNum = 0;
|
||||
m_traVscp = NULL;
|
||||
m_traValuep = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TraceDeclVisitor() {
|
||||
V3Stats::addStat("Tracing, Traced signals", m_statSigs);
|
||||
|
|
|
|||
|
|
@ -302,21 +302,21 @@ class TristatePinVisitor : public TristateBaseVisitor {
|
|||
virtual void visit(AstArraySel* nodep) {
|
||||
// Doesn't work because we'd set lvalue on the array index's var
|
||||
if (m_lvalue) nodep->v3fatalSrc("ArraySel conversion to output, under tristate node");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSliceSel* nodep) {
|
||||
// Doesn't work because we'd set lvalue on the array index's var
|
||||
if (m_lvalue) nodep->v3fatalSrc("SliceSel conversion to output, under tristate node");
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
TristatePinVisitor(AstNode* nodep, TristateGraph& tgraph, bool lvalue)
|
||||
: m_tgraph(tgraph), m_lvalue(lvalue) {
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TristatePinVisitor() {}
|
||||
};
|
||||
|
|
@ -676,7 +676,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
|
||||
virtual void visit(AstCond* nodep) {
|
||||
if (m_graphing) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_alhs) {
|
||||
associateLogic(nodep, nodep->expr1p());
|
||||
associateLogic(nodep, nodep->expr2p());
|
||||
|
|
@ -686,7 +686,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
}
|
||||
} else {
|
||||
if (m_alhs && nodep->user1p()) { nodep->v3error("Unsupported LHS tristate construct: "<<nodep->prettyTypeName()); return; }
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
// Generate the new output enable signal for this cond if either
|
||||
// expression 1 or 2 have an output enable '__en' signal. If the
|
||||
|
|
@ -715,7 +715,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
|
||||
virtual void visit(AstSel* nodep) {
|
||||
if (m_graphing) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_alhs) {
|
||||
associateLogic(nodep, nodep->fromp());
|
||||
} else {
|
||||
|
|
@ -731,9 +731,9 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
if (debug()>=9) newp->dumpTree(cout,"-assign-sel; ");
|
||||
m_tgraph.didProcess(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
if (nodep->lsbp()->user1p()) {
|
||||
nodep->v3error("Unsupported RHS tristate construct: "<<nodep->prettyTypeName());
|
||||
|
|
@ -752,7 +752,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
|
||||
virtual void visit(AstConcat* nodep) {
|
||||
if (m_graphing) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_alhs) {
|
||||
associateLogic(nodep, nodep->lhsp());
|
||||
associateLogic(nodep, nodep->rhsp());
|
||||
|
|
@ -778,9 +778,9 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
nodep->rhsp()->width()));
|
||||
m_tgraph.didProcess(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
// Generate the new output enable signal, just as a concat identical to the data concat
|
||||
AstNode* expr1p = nodep->lhsp();
|
||||
|
|
@ -801,7 +801,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
|
||||
virtual void visit(AstBufIf1* nodep) {
|
||||
// For BufIf1, the enable is the LHS expression
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
if (m_graphing) {
|
||||
associateLogic(nodep->rhsp(), nodep);
|
||||
|
|
@ -829,7 +829,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
}
|
||||
|
||||
void visitAndOr(AstNodeBiop* nodep, bool isAnd) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
if (m_graphing) {
|
||||
associateLogic(nodep->lhsp(), nodep);
|
||||
|
|
@ -891,9 +891,9 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
if (nodep->user2() & U2_GRAPHING) return;
|
||||
nodep->user2(U2_GRAPHING);
|
||||
m_logicp = nodep;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
m_alhs = true;
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_alhs = false;
|
||||
associateLogic(nodep->rhsp(), nodep);
|
||||
associateLogic(nodep, nodep->lhsp());
|
||||
|
|
@ -901,7 +901,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
} else {
|
||||
if (nodep->user2() & U2_NONGRAPH) return; // Iterated here, or created assignment to ignore
|
||||
nodep->user2(U2_NONGRAPH);
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->rhsp());
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
if (debug()>=9) nodep->dumpTree(cout,"-assign: ");
|
||||
// if the rhsp of this assign statement has an output enable driver,
|
||||
|
|
@ -915,7 +915,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
m_tgraph.didProcess(nodep);
|
||||
}
|
||||
m_alhs = true; // And user1p() will indicate tristate equation, if any
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
m_alhs = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -928,14 +928,14 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
|
||||
void visitCaseEq(AstNodeBiop* nodep, bool neq) {
|
||||
if (m_graphing) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
checkUnhandled(nodep);
|
||||
// Unsupported: A === 3'b000 should compare with the enables, but we don't do
|
||||
// so at present, we only compare if there is a z in the equation.
|
||||
// Otherwise we'd need to attach an enable to every signal, then optimize them
|
||||
// away later when we determine the signal has no tristate
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
const AstConst* constp = VN_CAST(nodep->lhsp(), Const); // Constification always moves const to LHS
|
||||
AstVarRef* varrefp = VN_CAST(nodep->rhsp(), VarRef); // Input variable
|
||||
|
|
@ -967,7 +967,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
nodep->v3error("Unsupported: RHS of ==? or !=? must be constant to be synthesizable"); // Says spec.
|
||||
// rhs we want to keep X/Z intact, so otherwise ignore
|
||||
}
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->lhsp());
|
||||
if (nodep->lhsp()->user1p()) { nodep->v3error("Unsupported LHS tristate construct: "<<nodep->prettyTypeName()); return; }
|
||||
}
|
||||
virtual void visit(AstEqCase* nodep) {
|
||||
|
|
@ -1028,14 +1028,14 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
associateLogic(nodep->exprp(), nodep);
|
||||
associateLogic(nodep, nodep->exprp());
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_logicp = NULL;
|
||||
} else {
|
||||
// All heavy lifting completed in graph visitor.
|
||||
if (nodep->exprp()) {
|
||||
m_tgraph.didProcess(nodep);
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1239,7 +1239,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
}
|
||||
|
||||
virtual void visit(AstVar* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
UINFO(9,dbgState()<<nodep<<endl);
|
||||
if (m_graphing) {
|
||||
// If tri0/1 force a pullup
|
||||
|
|
@ -1282,13 +1282,13 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
// Walk the graph, finding all variables and tristate constructs
|
||||
{
|
||||
m_graphing = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_graphing = false;
|
||||
}
|
||||
// Use graph to find tristate signals
|
||||
m_tgraph.graphWalk(nodep);
|
||||
// Build the LHS drivers map for this module
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Insert new logic for all tristates
|
||||
insertTristates(nodep);
|
||||
m_modp = NULL;
|
||||
|
|
@ -1300,23 +1300,23 @@ class TristateVisitor : public TristateBaseVisitor {
|
|||
|
||||
virtual void visit(AstCaseItem* nodep) {
|
||||
// don't deal with casez compare '???? values
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
}
|
||||
|
||||
virtual void visit(AstCell* nodep) {
|
||||
m_cellp = nodep;
|
||||
m_alhs = false;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_cellp = NULL;
|
||||
}
|
||||
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
checkUnhandled(nodep);
|
||||
}
|
||||
|
||||
|
|
@ -1330,7 +1330,7 @@ public:
|
|||
m_alhs = false;
|
||||
m_logicp = NULL;
|
||||
m_tgraph.clear();
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~TristateVisitor() {
|
||||
V3Stats::addStat("Tristate, Tristate resolved nets", m_statTriSigs);
|
||||
|
|
|
|||
|
|
@ -292,15 +292,15 @@ private:
|
|||
}
|
||||
}
|
||||
// Discover variables used in bit definitions, etc
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstArraySel* nodep) {
|
||||
// Arrays are rarely constant assigned, so for now we punt and do all entries
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSliceSel* nodep) {
|
||||
// Arrays are rarely constant assigned, so for now we punt and do all entries
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstSel* nodep) {
|
||||
AstNodeVarRef* varrefp = VN_CAST(nodep->fromp(), NodeVarRef);
|
||||
|
|
@ -321,7 +321,7 @@ private:
|
|||
}
|
||||
} else {
|
||||
// else other varrefs handled as unknown mess in AstVarRef
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstNodeVarRef* nodep) {
|
||||
|
|
@ -344,7 +344,7 @@ private:
|
|||
virtual void visit(AstSysIgnore* nodep) {
|
||||
bool prevMark = m_inBBox;
|
||||
m_inBBox = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_inBBox = prevMark;
|
||||
}
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ private:
|
|||
if (nodep->keyword() == VAlwaysKwd::ALWAYS_COMB) UINFO(9," "<<nodep<<endl);
|
||||
if (nodep->keyword() == VAlwaysKwd::ALWAYS_COMB) m_alwaysp = nodep;
|
||||
else m_alwaysp = NULL;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (nodep->keyword() == VAlwaysKwd::ALWAYS_COMB) UINFO(9," Done "<<nodep<<endl);
|
||||
}
|
||||
m_alwaysp = prevAlwp;
|
||||
|
|
@ -364,7 +364,7 @@ private:
|
|||
virtual void visit(AstNodeFTask* nodep) {
|
||||
AstNodeFTask* prevTaskp = m_taskp;
|
||||
m_taskp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_taskp = prevTaskp;
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ private:
|
|||
// iterate
|
||||
virtual void visit(AstConst* nodep) {}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
public:
|
||||
// CONSTUCTORS
|
||||
|
|
@ -389,7 +389,7 @@ public:
|
|||
m_inBBox = false;
|
||||
m_taskp = NULL;
|
||||
m_alwaysp = NULL;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~UndrivenVisitor() {
|
||||
for (std::vector<UndrivenVarEntry*>::iterator it = m_entryps[1].begin(); it != m_entryps[1].end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -151,28 +151,28 @@ private:
|
|||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_constXCvt = true;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_modp = NULL;
|
||||
}
|
||||
virtual void visit(AstAssignDly* nodep) {
|
||||
m_assigndlyp = nodep;
|
||||
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
||||
iterateChildren(nodep); VL_DANGLING(nodep); // May delete nodep.
|
||||
m_assigndlyp = NULL;
|
||||
}
|
||||
virtual void visit(AstAssignW* nodep) {
|
||||
m_assignwp = nodep;
|
||||
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
||||
iterateChildren(nodep); VL_DANGLING(nodep); // May delete nodep.
|
||||
m_assignwp = NULL;
|
||||
}
|
||||
virtual void visit(AstCaseItem* nodep) {
|
||||
m_constXCvt = false; // Avoid losing the X's in casex
|
||||
nodep->condsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->condsp());
|
||||
m_constXCvt = true;
|
||||
nodep->bodysp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep->bodysp());
|
||||
}
|
||||
virtual void visit(AstNodeDType* nodep) {
|
||||
m_constXCvt = false; // Avoid losing the X's in casex
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
m_constXCvt = true;
|
||||
}
|
||||
void visitEqNeqCase(AstNodeBiop* nodep) {
|
||||
|
|
@ -202,7 +202,7 @@ private:
|
|||
nodep->replaceWith(newp);
|
||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||
// Iterate tree now that we may have gotten rid of Xs
|
||||
newp->iterateChildren(*this);
|
||||
iterateChildren(newp);
|
||||
}
|
||||
}
|
||||
void visitEqNeqWild(AstNodeBiop* nodep) {
|
||||
|
|
@ -238,7 +238,7 @@ private:
|
|||
nodep->replaceWith(newp);
|
||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||
// Iterate tree now that we may have gotten rid of the compare
|
||||
newp->iterateChildren(*this);
|
||||
iterateChildren(newp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ private:
|
|||
visitEqNeqWild(nodep);
|
||||
}
|
||||
virtual void visit(AstIsUnknown* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
// Ahh, we're two state, so this is easy
|
||||
UINFO(4," ISUNKNOWN->0 "<<nodep<<endl);
|
||||
V3Number zero (nodep->fileline(), 1, 0);
|
||||
|
|
@ -328,7 +328,7 @@ private:
|
|||
}
|
||||
|
||||
virtual void visit(AstSel* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->user1SetOnce()) {
|
||||
// Guard against reading/writing past end of bit vector array
|
||||
AstNode* basefromp = AstArraySel::baseFromp(nodep);
|
||||
|
|
@ -367,7 +367,7 @@ private:
|
|||
// Link in conditional
|
||||
replaceHandle.relink(newp);
|
||||
// Added X's, tristate them too
|
||||
newp->accept(*this);
|
||||
iterate(newp);
|
||||
}
|
||||
else { // lvalue
|
||||
replaceBoundLvalue(nodep, condp);
|
||||
|
|
@ -379,7 +379,7 @@ private:
|
|||
// in V3Width.
|
||||
|
||||
virtual void visit(AstArraySel* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (!nodep->user1SetOnce()) {
|
||||
if (debug()==9) nodep->dumpTree(cout,"-in: ");
|
||||
// Guard against reading/writing past end of arrays
|
||||
|
|
@ -433,7 +433,7 @@ private:
|
|||
// Link in conditional, can blow away temp xor
|
||||
replaceHandle.relink(newp);
|
||||
// Added X's, tristate them too
|
||||
newp->accept(*this);
|
||||
iterate(newp);
|
||||
}
|
||||
else if (!lvalue) { // Mid-multidimension read, just use zero
|
||||
// ARRAYSEL(...) -> ARRAYSEL(COND(LT(bit<maxbit), bit, 0))
|
||||
|
|
@ -447,7 +447,7 @@ private:
|
|||
// Added X's, tristate them too
|
||||
if (debug()>=9) newp->dumpTree(cout," _new: ");
|
||||
replaceHandle.relink(newp);
|
||||
newp->accept(*this);
|
||||
iterate(newp);
|
||||
}
|
||||
else { // lvalue
|
||||
replaceBoundLvalue(nodep, condp);
|
||||
|
|
@ -457,7 +457,7 @@ private:
|
|||
//--------------------
|
||||
// Default: Just iterate
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -467,7 +467,7 @@ public:
|
|||
m_assigndlyp = NULL;
|
||||
m_assignwp = NULL;
|
||||
m_constXCvt = false;
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~UnknownVisitor() {
|
||||
V3Stats::addStat("Unknowns, variables created", m_statUnkVars);
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ private:
|
|||
m_varModeCheck = true;
|
||||
m_varAssignHit = false;
|
||||
m_ignoreIncp = incp;
|
||||
precondsp->iterateAndNext(*this);
|
||||
bodysp->iterateAndNext(*this);
|
||||
incp->iterateAndNext(*this);
|
||||
iterateAndNextNull(precondsp);
|
||||
iterateAndNextNull(bodysp);
|
||||
iterateAndNextNull(incp);
|
||||
m_varModeCheck = false;
|
||||
m_ignoreIncp = NULL;
|
||||
if (m_varAssignHit) return cantUnroll(nodep, "genvar assigned *inside* loop");
|
||||
|
|
@ -203,7 +203,7 @@ private:
|
|||
// Iteration requires a back, so put under temporary node
|
||||
AstBegin* tempp = new AstBegin (nodep->fileline(), "[EditWrapper]", clone);
|
||||
m_varModeReplace = true;
|
||||
tempp->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(tempp->stmtsp());
|
||||
m_varModeReplace = false;
|
||||
clone = tempp->stmtsp()->unlinkFrBackWithNext();
|
||||
tempp->deleteTree();
|
||||
|
|
@ -319,7 +319,7 @@ private:
|
|||
if (oneloopp) {
|
||||
AstBegin* tempp = new AstBegin(oneloopp->fileline(),"[EditWrapper]",oneloopp);
|
||||
m_varModeReplace = true;
|
||||
tempp->stmtsp()->iterateAndNext(*this);
|
||||
iterateAndNextNull(tempp->stmtsp());
|
||||
m_varModeReplace = false;
|
||||
oneloopp = tempp->stmtsp()->unlinkFrBackWithNext(); tempp->deleteTree(); VL_DANGLING(tempp);
|
||||
}
|
||||
|
|
@ -363,7 +363,7 @@ private:
|
|||
}
|
||||
|
||||
virtual void visit(AstWhile* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
if (m_varModeCheck || m_varModeReplace) {
|
||||
} else {
|
||||
// Constify before unroll call, as it may change what is underneath.
|
||||
|
|
@ -393,7 +393,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstGenFor* nodep) {
|
||||
if (!m_generate || m_varModeReplace) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} // else V3Param will recursively call each for loop to be unrolled for us
|
||||
if (m_varModeCheck || m_varModeReplace) {
|
||||
} else {
|
||||
|
|
@ -421,7 +421,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstNodeFor* nodep) {
|
||||
if (m_generate) { // Ignore for's when expanding genfor's
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
} else {
|
||||
nodep->v3error("V3Begin should have removed standard FORs");
|
||||
}
|
||||
|
|
@ -452,7 +452,7 @@ private:
|
|||
if (m_varModeCheck && nodep == m_ignoreIncp) {
|
||||
// Ignore subtree that is the increment
|
||||
} else {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ public:
|
|||
m_generate = generate;
|
||||
m_beginName = beginName;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~UnrollVisitor() {
|
||||
V3Stats::addStatSum("Optimizations, Unrolled Loops", m_statLoops);
|
||||
|
|
|
|||
|
|
@ -3807,7 +3807,7 @@ private:
|
|||
AstNode* ret;
|
||||
{
|
||||
m_vup = vup;
|
||||
ret = nodep->iterateSubtreeReturnEdits(*this);
|
||||
ret = iterateSubtreeReturnEdits(nodep);
|
||||
}
|
||||
m_vup = saveVup;
|
||||
return ret;
|
||||
|
|
@ -3817,7 +3817,7 @@ private:
|
|||
WidthVP* saveVup = m_vup;
|
||||
{
|
||||
m_vup = vup;
|
||||
nodep->iterate(*this);
|
||||
iterate(nodep);
|
||||
}
|
||||
m_vup = saveVup;
|
||||
}
|
||||
|
|
@ -3826,7 +3826,7 @@ private:
|
|||
WidthVP* saveVup = m_vup;
|
||||
{
|
||||
m_vup = vup;
|
||||
nodep->iterateAndNext(*this);
|
||||
iterateAndNextNull(nodep);
|
||||
}
|
||||
m_vup = saveVup;
|
||||
}
|
||||
|
|
@ -3835,7 +3835,7 @@ private:
|
|||
WidthVP* saveVup = m_vup;
|
||||
{
|
||||
m_vup = vup;
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
m_vup = saveVup;
|
||||
}
|
||||
|
|
@ -3844,7 +3844,7 @@ private:
|
|||
WidthVP* saveVup = m_vup;
|
||||
{
|
||||
m_vup = vup;
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
iterateChildrenBackwards(nodep);
|
||||
}
|
||||
m_vup = saveVup;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ private:
|
|||
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
void replaceWithSignedVersion(AstNode* nodep, AstNode* newp) {
|
||||
UINFO(6," Replace "<<nodep<<" w/ "<<newp<<endl);
|
||||
|
|
@ -57,7 +57,7 @@ public:
|
|||
WidthRemoveVisitor() {}
|
||||
virtual ~WidthRemoveVisitor() {}
|
||||
AstNode* mainAcceptEdit(AstNode* nodep) {
|
||||
return nodep->iterateSubtreeReturnEdits(*this);
|
||||
return iterateSubtreeReturnEdits(nodep);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ private:
|
|||
// dtypep() figures into sameTree() results in better optimizations
|
||||
if (!nodep) return NULL;
|
||||
// Recurse to handle the data type, as may change the size etc of this type
|
||||
if (!nodep->user1()) nodep->accept(*this);
|
||||
if (!nodep->user1()) iterate(nodep);
|
||||
// Look for duplicate
|
||||
if (AstBasicDType* bdtypep = VN_CAST(nodep, BasicDType)) {
|
||||
AstBasicDType* newp = nodep->findInsertSameDType(bdtypep);
|
||||
|
|
@ -114,7 +114,7 @@ private:
|
|||
// VISITORS
|
||||
virtual void visit(AstConst* nodep) {
|
||||
if (!nodep->dtypep()) nodep->v3fatalSrc("No dtype");
|
||||
nodep->dtypep()->accept(*this); // Do datatype first
|
||||
iterate(nodep->dtypep()); // Do datatype first
|
||||
if (AstConst* newp = newIfConstCommitSize(nodep)) {
|
||||
nodep->replaceWith(newp);
|
||||
AstNode* oldp = nodep; nodep = newp;
|
||||
|
|
@ -147,7 +147,7 @@ private:
|
|||
nodep->widthMinFromWidth();
|
||||
// Too late to any unspecified sign to be anything but unsigned
|
||||
if (nodep->numeric().isNosign()) nodep->numeric(AstNumeric::UNSIGNED);
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
|
||||
}
|
||||
virtual void visit(AstNodePreSel* nodep) {
|
||||
|
|
@ -155,7 +155,7 @@ private:
|
|||
nodep->v3fatalSrc("Presels should have been removed before this point");
|
||||
}
|
||||
virtual void visit(AstNode* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
iterateChildren(nodep);
|
||||
editDType(nodep);
|
||||
}
|
||||
public:
|
||||
|
|
@ -163,7 +163,7 @@ public:
|
|||
explicit WidthCommitVisitor(AstNetlist* nodep) {
|
||||
// Were changing widthMin's, so the table is now somewhat trashed
|
||||
nodep->typeTablep()->clearCache();
|
||||
nodep->accept(*this);
|
||||
iterate(nodep);
|
||||
// Don't want to repairCache, as all needed nodes have been added back in
|
||||
// a repair would prevent dead nodes from being detected
|
||||
}
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ public:
|
|||
// CONSTUCTORS
|
||||
WidthSelVisitor() {}
|
||||
AstNode* mainAcceptEdit(AstNode* nodep) {
|
||||
return nodep->iterateSubtreeReturnEdits(*this);
|
||||
return iterateSubtreeReturnEdits(nodep);
|
||||
}
|
||||
virtual ~WidthSelVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -618,11 +618,11 @@ sub tree_base {
|
|||
if ($out_for_type_sc[0]) { # Short-circuited types
|
||||
$self->print(" // Generated by astgen with short-circuiting\n",
|
||||
" virtual void visit(Ast${type}* nodep) {\n",
|
||||
" nodep->lhsp()->iterateAndNext(*this);\n",
|
||||
" iterateAndNextNull(nodep->lhsp());\n",
|
||||
@out_for_type_sc);
|
||||
$self->print(" nodep->rhsp()->iterateAndNext(*this);\n",
|
||||
$self->print(" iterateAndNextNull(nodep->rhsp());\n",
|
||||
" AstNodeTriop *tnp = VN_CAST(nodep, NodeTriop);\n",
|
||||
" if (tnp && tnp->thsp()) tnp->thsp()->iterateAndNext(*this);\n",
|
||||
" if (tnp && tnp->thsp()) iterateAndNextNull(tnp->thsp());\n",
|
||||
@out_for_type,
|
||||
" }\n") if ($out_for_type[0]);
|
||||
} elsif ($out_for_type[0]) { # Other types with something to print
|
||||
|
|
@ -631,7 +631,7 @@ sub tree_base {
|
|||
$self->print(" // Generated by astgen\n",
|
||||
" virtual void visit$gen(Ast${type}* nodep) {\n",
|
||||
($skip?"":
|
||||
" nodep->iterateChildren(*this);\n"),
|
||||
" iterateChildren(nodep);\n"),
|
||||
@out_for_type,
|
||||
" }\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue