Internals: Create user#Inc routines
This commit is contained in:
parent
10689ffaba
commit
930cbeec17
|
|
@ -177,8 +177,7 @@ private:
|
||||||
// VISITORS //========== Case assertions
|
// VISITORS //========== Case assertions
|
||||||
virtual void visit(AstCase* nodep, AstNUser*) {
|
virtual void visit(AstCase* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) {
|
||||||
nodep->user1(true);
|
|
||||||
bool has_default=false;
|
bool has_default=false;
|
||||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
||||||
if (itemp->isDefault()) has_default=true;
|
if (itemp->isDefault()) has_default=true;
|
||||||
|
|
|
||||||
|
|
@ -822,6 +822,7 @@ public:
|
||||||
void user1p(void* userp) { m_user1p=(AstNUser*)(userp); m_user1Cnt=AstUser1InUse::s_userCntGbl; }
|
void user1p(void* userp) { m_user1p=(AstNUser*)(userp); m_user1Cnt=AstUser1InUse::s_userCntGbl; }
|
||||||
int user1() const { return user1p()->castInt(); }
|
int user1() const { return user1p()->castInt(); }
|
||||||
void user1(int val) { user1p(AstNUser::fromInt(val)); }
|
void user1(int val) { user1p(AstNUser::fromInt(val)); }
|
||||||
|
int user1Inc() { int v=user1(); user1(v+1); return v; }
|
||||||
static void user1ClearTree() { AstUser1InUse::clear(); } // Clear userp()'s across the entire tree
|
static void user1ClearTree() { AstUser1InUse::clear(); } // Clear userp()'s across the entire tree
|
||||||
|
|
||||||
AstNUser* user2p() const {
|
AstNUser* user2p() const {
|
||||||
|
|
@ -830,6 +831,7 @@ public:
|
||||||
void user2p(void* userp) { m_user2p=(AstNUser*)(userp); m_user2Cnt=AstUser2InUse::s_userCntGbl; }
|
void user2p(void* userp) { m_user2p=(AstNUser*)(userp); m_user2Cnt=AstUser2InUse::s_userCntGbl; }
|
||||||
int user2() const { return user2p()->castInt(); }
|
int user2() const { return user2p()->castInt(); }
|
||||||
void user2(int val) { user2p(AstNUser::fromInt(val)); }
|
void user2(int val) { user2p(AstNUser::fromInt(val)); }
|
||||||
|
int user2Inc() { int v=user2(); user2(v+1); return v; }
|
||||||
static void user2ClearTree() { AstUser2InUse::clear(); }
|
static void user2ClearTree() { AstUser2InUse::clear(); }
|
||||||
|
|
||||||
AstNUser* user3p() const {
|
AstNUser* user3p() const {
|
||||||
|
|
@ -838,6 +840,7 @@ public:
|
||||||
void user3p(void* userp) { m_user3p=(AstNUser*)(userp); m_user3Cnt=AstUser3InUse::s_userCntGbl; }
|
void user3p(void* userp) { m_user3p=(AstNUser*)(userp); m_user3Cnt=AstUser3InUse::s_userCntGbl; }
|
||||||
int user3() const { return user3p()->castInt(); }
|
int user3() const { return user3p()->castInt(); }
|
||||||
void user3(int val) { user3p(AstNUser::fromInt(val)); }
|
void user3(int val) { user3p(AstNUser::fromInt(val)); }
|
||||||
|
int user3Inc() { int v=user3(); user3(v+1); return v; }
|
||||||
static void user3ClearTree() { AstUser3InUse::clear(); }
|
static void user3ClearTree() { AstUser3InUse::clear(); }
|
||||||
|
|
||||||
AstNUser* user4p() const {
|
AstNUser* user4p() const {
|
||||||
|
|
@ -846,6 +849,7 @@ public:
|
||||||
void user4p(void* userp) { m_user4p=(AstNUser*)(userp); m_user4Cnt=AstUser4InUse::s_userCntGbl; }
|
void user4p(void* userp) { m_user4p=(AstNUser*)(userp); m_user4Cnt=AstUser4InUse::s_userCntGbl; }
|
||||||
int user4() const { return user4p()->castInt(); }
|
int user4() const { return user4p()->castInt(); }
|
||||||
void user4(int val) { user4p(AstNUser::fromInt(val)); }
|
void user4(int val) { user4p(AstNUser::fromInt(val)); }
|
||||||
|
int user4Inc() { int v=user4(); user4(v+1); return v; }
|
||||||
static void user4ClearTree() { AstUser4InUse::clear(); }
|
static void user4ClearTree() { AstUser4InUse::clear(); }
|
||||||
|
|
||||||
AstNUser* user5p() const {
|
AstNUser* user5p() const {
|
||||||
|
|
@ -854,6 +858,7 @@ public:
|
||||||
void user5p(void* userp) { m_user5p=(AstNUser*)(userp); m_user5Cnt=AstUser5InUse::s_userCntGbl; }
|
void user5p(void* userp) { m_user5p=(AstNUser*)(userp); m_user5Cnt=AstUser5InUse::s_userCntGbl; }
|
||||||
int user5() const { return user5p()->castInt(); }
|
int user5() const { return user5p()->castInt(); }
|
||||||
void user5(int val) { user5p(AstNUser::fromInt(val)); }
|
void user5(int val) { user5p(AstNUser::fromInt(val)); }
|
||||||
|
int user5Inc() { int v=user5(); user5(v+1); return v; }
|
||||||
static void user5ClearTree() { AstUser5InUse::clear(); }
|
static void user5ClearTree() { AstUser5InUse::clear(); }
|
||||||
|
|
||||||
vluint64_t editCount() const { return m_editCount; }
|
vluint64_t editCount() const { return m_editCount; }
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,7 @@ private:
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
||||||
if (nodep->isCircular()) {
|
if (nodep->isCircular()) {
|
||||||
UINFO(8," CIRC "<<nodep<<endl);
|
UINFO(8," CIRC "<<nodep<<endl);
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) {
|
||||||
nodep->user1(true);
|
|
||||||
genChangeDet(nodep);
|
genChangeDet(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -704,8 +704,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep, AstNUser*) {
|
||||||
if (debug()>=9) cout<<endl<<endl<<endl;
|
if (debug()>=9) cout<<endl<<endl<<endl;
|
||||||
UINFO(5, "Gater: ALWAYS: "<<nodep<<endl);
|
UINFO(5, "Gater: ALWAYS: "<<nodep<<endl);
|
||||||
if (nodep->user4()) return;
|
if (nodep->user4Inc()) return;
|
||||||
nodep->user4(1);
|
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,31 +95,31 @@ private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->modp()->user1(nodep->modp()->user1() + 1);
|
nodep->modp()->user1Inc();
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->varScopep()) {
|
if (nodep->varScopep()) {
|
||||||
nodep->varScopep()->user1(nodep->varScopep()->user1() + 1);
|
nodep->varScopep()->user1Inc();
|
||||||
nodep->varScopep()->varp()->user1(nodep->varScopep()->varp()->user1() + 1);
|
nodep->varScopep()->varp()->user1Inc();
|
||||||
}
|
}
|
||||||
if (nodep->varp()) {
|
if (nodep->varp()) {
|
||||||
nodep->varp()->user1(nodep->varp()->user1() + 1);
|
nodep->varp()->user1Inc();
|
||||||
}
|
}
|
||||||
if (nodep->packagep()) {
|
if (nodep->packagep()) {
|
||||||
nodep->packagep()->user1(nodep->packagep()->user1() + 1);
|
nodep->packagep()->user1Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->packagep()) {
|
if (nodep->packagep()) {
|
||||||
nodep->packagep()->user1(nodep->packagep()->user1() + 1);
|
nodep->packagep()->user1Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRefDType* nodep, AstNUser*) {
|
virtual void visit(AstRefDType* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->packagep()) {
|
if (nodep->packagep()) {
|
||||||
nodep->packagep()->user1(nodep->packagep()->user1() + 1);
|
nodep->packagep()->user1Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ private:
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep, AstNUser*) {
|
||||||
nodep->modp()->user3( nodep->modp()->user3() + 1);
|
nodep->modp()->user3Inc();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPragma* nodep, AstNUser*) {
|
virtual void visit(AstPragma* nodep, AstNUser*) {
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,7 @@ private:
|
||||||
if (nodep->modVarp()->isOutOnly() && nodep->exprp()->castConst())
|
if (nodep->modVarp()->isOutOnly() && nodep->exprp()->castConst())
|
||||||
nodep->v3error("Output port is connected to a constant pin, electrical short");
|
nodep->v3error("Output port is connected to a constant pin, electrical short");
|
||||||
// Use user1p on the PIN to indicate we created an assign for this pin
|
// Use user1p on the PIN to indicate we created an assign for this pin
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) {
|
||||||
nodep->user1(1);
|
|
||||||
// Simplify it
|
// Simplify it
|
||||||
V3Inst::pinReconnectSimple(nodep, m_cellp, m_modp);
|
V3Inst::pinReconnectSimple(nodep, m_cellp, m_modp);
|
||||||
// Make a ASSIGNW (expr, pin)
|
// Make a ASSIGNW (expr, pin)
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,7 @@ private:
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) { // Process only once.
|
||||||
nodep->user1(true); // Process only once.
|
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
checkExpected(nodep);
|
checkExpected(nodep);
|
||||||
// Due to a need to get the arguments, the ParseRefs are under here,
|
// Due to a need to get the arguments, the ParseRefs are under here,
|
||||||
|
|
@ -165,8 +164,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelBit* nodep, AstNUser*) {
|
virtual void visit(AstSelBit* nodep, AstNUser*) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) { // Process only once.
|
||||||
nodep->user1(true); // Process only once.
|
|
||||||
if (m_inModDot) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
if (m_inModDot) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
||||||
m_dotText = "";
|
m_dotText = "";
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
|
|
@ -194,8 +192,7 @@ private:
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodePreSel* nodep, AstNUser*) {
|
virtual void visit(AstNodePreSel* nodep, AstNUser*) {
|
||||||
// Excludes simple AstSel, see above
|
// Excludes simple AstSel, see above
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) { // Process only once.
|
||||||
nodep->user1(true); // Process only once.
|
|
||||||
if (m_inModDot) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
if (m_inModDot) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
||||||
nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed in the cell part of a dotted reference");
|
nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed in the cell part of a dotted reference");
|
||||||
} else if (m_exp==AstParseRefExp::PX_FUNC) {
|
} else if (m_exp==AstParseRefExp::PX_FUNC) {
|
||||||
|
|
@ -217,8 +214,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep, AstNUser*) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) { // Process only once.
|
||||||
nodep->user1(true); // Process only once.
|
|
||||||
if (m_exp != AstParseRefExp::PX_NONE) {
|
if (m_exp != AstParseRefExp::PX_NONE) {
|
||||||
UINFO(7," "<<nodep<<endl);
|
UINFO(7," "<<nodep<<endl);
|
||||||
if (m_inModDot) { // Dotted part, just pass up
|
if (m_inModDot) { // Dotted part, just pass up
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep, AstNUser*) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) {
|
||||||
nodep->user1(1);
|
|
||||||
if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this);
|
if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this);
|
||||||
if (nodep->aboveCellp()) nodep->aboveCellp()->iterate(*this);
|
if (nodep->aboveCellp()) nodep->aboveCellp()->iterate(*this);
|
||||||
// Always recompute name (as many level above scope may have changed)
|
// Always recompute name (as many level above scope may have changed)
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@ private:
|
||||||
OrderLoopId processMoveLoopCurrent();
|
OrderLoopId processMoveLoopCurrent();
|
||||||
|
|
||||||
string cfuncName(AstNodeModule* modp, AstSenTree* domainp, AstScope* scopep, AstNode* forWhatp) {
|
string cfuncName(AstNodeModule* modp, AstSenTree* domainp, AstScope* scopep, AstNode* forWhatp) {
|
||||||
modp->user3(1+modp->user3());
|
modp->user3Inc();
|
||||||
int funcnum = modp->user3();
|
int funcnum = modp->user3();
|
||||||
string name = (domainp->hasCombo() ? "_combo"
|
string name = (domainp->hasCombo() ? "_combo"
|
||||||
: (domainp->hasInitial() ? "_initial"
|
: (domainp->hasInitial() ? "_initial"
|
||||||
|
|
|
||||||
|
|
@ -196,9 +196,8 @@ private:
|
||||||
}
|
}
|
||||||
void visitShift (AstNodeBiop* nodep) {
|
void visitShift (AstNodeBiop* nodep) {
|
||||||
// Shifts of > 32/64 bits in C++ will wrap-around and generate non-0s
|
// Shifts of > 32/64 bits in C++ will wrap-around and generate non-0s
|
||||||
if (!nodep->user2()) {
|
if (!nodep->user2Inc()) {
|
||||||
UINFO(4," ShiftFix "<<nodep<<endl);
|
UINFO(4," ShiftFix "<<nodep<<endl);
|
||||||
nodep->user2(true);
|
|
||||||
if (nodep->widthMin()<=64 // Else we'll use large operators which work right
|
if (nodep->widthMin()<=64 // Else we'll use large operators which work right
|
||||||
// C operator's width must be < maximum shift which is based on Verilog width
|
// C operator's width must be < maximum shift which is based on Verilog width
|
||||||
&& nodep->width() < (1LL<<nodep->rhsp()->widthMin())) {
|
&& nodep->width() < (1LL<<nodep->rhsp()->widthMin())) {
|
||||||
|
|
|
||||||
|
|
@ -1066,10 +1066,8 @@ private:
|
||||||
AstNode* prevInsStmtp = m_insStmtp;
|
AstNode* prevInsStmtp = m_insStmtp;
|
||||||
m_insMode = IM_BEFORE;
|
m_insMode = IM_BEFORE;
|
||||||
m_insStmtp = nodep->stmtsp(); // Might be null if no statements, but we won't use it
|
m_insStmtp = nodep->stmtsp(); // Might be null if no statements, but we won't use it
|
||||||
if (!nodep->user1()) { // Just one creation needed per function
|
if (!nodep->user1Inc()) { // Just one creation needed per function
|
||||||
// Expand functions in it
|
// Expand functions in it
|
||||||
nodep->user1(true);
|
|
||||||
|
|
||||||
int modes = 0;
|
int modes = 0;
|
||||||
if (nodep->dpiImport()) modes++;
|
if (nodep->dpiImport()) modes++;
|
||||||
if (nodep->dpiExport()) modes++;
|
if (nodep->dpiExport()) modes++;
|
||||||
|
|
|
||||||
|
|
@ -322,8 +322,7 @@ private:
|
||||||
|
|
||||||
void visit(AstSel* nodep, AstNUser*) {
|
void visit(AstSel* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) {
|
||||||
nodep->user1(1);
|
|
||||||
// Guard against reading/writing past end of bit vector array
|
// Guard against reading/writing past end of bit vector array
|
||||||
int maxmsb = 0;
|
int maxmsb = 0;
|
||||||
bool lvalue = false;
|
bool lvalue = false;
|
||||||
|
|
@ -373,8 +372,7 @@ private:
|
||||||
|
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1Inc()) {
|
||||||
nodep->user1(1);
|
|
||||||
if (debug()==9) nodep->dumpTree(cout,"-in: ");
|
if (debug()==9) nodep->dumpTree(cout,"-in: ");
|
||||||
// Guard against reading/writing past end of arrays
|
// Guard against reading/writing past end of arrays
|
||||||
AstNode* basefromp = AstArraySel::baseFromp(nodep->fromp());
|
AstNode* basefromp = AstArraySel::baseFromp(nodep->fromp());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue