Internals: clang-format cleanups for V3Inline. No functional change.
This commit is contained in:
parent
5d9d1cc09f
commit
92d62a6568
183
src/V3Inline.cpp
183
src/V3Inline.cpp
|
|
@ -58,19 +58,21 @@ private:
|
|||
// AstNodeModule::user2() // CIL_*. Allowed to automatically inline module
|
||||
// AstNodeModule::user3() // int. Number of cells referencing this module
|
||||
// AstNodeModule::user4() // int. Statements in module
|
||||
AstUser2InUse m_inuser2;
|
||||
AstUser3InUse m_inuser3;
|
||||
AstUser4InUse m_inuser4;
|
||||
AstUser2InUse m_inuser2;
|
||||
AstUser3InUse m_inuser3;
|
||||
AstUser4InUse m_inuser4;
|
||||
|
||||
// For the user2 field:
|
||||
enum {CIL_NOTHARD=0, // Inline not supported
|
||||
CIL_NOTSOFT, // Don't inline unless user overrides
|
||||
CIL_MAYBE, // Might inline
|
||||
CIL_USER}; // Pragma suggests inlining
|
||||
enum {
|
||||
CIL_NOTHARD = 0, // Inline not supported
|
||||
CIL_NOTSOFT, // Don't inline unless user overrides
|
||||
CIL_MAYBE, // Might inline
|
||||
CIL_USER
|
||||
}; // Pragma suggests inlining
|
||||
|
||||
// STATE
|
||||
AstNodeModule* m_modp; // Current module
|
||||
VDouble0 m_statUnsup; // Statistic tracking
|
||||
AstNodeModule* m_modp; // Current module
|
||||
VDouble0 m_statUnsup; // Statistic tracking
|
||||
|
||||
typedef std::vector<AstNodeModule*> ModVec;
|
||||
ModVec m_allMods; // All modules, in top-down order.
|
||||
|
|
@ -87,13 +89,13 @@ private:
|
|||
void cantInline(const char* reason, bool hard) {
|
||||
if (hard) {
|
||||
if (m_modp->user2() != CIL_NOTHARD) {
|
||||
UINFO(4," No inline hard: "<<reason<<" "<<m_modp<<endl);
|
||||
UINFO(4, " No inline hard: " << reason << " " << m_modp << endl);
|
||||
m_modp->user2(CIL_NOTHARD);
|
||||
++m_statUnsup;
|
||||
}
|
||||
} else {
|
||||
if (m_modp->user2() == CIL_MAYBE) {
|
||||
UINFO(4," No inline soft: "<<reason<<" "<<m_modp<<endl);
|
||||
UINFO(4, " No inline soft: " << reason << " " << m_modp << endl);
|
||||
m_modp->user2(CIL_NOTSOFT);
|
||||
}
|
||||
}
|
||||
|
|
@ -123,7 +125,7 @@ private:
|
|||
}
|
||||
virtual void visit(AstPragma* nodep) VL_OVERRIDE {
|
||||
if (nodep->pragType() == AstPragmaType::INLINE_MODULE) {
|
||||
//UINFO(0,"PRAG MARK "<<m_modp<<endl);
|
||||
// UINFO(0,"PRAG MARK "<<m_modp<<endl);
|
||||
if (!m_modp) {
|
||||
nodep->v3error("Inline pragma not under a module"); // LCOV_EXCL_LINE
|
||||
} else if (m_modp->user2() == CIL_MAYBE
|
||||
|
|
@ -172,7 +174,7 @@ private:
|
|||
|
||||
// Iterate through all modules in bottom-up order.
|
||||
// Make a final inlining decision for each.
|
||||
for (ModVec::reverse_iterator it=m_allMods.rbegin(); it!=m_allMods.rend(); ++it) {
|
||||
for (ModVec::reverse_iterator it = m_allMods.rbegin(); it != m_allMods.rend(); ++it) {
|
||||
AstNodeModule* modp = *it;
|
||||
|
||||
// If we're going to inline some modules into this one,
|
||||
|
|
@ -195,14 +197,14 @@ private:
|
|||
// If a mod*#refs is < this # nodes, can inline it
|
||||
bool doit = ((allowed == CIL_USER)
|
||||
|| ((allowed == CIL_MAYBE)
|
||||
&& (refs==1
|
||||
&& (refs == 1
|
||||
|| statements < INLINE_MODS_SMALLER
|
||||
|| v3Global.opt.inlineMult() < 1
|
||||
|| refs*statements < v3Global.opt.inlineMult())));
|
||||
|| refs * statements < v3Global.opt.inlineMult())));
|
||||
// Packages aren't really "under" anything so they confuse this algorithm
|
||||
if (VN_IS(modp, Package)) doit = false;
|
||||
UINFO(4, " Inline="<<doit<<" Possible="<<allowed
|
||||
<<" Refs="<<refs<<" Stmts="<<statements<<" "<<modp<<endl);
|
||||
UINFO(4, " Inline=" << doit << " Possible=" << allowed << " Refs=" << refs
|
||||
<< " Stmts=" << statements << " " << modp << endl);
|
||||
modp->user1(doit);
|
||||
}
|
||||
}
|
||||
|
|
@ -250,9 +252,7 @@ private:
|
|||
// Accelerate
|
||||
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {}
|
||||
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -274,9 +274,9 @@ private:
|
|||
// See InlineVisitor
|
||||
|
||||
// STATE
|
||||
StringSet m_renamedInterfaces; // Name of renamed interface variables
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCell* m_cellp; // Cell being cloned
|
||||
StringSet m_renamedInterfaces; // Name of renamed interface variables
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCell* m_cellp; // Cell being cloned
|
||||
|
||||
// METHODS
|
||||
VL_DEBUG_FUNC; // Declare debug()
|
||||
|
|
@ -289,7 +289,7 @@ private:
|
|||
// Rename
|
||||
string name = m_cellp->name() + "__DOT__" + nodep->name();
|
||||
nodep->name(name);
|
||||
UINFO(6, " Inline "<<nodep<<endl);
|
||||
UINFO(6, " Inline " << nodep << endl);
|
||||
// Do CellInlines under this, but don't move them
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
|
@ -307,9 +307,9 @@ private:
|
|||
if (nodep->user2p()) {
|
||||
// Make an assignment, so we'll trace it properly
|
||||
// user2p is either a const or a var.
|
||||
AstConst* exprconstp = VN_CAST(nodep->user2p(), Const);
|
||||
AstConst* exprconstp = VN_CAST(nodep->user2p(), Const);
|
||||
AstVarRef* exprvarrefp = VN_CAST(nodep->user2p(), VarRef);
|
||||
UINFO(8,"connectto: "<<nodep->user2p()<<endl);
|
||||
UINFO(8, "connectto: " << nodep->user2p() << endl);
|
||||
UASSERT_OBJ(exprconstp || exprvarrefp, nodep,
|
||||
"Unknown interconnect type; pinReconnectSimple should have cleared up");
|
||||
if (exprconstp) {
|
||||
|
|
@ -320,7 +320,7 @@ private:
|
|||
// Public variable at the lower module end - we need to make sure we propagate
|
||||
// the logic changes up and down; if we aliased, we might
|
||||
// remove the change detection on the output variable.
|
||||
UINFO(9,"public pin assign: "<<exprvarrefp<<endl);
|
||||
UINFO(9, "public pin assign: " << exprvarrefp << endl);
|
||||
UASSERT_OBJ(!nodep->isNonOutput(), nodep, "Outputs only - inputs use AssignAlias");
|
||||
m_modp->addStmtp(
|
||||
new AstAssignW(nodep->fileline(),
|
||||
|
|
@ -330,7 +330,7 @@ private:
|
|||
// Public variable at this end and it is an unpacked array. We need to assign
|
||||
// instead of aliased, because otherwise it will pass V3Slice and invalid
|
||||
// code will be emitted.
|
||||
UINFO(9,"assign to public and unpacked: "<<nodep<<endl);
|
||||
UINFO(9, "assign to public and unpacked: " << nodep << endl);
|
||||
m_modp->addStmtp(
|
||||
new AstAssignW(nodep->fileline(),
|
||||
new AstVarRef(nodep->fileline(), exprvarrefp->varp(), true),
|
||||
|
|
@ -342,8 +342,8 @@ private:
|
|||
new AstVarRef(nodep->fileline(),
|
||||
exprvarrefp->varp(), false)));
|
||||
AstNode* nodebp = exprvarrefp->varp();
|
||||
nodep ->fileline()->modifyStateInherit(nodebp->fileline());
|
||||
nodebp->fileline()->modifyStateInherit(nodep ->fileline());
|
||||
nodep->fileline()->modifyStateInherit(nodebp->fileline());
|
||||
nodebp->fileline()->modifyStateInherit(nodep->fileline());
|
||||
} else {
|
||||
// Do to inlining child's variable now within the same
|
||||
// module, so a AstVarRef not AstVarXRef below
|
||||
|
|
@ -353,8 +353,8 @@ private:
|
|||
new AstVarRef(nodep->fileline(),
|
||||
exprvarrefp->varp(), false)));
|
||||
AstNode* nodebp = exprvarrefp->varp();
|
||||
nodep ->fileline()->modifyStateInherit(nodebp->fileline());
|
||||
nodebp->fileline()->modifyStateInherit(nodep ->fileline());
|
||||
nodep->fileline()->modifyStateInherit(nodebp->fileline());
|
||||
nodebp->fileline()->modifyStateInherit(nodep->fileline());
|
||||
}
|
||||
}
|
||||
// Iterate won't hit AstIfaceRefDType directly as it is no longer underneath the module
|
||||
|
|
@ -383,8 +383,8 @@ private:
|
|||
string name = m_cellp->name() + "__DOT__" + nodep->name();
|
||||
if (!nodep->isFuncLocal()) nodep->inlineAttrReset(name);
|
||||
if (!m_cellp->isTrace()) nodep->trace(false);
|
||||
if (debug()>=9) { nodep->dumpTree(cout, "varchanged:"); }
|
||||
if (debug()>=9 && nodep->valuep()) { nodep->valuep()->dumpTree(cout, "varchangei:"); }
|
||||
if (debug() >= 9) { nodep->dumpTree(cout, "varchanged:"); }
|
||||
if (debug() >= 9 && nodep->valuep()) { nodep->valuep()->dumpTree(cout, "varchangei:"); }
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
|
||||
|
|
@ -401,17 +401,15 @@ private:
|
|||
if (nodep->varp()->user2p() // It's being converted to an alias.
|
||||
&& !nodep->varp()->user3()
|
||||
&& !VN_IS(nodep->backp(), AssignAlias)) { // Don't constant propagate aliases (we just made)
|
||||
AstConst* exprconstp = VN_CAST(nodep->varp()->user2p(), Const);
|
||||
AstConst* exprconstp = VN_CAST(nodep->varp()->user2p(), Const);
|
||||
AstVarRef* exprvarrefp = VN_CAST(nodep->varp()->user2p(), VarRef);
|
||||
if (exprconstp) {
|
||||
nodep->replaceWith(exprconstp->cloneTree(true));
|
||||
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||
return;
|
||||
}
|
||||
else if (exprvarrefp) {
|
||||
nodep->varp( exprvarrefp->varp() );
|
||||
}
|
||||
else {
|
||||
} else if (exprvarrefp) {
|
||||
nodep->varp(exprvarrefp->varp());
|
||||
} else {
|
||||
nodep->v3fatalSrc("Null connection?");
|
||||
}
|
||||
}
|
||||
|
|
@ -429,7 +427,7 @@ private:
|
|||
}
|
||||
// If foo.bar, and foo is an interface, then need to search again for foo
|
||||
string::size_type pos = tryname.rfind('.');
|
||||
if (pos == string::npos || pos==0) {
|
||||
if (pos == string::npos || pos == 0) {
|
||||
break;
|
||||
} else {
|
||||
tryname = tryname.substr(0, pos);
|
||||
|
|
@ -444,12 +442,12 @@ private:
|
|||
if (m_renamedInterfaces.count(nodep->dotted())) {
|
||||
nodep->dotted(m_cellp->name() + "__DOT__" + nodep->dotted());
|
||||
}
|
||||
UINFO(8," "<<nodep<<endl);
|
||||
UINFO(8, " " << nodep << endl);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
// Not needed, as V3LinkDot doesn't care about typedefs
|
||||
//virtual void visit(AstRefDType* nodep) VL_OVERRIDE {}
|
||||
// virtual void visit(AstRefDType* nodep) VL_OVERRIDE {}
|
||||
|
||||
virtual void visit(AstScopeName* nodep) VL_OVERRIDE {
|
||||
// If there's a %m in the display text, we add a special node that will contain the name()
|
||||
|
|
@ -457,11 +455,11 @@ private:
|
|||
// To keep correct visual order, must add before other Text's
|
||||
AstNode* afterp = nodep->scopeAttrp();
|
||||
if (afterp) afterp->unlinkFrBackWithNext();
|
||||
nodep->scopeAttrp(new AstText(nodep->fileline(), string("__DOT__")+m_cellp->name()));
|
||||
nodep->scopeAttrp(new AstText(nodep->fileline(), string("__DOT__") + m_cellp->name()));
|
||||
if (afterp) nodep->scopeAttrp(afterp);
|
||||
afterp = nodep->scopeEntrp();
|
||||
if (afterp) afterp->unlinkFrBackWithNext();
|
||||
nodep->scopeEntrp(new AstText(nodep->fileline(), string("__DOT__")+m_cellp->name()));
|
||||
nodep->scopeEntrp(new AstText(nodep->fileline(), string("__DOT__") + m_cellp->name()));
|
||||
if (afterp) nodep->scopeEntrp(afterp);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
|
@ -470,9 +468,7 @@ private:
|
|||
nodep->hier(VString::dot(m_cellp->prettyName(), ".", nodep->hier()));
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -494,21 +490,21 @@ private:
|
|||
// AstIfaceRefDType::user5p() // Whether the cell pointed to by this
|
||||
// // AstIfaceRefDType has been inlined
|
||||
// Input:
|
||||
// AstNodeModule::user1p() // bool. True to inline this module (from InlineMarkVisitor)
|
||||
// AstNodeModule::user1p() // bool. True to inline this module (from InlineMarkVisitor)
|
||||
// Cleared each cell
|
||||
// AstVar::user2p() // AstVarRef*/AstConst* Points to signal this
|
||||
// // is a direct connect to
|
||||
// AstVar::user3() // bool Don't alias the user2, keep it as signal
|
||||
// AstCell::user4 // AstCell* of the created clone
|
||||
|
||||
AstUser2InUse m_inuser2;
|
||||
AstUser3InUse m_inuser3;
|
||||
AstUser4InUse m_inuser4;
|
||||
AstUser5InUse m_inuser5;
|
||||
AstUser2InUse m_inuser2;
|
||||
AstUser3InUse m_inuser3;
|
||||
AstUser4InUse m_inuser4;
|
||||
AstUser5InUse m_inuser5;
|
||||
|
||||
// STATE
|
||||
AstNodeModule* m_modp; // Current module
|
||||
VDouble0 m_statCells; // Statistic tracking
|
||||
AstNodeModule* m_modp; // Current module
|
||||
VDouble0 m_statCells; // Statistic tracking
|
||||
|
||||
// METHODS
|
||||
VL_DEBUG_FUNC; // Declare debug()
|
||||
|
|
@ -536,36 +532,36 @@ private:
|
|||
}
|
||||
virtual void visit(AstCell* nodep) VL_OVERRIDE {
|
||||
if (nodep->modp()->user1()) { // Marked with inline request
|
||||
UINFO(5," Inline CELL "<<nodep<<endl);
|
||||
UINFO(5," To MOD "<<m_modp<<endl);
|
||||
UINFO(5, " Inline CELL " << nodep << endl);
|
||||
UINFO(5, " To MOD " << m_modp << endl);
|
||||
++m_statCells;
|
||||
|
||||
// Before cloning simplify pin assignments
|
||||
// Better off before, as if module has multiple instantiations
|
||||
// we'll save work, and we can't call pinReconnectSimple in
|
||||
// this loop as it clone()s itself.
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp=VN_CAST(pinp->nextp(), Pin)) {
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp = VN_CAST(pinp->nextp(), Pin)) {
|
||||
if (!pinp->exprp()) continue;
|
||||
V3Inst::pinReconnectSimple(pinp, nodep, false);
|
||||
}
|
||||
|
||||
// Clone original module
|
||||
if (debug()>=9) { nodep->dumpTree(cout, "inlcell:"); }
|
||||
//if (debug()>=9) { nodep->modp()->dumpTree(cout,"oldmod:"); }
|
||||
if (debug() >= 9) { nodep->dumpTree(cout, "inlcell:"); }
|
||||
// if (debug()>=9) { nodep->modp()->dumpTree(cout,"oldmod:"); }
|
||||
AstNodeModule* newmodp = nodep->modp()->cloneTree(false);
|
||||
if (debug()>=9) { newmodp->dumpTree(cout, "newmod:"); }
|
||||
if (debug() >= 9) { newmodp->dumpTree(cout, "newmod:"); }
|
||||
// Clear var markings and find cell cross references
|
||||
AstNode::user2ClearTree();
|
||||
AstNode::user4ClearTree();
|
||||
{ InlineCollectVisitor(nodep->modp()); } // {} to destroy visitor immediately
|
||||
// Create data for dotted variable resolution
|
||||
AstCellInline* inlinep = new AstCellInline(nodep->fileline(),
|
||||
nodep->name(), nodep->modp()->origName());
|
||||
AstCellInline* inlinep
|
||||
= new AstCellInline(nodep->fileline(), nodep->name(), nodep->modp()->origName());
|
||||
m_modp->addInlinesp(inlinep); // Must be parsed before any AstCells
|
||||
// Create assignments to the pins
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp=VN_CAST(pinp->nextp(), Pin)) {
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp = VN_CAST(pinp->nextp(), Pin)) {
|
||||
if (!pinp->exprp()) continue;
|
||||
UINFO(6," Pin change from "<<pinp->modVarp()<<endl);
|
||||
UINFO(6, " Pin change from " << pinp->modVarp() << endl);
|
||||
// Make new signal; even though we'll optimize the interconnect, we
|
||||
// need an alias to trace correctly. If tracing is disabled, we'll
|
||||
// delete it in later optimizations.
|
||||
|
|
@ -587,20 +583,20 @@ private:
|
|||
// One to one interconnect won't make a temporary variable.
|
||||
// This prevents creating a lot of extra wires for clock signals.
|
||||
// It will become a tracing alias.
|
||||
UINFO(6,"One-to-one "<<connectRefp<<endl);
|
||||
UINFO(6," -to "<<pinNewVarp<<endl);
|
||||
UINFO(6, "One-to-one " << connectRefp << endl);
|
||||
UINFO(6, " -to " << pinNewVarp << endl);
|
||||
pinNewVarp->user2p(connectRefp);
|
||||
// Public output inside the cell must go via an assign rather
|
||||
// than alias. Else the public logic will set the alias, losing
|
||||
// the value to be propagated up (InOnly isn't a problem as the
|
||||
// AssignAlias will create the assignment for us)
|
||||
pinNewVarp->user3(pinNewVarp->isSigUserRWPublic()
|
||||
&& pinNewVarp->direction()==VDirection::OUTPUT);
|
||||
&& pinNewVarp->direction() == VDirection::OUTPUT);
|
||||
}
|
||||
// Cleanup var names, etc, to not conflict
|
||||
{ InlineRelinkVisitor(newmodp, m_modp, nodep); }
|
||||
// Move statements to top module
|
||||
if (debug()>=9) { newmodp->dumpTree(cout, "fixmod:"); }
|
||||
if (debug() >= 9) { newmodp->dumpTree(cout, "fixmod:"); }
|
||||
AstNode* stmtsp = newmodp->stmtsp();
|
||||
if (stmtsp) stmtsp->unlinkFrBackWithNext();
|
||||
if (stmtsp) m_modp->addStmtp(stmtsp);
|
||||
|
|
@ -608,16 +604,14 @@ private:
|
|||
VL_DO_DANGLING(newmodp->deleteTree(), newmodp); // Clear any leftover ports, etc
|
||||
nodep->unlinkFrBack();
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
if (debug()>=9) { m_modp->dumpTree(cout, "donemod:"); }
|
||||
if (debug() >= 9) { m_modp->dumpTree(cout, "donemod:"); }
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------
|
||||
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {} // Accelerate
|
||||
virtual void visit(AstNodeStmt* nodep) VL_OVERRIDE {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
|
@ -646,16 +640,10 @@ private:
|
|||
VL_DEBUG_FUNC; // Declare debug()
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) VL_OVERRIDE {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
|
||||
virtual void visit(AstNetlist* nodep) VL_OVERRIDE { iterateChildren(nodep); }
|
||||
virtual void visit(AstModule* nodep) VL_OVERRIDE {
|
||||
if (nodep->isTop()) {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
if (nodep->isTop()) { iterateChildren(nodep); }
|
||||
}
|
||||
|
||||
virtual void visit(AstCell* nodep) VL_OVERRIDE {
|
||||
string oldScope = m_scope;
|
||||
if (m_scope.empty()) {
|
||||
|
|
@ -666,7 +654,7 @@ private:
|
|||
|
||||
if (AstModule* modp = VN_CAST(nodep->modp(), Module)) {
|
||||
// Pass Cell pointers down to the next module
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp=VN_CAST(pinp->nextp(), Pin)) {
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp = VN_CAST(pinp->nextp(), Pin)) {
|
||||
AstVar* varp = pinp->modVarp();
|
||||
AstVarRef* varrefp = VN_CAST(pinp->exprp(), VarRef);
|
||||
if (!varrefp) continue;
|
||||
|
|
@ -691,7 +679,6 @@ private:
|
|||
|
||||
m_scope = oldScope;
|
||||
}
|
||||
|
||||
virtual void visit(AstAssignVarScope* nodep) VL_OVERRIDE {
|
||||
// Reference
|
||||
AstVarRef* reflp = VN_CAST(nodep->lhsp(), VarRef);
|
||||
|
|
@ -716,49 +703,37 @@ private:
|
|||
alias += varlp->name();
|
||||
cellp->addIntfRefp(new AstIntfRef(varlp->fileline(), alias));
|
||||
}
|
||||
|
||||
//--------------------
|
||||
virtual void visit(AstNodeMath*) VL_OVERRIDE {} // Accelerate
|
||||
virtual void visit(AstNodeStmt*) VL_OVERRIDE {} // Accelerate
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit InlineIntfRefVisitor(AstNode* nodep) {
|
||||
iterate(nodep);
|
||||
}
|
||||
virtual ~InlineIntfRefVisitor() {
|
||||
}
|
||||
explicit InlineIntfRefVisitor(AstNode* nodep) { iterate(nodep); }
|
||||
virtual ~InlineIntfRefVisitor() {}
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
// Inline class functions
|
||||
|
||||
void V3Inline::inlineAll(AstNetlist* nodep) {
|
||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||
UINFO(2, __FUNCTION__ << ": " << endl);
|
||||
AstUser1InUse m_inuser1; // output of InlineMarkVisitor,
|
||||
// input to InlineVisitor.
|
||||
{
|
||||
// Scoped to clean up temp userN's
|
||||
InlineMarkVisitor mvisitor (nodep);
|
||||
}
|
||||
{
|
||||
InlineVisitor visitor (nodep);
|
||||
}
|
||||
// Scoped to clean up temp userN's
|
||||
{ InlineMarkVisitor mvisitor(nodep); }
|
||||
{ InlineVisitor visitor(nodep); }
|
||||
// Remove all modules that were inlined
|
||||
// V3Dead will also clean them up, but if we have debug on, it's a good
|
||||
// idea to avoid dumping the hugely exploded tree.
|
||||
AstNodeModule* nextmodp;
|
||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp = nextmodp) {
|
||||
nextmodp = VN_CAST(modp->nextp(), NodeModule);
|
||||
if (modp->user1()) { // Was inlined
|
||||
VL_DO_DANGLING(modp->unlinkFrBack()->deleteTree(), modp);
|
||||
}
|
||||
}
|
||||
{
|
||||
InlineIntfRefVisitor crvisitor (nodep);
|
||||
}
|
||||
{ InlineIntfRefVisitor crvisitor(nodep); }
|
||||
V3Global::dumpCheckGlobalTree("inline", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue