Internals: Move V3Const to user4 to reduce future collisions
This commit is contained in:
parent
a242c1019d
commit
6ad21b3b3b
|
|
@ -43,11 +43,11 @@
|
||||||
|
|
||||||
class ConstVarMarkVisitor : public AstNVisitor {
|
class ConstVarMarkVisitor : public AstNVisitor {
|
||||||
// NODE STATE
|
// NODE STATE
|
||||||
// AstVar::userp -> bool, Var marked, 0=not set yet
|
// AstVar::user4p -> bool, Var marked, 0=not set yet
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
if (nodep->varp()) nodep->varp()->user(1);
|
if (nodep->varp()) nodep->varp()->user4(1);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -55,7 +55,7 @@ private:
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
ConstVarMarkVisitor(AstNode* nodep) {
|
ConstVarMarkVisitor(AstNode* nodep) {
|
||||||
AstNode::userClearTree();
|
AstNode::user4ClearTree(); // Check marked InUse before we're called
|
||||||
nodep->iterateAndNext(*this, NULL);
|
nodep->iterateAndNext(*this, NULL);
|
||||||
}
|
}
|
||||||
virtual ~ConstVarMarkVisitor() {}
|
virtual ~ConstVarMarkVisitor() {}
|
||||||
|
|
@ -63,13 +63,13 @@ public:
|
||||||
|
|
||||||
class ConstVarFindVisitor : public AstNVisitor {
|
class ConstVarFindVisitor : public AstNVisitor {
|
||||||
// NODE STATE
|
// NODE STATE
|
||||||
// AstVar::userp -> bool, input from ConstVarMarkVisitor
|
// AstVar::user4p -> bool, input from ConstVarMarkVisitor
|
||||||
// MEMBERS
|
// MEMBERS
|
||||||
bool m_found;
|
bool m_found;
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
if (nodep->varp() && nodep->varp()->user()) m_found = true;
|
if (nodep->varp() && nodep->varp()->user4()) m_found = true;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -93,7 +93,7 @@ private:
|
||||||
// NODE STATE
|
// NODE STATE
|
||||||
// ** only when m_warn is set. If state is needed other times,
|
// ** only when m_warn is set. If state is needed other times,
|
||||||
// ** must track down everywhere V3Const is called and make sure no overlaps.
|
// ** must track down everywhere V3Const is called and make sure no overlaps.
|
||||||
// AstVar::userp -> Used by ConstVarMarkVisitor/ConstVarFindVisitor
|
// AstVar::user4p -> Used by ConstVarMarkVisitor/ConstVarFindVisitor
|
||||||
|
|
||||||
// STATE
|
// STATE
|
||||||
bool m_params; // If true, propogate parameterized and true numbers only
|
bool m_params; // If true, propogate parameterized and true numbers only
|
||||||
|
|
@ -671,7 +671,9 @@ private:
|
||||||
else if (!m_cpp && nodep->lhsp()->castConcat()) {
|
else if (!m_cpp && nodep->lhsp()->castConcat()) {
|
||||||
bool need_temp = false;
|
bool need_temp = false;
|
||||||
if (m_warn && !nodep->castAssignDly()) { // Is same var on LHS and RHS?
|
if (m_warn && !nodep->castAssignDly()) { // Is same var on LHS and RHS?
|
||||||
AstUserInUse m_inuse1;
|
// Note only do this (need user4) when m_warn, which is
|
||||||
|
// done as unique visitor
|
||||||
|
AstUser4InUse m_inuse4;
|
||||||
ConstVarMarkVisitor mark(nodep->lhsp());
|
ConstVarMarkVisitor mark(nodep->lhsp());
|
||||||
ConstVarFindVisitor find(nodep->rhsp());
|
ConstVarFindVisitor find(nodep->rhsp());
|
||||||
if (find.found()) need_temp = true;
|
if (find.found()) need_temp = true;
|
||||||
|
|
@ -1521,12 +1523,14 @@ void V3Const::constifyParam(AstNode* nodep) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3Const::constifyAll(AstNetlist* nodep) {
|
void V3Const::constifyAll(AstNetlist* nodep) {
|
||||||
|
// Only call from Verilator.cpp, as it uses user#'s
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
ConstVisitor visitor (false,false,false,false);
|
ConstVisitor visitor (false,false,false,false);
|
||||||
visitor.main(nodep);
|
visitor.main(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3Const::constifyAllLint(AstNetlist* nodep) {
|
void V3Const::constifyAllLint(AstNetlist* nodep) {
|
||||||
|
// Only call from Verilator.cpp, as it uses user#'s
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
ConstVisitor visitor (false,false,true,false);
|
ConstVisitor visitor (false,false,true,false);
|
||||||
visitor.main(nodep);
|
visitor.main(nodep);
|
||||||
|
|
@ -1542,4 +1546,3 @@ void V3Const::constifyTree(AstNode* nodep) {
|
||||||
ConstVisitor visitor (false,false,false,false);
|
ConstVisitor visitor (false,false,false,false);
|
||||||
visitor.main(nodep);
|
visitor.main(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@
|
||||||
#include "V3Global.h"
|
#include "V3Global.h"
|
||||||
#include "V3Coverage.h"
|
#include "V3Coverage.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
#include "V3Const.h"
|
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Coverage state, as a visitor of each AstNode
|
// Coverage state, as a visitor of each AstNode
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue