Internals: Refactor some VAssign printing. No functional change.

This commit is contained in:
Wilson Snyder 2020-11-01 16:59:23 -05:00
parent 2aedc91151
commit 80284c437e
6 changed files with 12 additions and 16 deletions

View File

@ -131,6 +131,10 @@ public:
static const char* const names[] = {"RD", "WR"};
return names[m_e];
}
const char* arrow() const {
static const char* const names[] = {"[RV] <-", "[LV] =>"};
return names[m_e];
}
inline VAccess()
: m_e{READ} {}
// cppcheck-suppress noExplicitConstructor

View File

@ -1453,12 +1453,8 @@ void AstVarScope::dump(std::ostream& str) const {
void AstNodeVarRef::dump(std::ostream& str) const { this->AstNodeMath::dump(str); }
void AstVarXRef::dump(std::ostream& str) const {
this->AstNodeVarRef::dump(str);
if (packagep()) { str << " pkg=" << nodeAddr(packagep()); }
if (access().isWrite()) {
str << " [LV] => ";
} else {
str << " [RV] <- ";
}
if (packagep()) str << " pkg=" << nodeAddr(packagep());
str << " " << access().arrow() << " ";
str << ".=" << dotted() << " ";
if (inlinedDots() != "") str << " inline.=" << inlinedDots() << " - ";
if (varScopep()) {
@ -1471,12 +1467,8 @@ void AstVarXRef::dump(std::ostream& str) const {
}
void AstVarRef::dump(std::ostream& str) const {
this->AstNodeVarRef::dump(str);
if (packagep()) { str << " pkg=" << nodeAddr(packagep()); }
if (access().isWrite()) {
str << " [LV] => ";
} else {
str << " [RV] <- ";
}
if (packagep()) str << " pkg=" << nodeAddr(packagep());
str << " " << access().arrow() << " ";
if (varScopep()) {
varScopep()->dump(str);
} else if (varp()) {

View File

@ -314,7 +314,7 @@ private:
// It was an expression, then got constified. In reality, the WordSel
// must be wrapped in a Cond, that will be false.
return (VN_IS(nodep->rhsp(), Const) && VN_IS(nodep->fromp(), NodeVarRef)
&& !VN_CAST_CONST(nodep->fromp(), NodeVarRef)->access().isWrite()
&& VN_CAST_CONST(nodep->fromp(), NodeVarRef)->access().isReadOnly()
&& (static_cast<int>(VN_CAST_CONST(nodep->rhsp(), Const)->toUInt())
>= VN_CAST(nodep->fromp(), NodeVarRef)->varp()->widthWords()));
}

View File

@ -448,7 +448,7 @@ private:
vvertexp->setIsClock();
// For SYNCASYNCNET
varscp->user2(true);
} else if (m_activep && m_activep->hasClocked() && !nodep->access().isWrite()) {
} else if (m_activep && m_activep->hasClocked() && nodep->access().isReadOnly()) {
if (varscp->user2()) {
if (!vvertexp->rstAsyncNodep()) vvertexp->rstAsyncNodep(nodep);
} else {

View File

@ -1237,7 +1237,7 @@ class TristateVisitor : public TristateBaseVisitor {
UINFO(9, " Ref-to-lvalue " << nodep << endl);
m_tgraph.didProcess(nodep);
mapInsertLhsVarRef(nodep);
} else if (!nodep->access().isWrite()
} else if (nodep->access().isReadOnly()
// Not already processed, nor varref from visit(AstPin) creation
&& !nodep->user1p()
// Reference to another tristate variable

View File

@ -451,7 +451,7 @@ private:
}
if (m_varModeReplace && nodep->varp() == m_forVarp && nodep->varScopep() == m_forVscp
&& !nodep->access().isWrite()) {
&& nodep->access().isReadOnly()) {
AstNode* newconstp = m_varValuep->cloneTree(false);
nodep->replaceWith(newconstp);
pushDeletep(nodep);