mirror of
https://github.com/verilator/verilator.git
synced 2026-08-22 05:57:29 +02:00
Add maybePointedTo to v3Broken for better and faster checks
git-svn-id: file://localhost/svn/verilator/trunk/verilator@809 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
@@ -585,6 +585,7 @@ public:
|
|||||||
virtual int instrCount() const { return 0; }
|
virtual int instrCount() const { return 0; }
|
||||||
virtual V3Hash sameHash() const { return V3Hash(V3Hash::Illegal()); } // Not a node that supports it
|
virtual V3Hash sameHash() const { return V3Hash(V3Hash::Illegal()); } // Not a node that supports it
|
||||||
virtual bool same(AstNode* otherp) const { return true; }
|
virtual bool same(AstNode* otherp) const { return true; }
|
||||||
|
virtual bool maybePointedTo() const { return false; } // Another AstNode* may have a pointer into this node, other then normal front/back/etc.
|
||||||
virtual bool broken() const { return false; }
|
virtual bool broken() const { return false; }
|
||||||
virtual bool emitWordForm() { return false; }
|
virtual bool emitWordForm() { return false; }
|
||||||
|
|
||||||
@@ -922,6 +923,7 @@ public:
|
|||||||
virtual ~AstNodeFTask() {}
|
virtual ~AstNodeFTask() {}
|
||||||
virtual void dump(ostream& str=cout);
|
virtual void dump(ostream& str=cout);
|
||||||
virtual string name() const { return m_name; } // * = Var name
|
virtual string name() const { return m_name; } // * = Var name
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
// {AstFunc only} op1 = Range output variable
|
// {AstFunc only} op1 = Range output variable
|
||||||
// op3 = Statements/Ports/Vars
|
// op3 = Statements/Ports/Vars
|
||||||
void name(const string& name) { m_name = name; }
|
void name(const string& name) { m_name = name; }
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ uint32_t AstVar::arrayElements() const {
|
|||||||
bool AstScope::broken() const {
|
bool AstScope::broken() const {
|
||||||
return ((m_aboveScopep && !m_aboveScopep->brokeExists())
|
return ((m_aboveScopep && !m_aboveScopep->brokeExists())
|
||||||
|| (m_aboveCellp && !m_aboveCellp->brokeExists())
|
|| (m_aboveCellp && !m_aboveCellp->brokeExists())
|
||||||
|| !m_modp || !((AstNode*)m_modp)->brokeExists());
|
|| !m_modp || !m_modp->brokeExists());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstScope::cloneRelink() {
|
void AstScope::cloneRelink() {
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ public:
|
|||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
virtual string name() const { return m_name; } // * = Var name
|
virtual string name() const { return m_name; } // * = Var name
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
AstVarType varType() const { return m_varType; } // * = Type of variable
|
AstVarType varType() const { return m_varType; } // * = Type of variable
|
||||||
string cType() const; // Return C type: bool, uint32_t, uint64_t, etc.
|
string cType() const; // Return C type: bool, uint32_t, uint64_t, etc.
|
||||||
void combineType(AstVarType type);
|
void combineType(AstVarType type);
|
||||||
@@ -422,6 +423,7 @@ public:
|
|||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void cloneRelink();
|
virtual void cloneRelink();
|
||||||
virtual bool broken() const;
|
virtual bool broken() const;
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
virtual string name() const { return m_name; } // * = Scope name
|
virtual string name() const { return m_name; } // * = Scope name
|
||||||
void name(const string& name) { m_name = name; }
|
void name(const string& name) { m_name = name; }
|
||||||
string nameDotless() const;
|
string nameDotless() const;
|
||||||
@@ -483,6 +485,7 @@ public:
|
|||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual bool broken() const { return ( (m_varp && !m_varp->brokeExists())
|
virtual bool broken() const { return ( (m_varp && !m_varp->brokeExists())
|
||||||
|| (m_scopep && !m_scopep->brokeExists())); }
|
|| (m_scopep && !m_scopep->brokeExists())); }
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
virtual string name() const {return scopep()->name()+"->"+varp()->name();} // * = Var name
|
virtual string name() const {return scopep()->name()+"->"+varp()->name();} // * = Var name
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable
|
AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable
|
||||||
@@ -607,6 +610,7 @@ public:
|
|||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
virtual bool broken() const { return (m_clkReqVarp && !m_clkReqVarp->brokeExists()); }
|
virtual bool broken() const { return (m_clkReqVarp && !m_clkReqVarp->brokeExists()); }
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
virtual string name() const { return m_name; }
|
virtual string name() const { return m_name; }
|
||||||
AstNode* stmtsp() const { return op2p()->castNode(); } // op2 = List of statements
|
AstNode* stmtsp() const { return op2p()->castNode(); } // op2 = List of statements
|
||||||
AstActive* activesp() const { return op3p()->castActive(); } // op3 = List of i/sblocks
|
AstActive* activesp() const { return op3p()->castActive(); } // op3 = List of i/sblocks
|
||||||
@@ -651,6 +655,7 @@ public:
|
|||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
virtual bool broken() const { return (m_modp && !m_modp->brokeExists()); }
|
virtual bool broken() const { return (m_modp && !m_modp->brokeExists()); }
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
virtual string name() const { return m_name; } // * = Cell name
|
virtual string name() const { return m_name; } // * = Cell name
|
||||||
void name(const string& name) { m_name = name; }
|
void name(const string& name) { m_name = name; }
|
||||||
@@ -868,6 +873,7 @@ public:
|
|||||||
virtual AstNode* clone() { return new AstSenTree(*this); }
|
virtual AstNode* clone() { return new AstSenTree(*this); }
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
bool isMulti() const { return m_multi; }
|
bool isMulti() const { return m_multi; }
|
||||||
AstSenItem* sensesp() const { return op1p()->castSenItem(); } // op1 = Sensitivity list
|
AstSenItem* sensesp() const { return op1p()->castSenItem(); } // op1 = Sensitivity list
|
||||||
void addSensesp(AstSenItem* nodep) { addOp1p(nodep); }
|
void addSensesp(AstSenItem* nodep) { addOp1p(nodep); }
|
||||||
@@ -1053,6 +1059,7 @@ public:
|
|||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
virtual int instrCount() const { return 1+2*instrCountLd(); }
|
virtual int instrCount() const { return 1+2*instrCountLd(); }
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
int column() const { return m_column; }
|
int column() const { return m_column; }
|
||||||
const string& comment() const { return m_text; } // text to insert in code
|
const string& comment() const { return m_text; } // text to insert in code
|
||||||
const string& typeText() const { return m_typeText; }
|
const string& typeText() const { return m_typeText; }
|
||||||
@@ -1506,6 +1513,7 @@ public:
|
|||||||
virtual AstNode* clone() { return new AstTraceDecl(*this); }
|
virtual AstNode* clone() { return new AstTraceDecl(*this); }
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual string name() const { return m_showname; }
|
virtual string name() const { return m_showname; }
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
string showname() const { return m_showname; } // * = Var name
|
string showname() const { return m_showname; } // * = Var name
|
||||||
virtual bool same(AstNode* samep) const { return false; }
|
virtual bool same(AstNode* samep) const { return false; }
|
||||||
// Details on what we're tracing
|
// Details on what we're tracing
|
||||||
@@ -2801,6 +2809,8 @@ public:
|
|||||||
virtual AstNode* clone() { return new AstCFunc(*this); }
|
virtual AstNode* clone() { return new AstCFunc(*this); }
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual string name() const { return m_name; }
|
virtual string name() const { return m_name; }
|
||||||
|
virtual bool broken() const { return ( (m_scopep && !m_scopep->brokeExists())); }
|
||||||
|
virtual bool maybePointedTo() const { return true; }
|
||||||
virtual V3Hash sameHash() const { return V3Hash(); }
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
virtual bool same(AstNode* samep) const { return ((funcType()==samep->castCFunc()->funcType())
|
virtual bool same(AstNode* samep) const { return ((funcType()==samep->castCFunc()->funcType())
|
||||||
&& (rtnTypeVoid()==samep->castCFunc()->rtnTypeVoid())
|
&& (rtnTypeVoid()==samep->castCFunc()->rtnTypeVoid())
|
||||||
|
|||||||
+6
-4
@@ -81,13 +81,15 @@ private:
|
|||||||
// // so userp and friends may not be used
|
// // so userp and friends may not be used
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
BrokenTable::add(nodep);
|
if (nodep->maybePointedTo()) {
|
||||||
|
BrokenTable::add(nodep);
|
||||||
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
BrokenMarkVisitor(AstNode* nodep) {
|
BrokenMarkVisitor(AstNetlist* nodep) {
|
||||||
nodep->iterateAndNext(*this, NULL);
|
nodep->accept(*this);
|
||||||
}
|
}
|
||||||
virtual ~BrokenMarkVisitor() {}
|
virtual ~BrokenMarkVisitor() {}
|
||||||
};
|
};
|
||||||
@@ -99,7 +101,7 @@ class BrokenCheckVisitor : public AstNVisitor {
|
|||||||
private:
|
private:
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
if (nodep->broken()) {
|
if (nodep->broken()) {
|
||||||
nodep->v3fatalSrc("Broken link in node\n");
|
nodep->v3fatalSrc("Broken link in node (or something without maybePointedTo)\n");
|
||||||
}
|
}
|
||||||
if (v3Global.assertWidthsSame()) {
|
if (v3Global.assertWidthsSame()) {
|
||||||
if (nodep->width() != nodep->widthMin()) {
|
if (nodep->width() != nodep->widthMin()) {
|
||||||
|
|||||||
+4
-2
@@ -1213,12 +1213,14 @@ void V3Const::constifyAll(AstNetlist* nodep) {
|
|||||||
visitor.main(nodep);
|
visitor.main(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3Const::constifyAllLint(AstNode* nodep) {
|
void V3Const::constifyAllLint(AstNetlist* nodep) {
|
||||||
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
ConstVisitor visitor (false,false,true,false);
|
ConstVisitor visitor (false,false,true,false);
|
||||||
visitor.main(nodep);
|
visitor.main(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3Const::constifyCpp(AstNode* nodep) {
|
void V3Const::constifyCpp(AstNetlist* nodep) {
|
||||||
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
ConstVisitor visitor (false,false,false,true);
|
ConstVisitor visitor (false,false,false,true);
|
||||||
visitor.main(nodep);
|
visitor.main(nodep);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -34,9 +34,9 @@ public:
|
|||||||
// Everything that's possible
|
// Everything that's possible
|
||||||
static void constifyAll(AstNetlist* nodep);
|
static void constifyAll(AstNetlist* nodep);
|
||||||
// Also, warn
|
// Also, warn
|
||||||
static void constifyAllLint(AstNode* nodep);
|
static void constifyAllLint(AstNetlist* nodep);
|
||||||
// C++ datatypes
|
// C++ datatypes
|
||||||
static void constifyCpp(AstNode* nodep);
|
static void constifyCpp(AstNetlist* nodep);
|
||||||
// Only the current node and lower
|
// Only the current node and lower
|
||||||
static void constifyTree(AstNode* nodep);
|
static void constifyTree(AstNode* nodep);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user