Internals: Misc cleanups in prep for interface bugfix. No functional change intended.
This commit is contained in:
parent
0c328b6eaf
commit
5c070558ae
|
|
@ -278,8 +278,7 @@ private:
|
||||||
= VN_CAST(arrdtype->subDTypep(), IfaceRefDType);
|
= VN_CAST(arrdtype->subDTypep(), IfaceRefDType);
|
||||||
origIfaceRefp->cellp(nullptr);
|
origIfaceRefp->cellp(nullptr);
|
||||||
AstVar* varNewp = ifaceVarp->cloneTree(false);
|
AstVar* varNewp = ifaceVarp->cloneTree(false);
|
||||||
AstIfaceRefDType* ifaceRefp
|
AstIfaceRefDType* ifaceRefp = origIfaceRefp->cloneTree(false);
|
||||||
= VN_CAST(arrdtype->subDTypep(), IfaceRefDType)->cloneTree(false);
|
|
||||||
arrdtype->addNextHere(ifaceRefp);
|
arrdtype->addNextHere(ifaceRefp);
|
||||||
ifaceRefp->cellp(newp);
|
ifaceRefp->cellp(newp);
|
||||||
ifaceRefp->cellName(newp->name());
|
ifaceRefp->cellName(newp->name());
|
||||||
|
|
|
||||||
|
|
@ -108,12 +108,6 @@ public:
|
||||||
return varp->isParam();
|
return varp->isParam();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
class LinkNodeMatcherVarOrScope : public VNodeMatcher {
|
|
||||||
public:
|
|
||||||
virtual bool nodeMatch(const AstNode* nodep) const override {
|
|
||||||
return VN_IS(nodep, Var) || VN_IS(nodep, Scope);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// LinkDot state, as a visitor of each AstNode
|
// LinkDot state, as a visitor of each AstNode
|
||||||
|
|
@ -1718,7 +1712,7 @@ private:
|
||||||
VSymEnt* m_dotSymp; // SymEnt for dotted AstParse lookup
|
VSymEnt* m_dotSymp; // SymEnt for dotted AstParse lookup
|
||||||
AstDot* m_dotp; // Current dot
|
AstDot* m_dotp; // Current dot
|
||||||
bool m_unresolved; // Unresolved, needs help from V3Param
|
bool m_unresolved; // Unresolved, needs help from V3Param
|
||||||
AstNode* m_unlinkedScope; // Unresolved scope, needs corresponding VarXRef
|
AstNode* m_unlinkedScopep; // Unresolved scope, needs corresponding VarXRef
|
||||||
bool m_dotErr; // Error found in dotted resolution, ignore upwards
|
bool m_dotErr; // Error found in dotted resolution, ignore upwards
|
||||||
string m_dotText; // String of dotted names found in below parseref
|
string m_dotText; // String of dotted names found in below parseref
|
||||||
DotStates() { init(nullptr); }
|
DotStates() { init(nullptr); }
|
||||||
|
|
@ -1730,7 +1724,7 @@ private:
|
||||||
m_dotErr = false;
|
m_dotErr = false;
|
||||||
m_dotText = "";
|
m_dotText = "";
|
||||||
m_unresolved = false;
|
m_unresolved = false;
|
||||||
m_unlinkedScope = nullptr;
|
m_unlinkedScopep = nullptr;
|
||||||
}
|
}
|
||||||
string ascii() const {
|
string ascii() const {
|
||||||
static const char* const names[] = {"NONE", "PACKAGE", "SCOPE", "FINAL", "MEMBER"};
|
static const char* const names[] = {"NONE", "PACKAGE", "SCOPE", "FINAL", "MEMBER"};
|
||||||
|
|
@ -1983,7 +1977,7 @@ private:
|
||||||
}
|
}
|
||||||
if (m_ds.m_unresolved
|
if (m_ds.m_unresolved
|
||||||
&& (VN_IS(nodep->lhsp(), CellRef) || VN_IS(nodep->lhsp(), CellArrayRef))) {
|
&& (VN_IS(nodep->lhsp(), CellRef) || VN_IS(nodep->lhsp(), CellArrayRef))) {
|
||||||
m_ds.m_unlinkedScope = nodep->lhsp();
|
m_ds.m_unlinkedScopep = nodep->lhsp();
|
||||||
}
|
}
|
||||||
if (!m_ds.m_dotErr) { // Once something wrong, give up
|
if (!m_ds.m_dotErr) { // Once something wrong, give up
|
||||||
// Top 'final' dot RHS is final RHS, else it's a
|
// Top 'final' dot RHS is final RHS, else it's a
|
||||||
|
|
@ -2173,19 +2167,19 @@ private:
|
||||||
varp->attrSplitVar(false);
|
varp->attrSplitVar(false);
|
||||||
}
|
}
|
||||||
m_ds.m_dotText = "";
|
m_ds.m_dotText = "";
|
||||||
if (m_ds.m_unresolved && m_ds.m_unlinkedScope) {
|
if (m_ds.m_unresolved && m_ds.m_unlinkedScopep) {
|
||||||
string dotted = refp->dotted();
|
string dotted = refp->dotted();
|
||||||
size_t pos = dotted.find("__BRA__??__KET__");
|
size_t pos = dotted.find("__BRA__??__KET__");
|
||||||
// Arrays of interfaces all have the same parameters
|
// Arrays of interfaces all have the same parameters
|
||||||
if (pos != string::npos && varp->isParam()
|
if (pos != string::npos && varp->isParam()
|
||||||
&& VN_IS(m_ds.m_unlinkedScope, CellArrayRef)) {
|
&& VN_IS(m_ds.m_unlinkedScopep, CellArrayRef)) {
|
||||||
refp->dotted(dotted.substr(0, pos));
|
refp->dotted(dotted.substr(0, pos));
|
||||||
newp = refp;
|
newp = refp;
|
||||||
} else {
|
} else {
|
||||||
newp = new AstUnlinkedRef(nodep->fileline(),
|
newp = new AstUnlinkedRef(nodep->fileline(),
|
||||||
VN_CAST(refp, VarXRef), refp->name(),
|
VN_CAST(refp, VarXRef), refp->name(),
|
||||||
m_ds.m_unlinkedScope->unlinkFrBack());
|
m_ds.m_unlinkedScopep->unlinkFrBack());
|
||||||
m_ds.m_unlinkedScope = nullptr;
|
m_ds.m_unlinkedScopep = nullptr;
|
||||||
m_ds.m_unresolved = false;
|
m_ds.m_unresolved = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2439,12 +2433,12 @@ private:
|
||||||
m_ds.m_dotPos = DP_SCOPE;
|
m_ds.m_dotPos = DP_SCOPE;
|
||||||
m_ds.m_dotp = nullptr;
|
m_ds.m_dotp = nullptr;
|
||||||
} else if (m_ds.m_dotp && m_ds.m_dotPos == DP_FINAL) {
|
} else if (m_ds.m_dotp && m_ds.m_dotPos == DP_FINAL) {
|
||||||
if (m_ds.m_unresolved && m_ds.m_unlinkedScope) {
|
if (m_ds.m_unresolved && m_ds.m_unlinkedScopep) {
|
||||||
AstNodeFTaskRef* newftaskp = nodep->cloneTree(false);
|
AstNodeFTaskRef* newftaskp = nodep->cloneTree(false);
|
||||||
newftaskp->dotted(m_ds.m_dotText);
|
newftaskp->dotted(m_ds.m_dotText);
|
||||||
AstNode* newp = new AstUnlinkedRef(nodep->fileline(), newftaskp, nodep->name(),
|
AstNode* newp = new AstUnlinkedRef(nodep->fileline(), newftaskp, nodep->name(),
|
||||||
m_ds.m_unlinkedScope->unlinkFrBack());
|
m_ds.m_unlinkedScopep->unlinkFrBack());
|
||||||
m_ds.m_unlinkedScope = nullptr;
|
m_ds.m_unlinkedScopep = nullptr;
|
||||||
m_ds.m_unresolved = false;
|
m_ds.m_unresolved = false;
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -892,10 +892,13 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
||||||
|
|
||||||
AstIfaceRefDType* pinIrefp = nullptr;
|
AstIfaceRefDType* pinIrefp = nullptr;
|
||||||
AstNode* exprp = pinp->exprp();
|
AstNode* exprp = pinp->exprp();
|
||||||
if (exprp && VN_IS(exprp, VarRef) && VN_CAST(exprp, VarRef)->varp()
|
AstVar* varp
|
||||||
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
= (exprp && VN_IS(exprp, VarRef)) ? VN_CAST(exprp, VarRef)->varp() : nullptr;
|
||||||
&& VN_IS(VN_CAST(exprp, VarRef)->varp()->subDTypep(), IfaceRefDType)) {
|
if (varp && varp->subDTypep() && VN_IS(varp->subDTypep(), IfaceRefDType)) {
|
||||||
pinIrefp = VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), IfaceRefDType);
|
pinIrefp = VN_CAST(varp->subDTypep(), IfaceRefDType);
|
||||||
|
} else if (varp && varp->subDTypep() && arraySubDTypep(varp->subDTypep())
|
||||||
|
&& VN_CAST(arraySubDTypep(varp->subDTypep()), IfaceRefDType)) {
|
||||||
|
pinIrefp = VN_CAST(arraySubDTypep(varp->subDTypep()), IfaceRefDType);
|
||||||
} else if (exprp && exprp->op1p() && VN_IS(exprp->op1p(), VarRef)
|
} else if (exprp && exprp->op1p() && VN_IS(exprp->op1p(), VarRef)
|
||||||
&& VN_CAST(exprp->op1p(), VarRef)->varp()
|
&& VN_CAST(exprp->op1p(), VarRef)->varp()
|
||||||
&& VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()
|
&& VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()
|
||||||
|
|
@ -906,13 +909,6 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
||||||
pinIrefp = VN_CAST(
|
pinIrefp = VN_CAST(
|
||||||
arraySubDTypep(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()),
|
arraySubDTypep(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()),
|
||||||
IfaceRefDType);
|
IfaceRefDType);
|
||||||
} else if (exprp && VN_IS(exprp, VarRef) && VN_CAST(exprp, VarRef)->varp()
|
|
||||||
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
|
||||||
&& arraySubDTypep(VN_CAST(exprp, VarRef)->varp()->subDTypep())
|
|
||||||
&& VN_CAST(arraySubDTypep(VN_CAST(exprp, VarRef)->varp()->subDTypep()),
|
|
||||||
IfaceRefDType)) {
|
|
||||||
pinIrefp = VN_CAST(arraySubDTypep(VN_CAST(exprp, VarRef)->varp()->subDTypep()),
|
|
||||||
IfaceRefDType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINFO(9, " portIfaceRef " << portIrefp << endl);
|
UINFO(9, " portIfaceRef " << portIrefp << endl);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue