forked from github/verilator
Internals: NodeModule for packages.
This commit is contained in:
parent
1e2d73fc80
commit
d4b6e2b2b5
12
src/V3Ast.h
12
src/V3Ast.h
@ -1962,7 +1962,7 @@ private:
|
||||
bool m_lvalue; // Left hand side assignment
|
||||
AstVar* m_varp; // [AfterLink] Pointer to variable itself
|
||||
AstVarScope* m_varScopep; // Varscope for hierarchy
|
||||
AstPackage* m_packagep; // Package hierarchy
|
||||
AstNodeModule* m_packagep; // Package hierarchy
|
||||
string m_name; // Name of variable
|
||||
string m_hiername; // Scope converted into name-> for emitting
|
||||
bool m_hierThis; // Hiername points to "this" function
|
||||
@ -1997,8 +1997,8 @@ public:
|
||||
void hiername(const string& hn) { m_hiername = hn; }
|
||||
bool hierThis() const { return m_hierThis; }
|
||||
void hierThis(bool flag) { m_hierThis = flag; }
|
||||
AstPackage* packagep() const { return m_packagep; }
|
||||
void packagep(AstPackage* nodep) { m_packagep = nodep; }
|
||||
AstNodeModule* packagep() const { return m_packagep; }
|
||||
void packagep(AstNodeModule* nodep) { m_packagep = nodep; }
|
||||
// Know no children, and hot function, so skip iterator for speed
|
||||
// See checkTreeIter also that asserts no children
|
||||
// cppcheck-suppress functionConst
|
||||
@ -2362,7 +2362,7 @@ private:
|
||||
string m_name; // Name of variable
|
||||
string m_dotted; // Dotted part of scope the name()ed task/func is under or ""
|
||||
string m_inlinedDots; // Dotted hierarchy flattened out
|
||||
AstPackage* m_packagep; // Package hierarchy
|
||||
AstNodeModule* m_packagep; // Package hierarchy
|
||||
public:
|
||||
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp)
|
||||
: AstNodeStmt(t, fl, statement)
|
||||
@ -2390,8 +2390,8 @@ public:
|
||||
void taskp(AstNodeFTask* taskp) { m_taskp = taskp; }
|
||||
virtual void name(const string& name) { m_name = name; }
|
||||
void dotted(const string& name) { m_dotted = name; }
|
||||
AstPackage* packagep() const { return m_packagep; }
|
||||
void packagep(AstPackage* nodep) { m_packagep = nodep; }
|
||||
AstNodeModule* packagep() const { return m_packagep; }
|
||||
void packagep(AstNodeModule* nodep) { m_packagep = nodep; }
|
||||
// op1 = namep
|
||||
AstNode* namep() const { return op1p(); }
|
||||
// op2 = reserved for AstMethodCall
|
||||
|
@ -826,7 +826,7 @@ class AstClassRefDType : public AstNodeDType {
|
||||
// Reference to a class
|
||||
private:
|
||||
AstClass* m_classp; // data type pointed to, BELOW the AstTypedef
|
||||
AstPackage* m_packagep; // Package hierarchy
|
||||
AstNodeModule* m_packagep; // Package hierarchy
|
||||
public:
|
||||
AstClassRefDType(FileLine* fl, AstClass* classp)
|
||||
: ASTGEN_SUPER(fl), m_classp(classp), m_packagep(NULL) {
|
||||
@ -858,8 +858,8 @@ public:
|
||||
virtual AstNodeDType* virtRefDTypep() const { return NULL; }
|
||||
virtual void virtRefDTypep(AstNodeDType* nodep) {}
|
||||
virtual AstNodeDType* subDTypep() const { return NULL; }
|
||||
AstPackage* packagep() const { return m_packagep; }
|
||||
void packagep(AstPackage* nodep) { m_packagep = nodep; }
|
||||
AstNodeModule* packagep() const { return m_packagep; }
|
||||
void packagep(AstNodeModule* nodep) { m_packagep = nodep; }
|
||||
AstClass* classp() const { return m_classp; }
|
||||
void classp(AstClass* nodep) { m_classp = nodep; }
|
||||
};
|
||||
@ -972,7 +972,7 @@ class AstRefDType : public AstNodeDType {
|
||||
private:
|
||||
AstNodeDType* m_refDTypep; // data type pointed to, BELOW the AstTypedef
|
||||
string m_name; // Name of an AstTypedef
|
||||
AstPackage* m_packagep; // Package hierarchy
|
||||
AstNodeModule* m_packagep; // Package hierarchy
|
||||
public:
|
||||
AstRefDType(FileLine* fl, const string& name)
|
||||
: ASTGEN_SUPER(fl), m_refDTypep(NULL), m_name(name), m_packagep(NULL) {}
|
||||
@ -1028,8 +1028,8 @@ public:
|
||||
virtual AstNodeDType* virtRefDTypep() const { return refDTypep(); }
|
||||
virtual void virtRefDTypep(AstNodeDType* nodep) { refDTypep(nodep); }
|
||||
virtual AstNodeDType* subDTypep() const { return m_refDTypep; }
|
||||
AstPackage* packagep() const { return m_packagep; }
|
||||
void packagep(AstPackage* nodep) { m_packagep = nodep; }
|
||||
AstNodeModule* packagep() const { return m_packagep; }
|
||||
void packagep(AstNodeModule* nodep) { m_packagep = nodep; }
|
||||
AstNode* typeofp() const { return op2p(); }
|
||||
};
|
||||
|
||||
@ -1156,10 +1156,10 @@ public:
|
||||
|
||||
class AstEnumItemRef : public AstNodeMath {
|
||||
private:
|
||||
AstEnumItem* m_itemp; // [AfterLink] Pointer to item
|
||||
AstPackage* m_packagep; // Package hierarchy
|
||||
AstEnumItem* m_itemp; // [AfterLink] Pointer to item
|
||||
AstNodeModule* m_packagep; // Package hierarchy
|
||||
public:
|
||||
AstEnumItemRef(FileLine* fl, AstEnumItem* itemp, AstPackage* packagep)
|
||||
AstEnumItemRef(FileLine* fl, AstEnumItem* itemp, AstNodeModule* packagep)
|
||||
: ASTGEN_SUPER(fl), m_itemp(itemp), m_packagep(packagep) {
|
||||
dtypeFrom(m_itemp);
|
||||
}
|
||||
@ -1176,8 +1176,8 @@ public:
|
||||
virtual string emitVerilog() { V3ERROR_NA_RETURN(""); }
|
||||
virtual string emitC() { V3ERROR_NA_RETURN(""); }
|
||||
virtual bool cleanOut() const { return true; }
|
||||
AstPackage* packagep() const { return m_packagep; }
|
||||
void packagep(AstPackage* nodep) { m_packagep = nodep; }
|
||||
AstNodeModule* packagep() const { return m_packagep; }
|
||||
void packagep(AstNodeModule* nodep) { m_packagep = nodep; }
|
||||
};
|
||||
|
||||
class AstEnumDType : public AstNodeDType {
|
||||
|
@ -350,8 +350,8 @@ public:
|
||||
}
|
||||
return symp;
|
||||
}
|
||||
VSymEnt* insertBlock(VSymEnt* abovep, const string& name,
|
||||
AstNode* nodep, AstPackage* packagep) {
|
||||
VSymEnt* insertBlock(VSymEnt* abovep, const string& name, AstNode* nodep,
|
||||
AstNodeModule* packagep) {
|
||||
// A fake point in the hierarchy, corresponding to a begin or function/task block
|
||||
// After we remove begins these will go away
|
||||
// Note we fallback to the symbol table of the parent, as we want to find variables there
|
||||
@ -371,8 +371,8 @@ public:
|
||||
abovep->reinsert(name, symp);
|
||||
return symp;
|
||||
}
|
||||
VSymEnt* insertSym(VSymEnt* abovep, const string& name,
|
||||
AstNode* nodep, AstPackage* packagep) {
|
||||
VSymEnt* insertSym(VSymEnt* abovep, const string& name, AstNode* nodep,
|
||||
AstNodeModule* packagep) {
|
||||
UASSERT_OBJ(abovep, nodep, "Null symbol table inserting node");
|
||||
VSymEnt* symp = new VSymEnt(&m_syms, nodep);
|
||||
UINFO(9," INSERTsym se"<<cvtToHex(symp)<<" name='"<<name
|
||||
@ -676,8 +676,8 @@ LinkDotState* LinkDotState::s_errorThisp = NULL;
|
||||
|
||||
class LinkDotFindVisitor : public AstNVisitor {
|
||||
// STATE
|
||||
LinkDotState* m_statep; // State to pass between visitors, including symbol table
|
||||
AstPackage* m_packagep; // Current package
|
||||
LinkDotState* m_statep; // State to pass between visitors, including symbol table
|
||||
AstNodeModule* m_packagep; // Current package
|
||||
VSymEnt* m_modSymp; // Symbol Entry for current module
|
||||
VSymEnt* m_curSymp; // Symbol Entry for current table, where to lookup/insert
|
||||
string m_scope; // Scope text
|
||||
@ -780,9 +780,10 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||
UINFO(4," Link Module: "<<nodep<<endl);
|
||||
UASSERT_OBJ(!nodep->dead(), nodep, "Module in cell tree mislabeled as dead?");
|
||||
VSymEnt* upperSymp = m_curSymp ? m_curSymp : m_statep->rootEntp();
|
||||
m_packagep = VN_CAST(nodep, Package);
|
||||
AstPackage* pkgp = VN_CAST(nodep, Package);
|
||||
m_packagep = pkgp;
|
||||
if (standalonePkg) {
|
||||
if (m_packagep->isDollarUnit()) {
|
||||
if (pkgp->isDollarUnit()) {
|
||||
m_curSymp = m_modSymp = m_statep->dunitEntp();
|
||||
nodep->user1p(m_curSymp);
|
||||
} else {
|
||||
@ -2002,7 +2003,7 @@ private:
|
||||
bool allowVar = false;
|
||||
if (m_ds.m_dotPos == DP_PACKAGE) {
|
||||
// {package}::{a}
|
||||
AstPackage* packagep = NULL;
|
||||
AstNodeModule* packagep = NULL;
|
||||
expectWhat = "scope/variable";
|
||||
allowScope = true;
|
||||
allowVar = true;
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
AstUser2InUse m_inuser2;
|
||||
|
||||
// TYPES
|
||||
typedef vl_unordered_map<AstPackage*, AstScope*> PackageScopeMap;
|
||||
typedef vl_unordered_map<AstNodeModule*, AstScope*> PackageScopeMap;
|
||||
// These cannot be unordered unless make a specialized hashing pair (gcc-8)
|
||||
typedef std::map<std::pair<AstVar*, AstScope*>, AstVarScope*> VarScopeMap;
|
||||
typedef std::set<std::pair<AstVarRef*, AstScope*> > VarRefScopeSet;
|
||||
|
@ -47,7 +47,7 @@ class VSymEnt {
|
||||
AstNode* m_nodep; // Node that entry belongs to
|
||||
VSymEnt* m_fallbackp; // Table "above" this one in name scope, for fallback resolution
|
||||
VSymEnt* m_parentp; // Table that created this table, dot notation needed to resolve into it
|
||||
AstPackage* m_packagep; // Package node is in (for V3LinkDot, unused here)
|
||||
AstNodeModule* m_packagep; // Package node is in (for V3LinkDot, unused here)
|
||||
string m_symPrefix; // String to prefix symbols with (for V3LinkDot, unused here)
|
||||
bool m_exported; // Allow importing
|
||||
bool m_imported; // Was imported
|
||||
@ -100,7 +100,7 @@ public:
|
||||
m_nodep = reinterpret_cast<AstNode*>(1);
|
||||
m_fallbackp = reinterpret_cast<VSymEnt*>(1);
|
||||
m_parentp = reinterpret_cast<VSymEnt*>(1);
|
||||
m_packagep = reinterpret_cast<AstPackage*>(1);
|
||||
m_packagep = reinterpret_cast<AstNodeModule*>(1);
|
||||
#endif
|
||||
}
|
||||
#if defined(VL_DEBUG) && !defined(VL_LEAK_CHECKS)
|
||||
@ -110,8 +110,8 @@ public:
|
||||
void fallbackp(VSymEnt* entp) { m_fallbackp = entp; }
|
||||
void parentp(VSymEnt* entp) { m_parentp = entp; }
|
||||
VSymEnt* parentp() const { return m_parentp; }
|
||||
void packagep(AstPackage* entp) { m_packagep = entp; }
|
||||
AstPackage* packagep() const { return m_packagep; }
|
||||
void packagep(AstNodeModule* entp) { m_packagep = entp; }
|
||||
AstNodeModule* packagep() const { return m_packagep; }
|
||||
AstNode* nodep() const { return m_nodep; }
|
||||
string symPrefix() const { return m_symPrefix; }
|
||||
void symPrefix(const string& name) { m_symPrefix = name; }
|
||||
|
Loading…
Reference in New Issue
Block a user