Internals: enum constructor cleanups. No functional change intended.

This commit is contained in:
Wilson Snyder 2022-09-15 19:58:01 -04:00
parent dbe1348b4c
commit 2dc85a5acd
26 changed files with 123 additions and 121 deletions

View File

@ -927,7 +927,7 @@ AstNode* AstNode::iterateSubtreeReturnEdits(VNVisitor& v) {
} else if (!nodep->backp()) { } else if (!nodep->backp()) {
// Calling on standalone tree; insert a shim node so we can keep // Calling on standalone tree; insert a shim node so we can keep
// track, then delete it on completion // track, then delete it on completion
AstBegin* const tempp = new AstBegin(nodep->fileline(), "[EditWrapper]", nodep); AstBegin* const tempp = new AstBegin{nodep->fileline(), "[EditWrapper]", nodep};
{ {
VL_DO_DANGLING(tempp->stmtsp()->accept(v), VL_DO_DANGLING(tempp->stmtsp()->accept(v),
nodep); // nodep to null as may be replaced nodep); // nodep to null as may be replaced

View File

@ -166,7 +166,7 @@ public:
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning : m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; } operator en() const { return m_e; }
VAccess invert() const { VAccess invert() const {
return (m_e == READWRITE) ? VAccess(m_e) : (m_e == WRITE ? VAccess(READ) : VAccess(WRITE)); return (m_e == READWRITE) ? VAccess{m_e} : (m_e == WRITE ? VAccess{READ} : VAccess{WRITE});
} }
bool isReadOnly() const { return m_e == READ; } // False with READWRITE bool isReadOnly() const { return m_e == READ; } // False with READWRITE
bool isWriteOnly() const { return m_e == WRITE; } // False with READWRITE bool isWriteOnly() const { return m_e == WRITE; } // False with READWRITE
@ -200,7 +200,7 @@ public:
inline VSigning(en _e) inline VSigning(en _e)
: m_e{_e} {} : m_e{_e} {}
static inline VSigning fromBool(bool isSigned) { // Factory method static inline VSigning fromBool(bool isSigned) { // Factory method
return isSigned ? VSigning(SIGNED) : VSigning(UNSIGNED); return isSigned ? VSigning{SIGNED} : VSigning{UNSIGNED};
} }
explicit inline VSigning(int _e) explicit inline VSigning(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning : m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
@ -465,9 +465,9 @@ public:
return names[m_e]; return names[m_e];
} }
static void selfTest() { static void selfTest() {
UASSERT(0 == std::strcmp(VBasicDTypeKwd(_ENUM_MAX).ascii(), " MAX"), UASSERT(0 == std::strcmp(VBasicDTypeKwd{_ENUM_MAX}.ascii(), " MAX"),
"SelfTest: Enum mismatch"); "SelfTest: Enum mismatch");
UASSERT(0 == std::strcmp(VBasicDTypeKwd(_ENUM_MAX).dpiType(), " MAX"), UASSERT(0 == std::strcmp(VBasicDTypeKwd{_ENUM_MAX}.dpiType(), " MAX"),
"SelfTest: Enum mismatch"); "SelfTest: Enum mismatch");
} }
inline VBasicDTypeKwd() inline VBasicDTypeKwd()
@ -1172,7 +1172,7 @@ public:
AstNode* toNodep() const { return to<AstNode*>(); } AstNode* toNodep() const { return to<AstNode*>(); }
V3GraphVertex* toGraphVertex() const { return to<V3GraphVertex*>(); } V3GraphVertex* toGraphVertex() const { return to<V3GraphVertex*>(); }
int toInt() const { return m_u.ui; } int toInt() const { return m_u.ui; }
static VNUser fromInt(int i) { return VNUser(i); } static VNUser fromInt(int i) { return VNUser{i}; }
}; };
//###################################################################### //######################################################################
@ -1438,15 +1438,15 @@ class AstNode VL_NOT_FINAL {
static int s_cloneCntGbl; // Count of which userp is set static int s_cloneCntGbl; // Count of which userp is set
// This member ordering both allows 64 bit alignment and puts associated data together // This member ordering both allows 64 bit alignment and puts associated data together
VNUser m_user1u = VNUser{0}; // Contains any information the user iteration routine wants VNUser m_user1u{0}; // Contains any information the user iteration routine wants
uint32_t m_user1Cnt = 0; // Mark of when userp was set uint32_t m_user1Cnt = 0; // Mark of when userp was set
uint32_t m_user2Cnt = 0; // Mark of when userp was set uint32_t m_user2Cnt = 0; // Mark of when userp was set
VNUser m_user2u = VNUser{0}; // Contains any information the user iteration routine wants VNUser m_user2u{0}; // Contains any information the user iteration routine wants
VNUser m_user3u = VNUser{0}; // Contains any information the user iteration routine wants VNUser m_user3u{0}; // Contains any information the user iteration routine wants
uint32_t m_user3Cnt = 0; // Mark of when userp was set uint32_t m_user3Cnt = 0; // Mark of when userp was set
uint32_t m_user4Cnt = 0; // Mark of when userp was set uint32_t m_user4Cnt = 0; // Mark of when userp was set
VNUser m_user4u = VNUser{0}; // Contains any information the user iteration routine wants VNUser m_user4u{0}; // Contains any information the user iteration routine wants
VNUser m_user5u = VNUser{0}; // Contains any information the user iteration routine wants VNUser m_user5u{0}; // Contains any information the user iteration routine wants
uint32_t m_user5Cnt = 0; // Mark of when userp was set uint32_t m_user5Cnt = 0; // Mark of when userp was set
// METHODS // METHODS
@ -1638,13 +1638,13 @@ public:
VNUser user1u() const { VNUser user1u() const {
// Slows things down measurably, so disabled by default // Slows things down measurably, so disabled by default
//UASSERT_STATIC(VNUser1InUse::s_userBusy, "userp set w/o busy"); //UASSERT_STATIC(VNUser1InUse::s_userBusy, "userp set w/o busy");
return ((m_user1Cnt==VNUser1InUse::s_userCntGbl) ? m_user1u : VNUser(0)); return ((m_user1Cnt==VNUser1InUse::s_userCntGbl) ? m_user1u : VNUser{0});
} }
AstNode* user1p() const { return user1u().toNodep(); } AstNode* user1p() const { return user1u().toNodep(); }
void user1u(const VNUser& user) { m_user1u=user; m_user1Cnt=VNUser1InUse::s_userCntGbl; } void user1u(const VNUser& user) { m_user1u=user; m_user1Cnt=VNUser1InUse::s_userCntGbl; }
void user1p(void* userp) { user1u(VNUser(userp)); } void user1p(void* userp) { user1u(VNUser{userp}); }
int user1() const { return user1u().toInt(); } int user1() const { return user1u().toInt(); }
void user1(int val) { user1u(VNUser(val)); } void user1(int val) { user1u(VNUser{val}); }
int user1Inc(int val=1) { int v=user1(); user1(v+val); return v; } int user1Inc(int val=1) { int v=user1(); user1(v+val); return v; }
int user1SetOnce() { int v=user1(); if (!v) user1(1); return v; } // Better for cache than user1Inc() int user1SetOnce() { int v=user1(); if (!v) user1(1); return v; } // Better for cache than user1Inc()
static void user1ClearTree() { VNUser1InUse::clear(); } // Clear userp()'s across the entire tree static void user1ClearTree() { VNUser1InUse::clear(); } // Clear userp()'s across the entire tree
@ -1652,13 +1652,13 @@ public:
VNUser user2u() const { VNUser user2u() const {
// Slows things down measurably, so disabled by default // Slows things down measurably, so disabled by default
//UASSERT_STATIC(VNUser2InUse::s_userBusy, "userp set w/o busy"); //UASSERT_STATIC(VNUser2InUse::s_userBusy, "userp set w/o busy");
return ((m_user2Cnt==VNUser2InUse::s_userCntGbl) ? m_user2u : VNUser(0)); return ((m_user2Cnt==VNUser2InUse::s_userCntGbl) ? m_user2u : VNUser{0});
} }
AstNode* user2p() const { return user2u().toNodep(); } AstNode* user2p() const { return user2u().toNodep(); }
void user2u(const VNUser& user) { m_user2u=user; m_user2Cnt=VNUser2InUse::s_userCntGbl; } void user2u(const VNUser& user) { m_user2u=user; m_user2Cnt=VNUser2InUse::s_userCntGbl; }
void user2p(void* userp) { user2u(VNUser(userp)); } void user2p(void* userp) { user2u(VNUser{userp}); }
int user2() const { return user2u().toInt(); } int user2() const { return user2u().toInt(); }
void user2(int val) { user2u(VNUser(val)); } void user2(int val) { user2u(VNUser{val}); }
int user2Inc(int val=1) { int v=user2(); user2(v+val); return v; } int user2Inc(int val=1) { int v=user2(); user2(v+val); return v; }
int user2SetOnce() { int v=user2(); if (!v) user2(1); return v; } // Better for cache than user2Inc() int user2SetOnce() { int v=user2(); if (!v) user2(1); return v; } // Better for cache than user2Inc()
static void user2ClearTree() { VNUser2InUse::clear(); } // Clear userp()'s across the entire tree static void user2ClearTree() { VNUser2InUse::clear(); } // Clear userp()'s across the entire tree
@ -1666,13 +1666,13 @@ public:
VNUser user3u() const { VNUser user3u() const {
// Slows things down measurably, so disabled by default // Slows things down measurably, so disabled by default
//UASSERT_STATIC(VNUser3InUse::s_userBusy, "userp set w/o busy"); //UASSERT_STATIC(VNUser3InUse::s_userBusy, "userp set w/o busy");
return ((m_user3Cnt==VNUser3InUse::s_userCntGbl) ? m_user3u : VNUser(0)); return ((m_user3Cnt==VNUser3InUse::s_userCntGbl) ? m_user3u : VNUser{0});
} }
AstNode* user3p() const { return user3u().toNodep(); } AstNode* user3p() const { return user3u().toNodep(); }
void user3u(const VNUser& user) { m_user3u=user; m_user3Cnt=VNUser3InUse::s_userCntGbl; } void user3u(const VNUser& user) { m_user3u=user; m_user3Cnt=VNUser3InUse::s_userCntGbl; }
void user3p(void* userp) { user3u(VNUser(userp)); } void user3p(void* userp) { user3u(VNUser{userp}); }
int user3() const { return user3u().toInt(); } int user3() const { return user3u().toInt(); }
void user3(int val) { user3u(VNUser(val)); } void user3(int val) { user3u(VNUser{val}); }
int user3Inc(int val=1) { int v=user3(); user3(v+val); return v; } int user3Inc(int val=1) { int v=user3(); user3(v+val); return v; }
int user3SetOnce() { int v=user3(); if (!v) user3(1); return v; } // Better for cache than user3Inc() int user3SetOnce() { int v=user3(); if (!v) user3(1); return v; } // Better for cache than user3Inc()
static void user3ClearTree() { VNUser3InUse::clear(); } // Clear userp()'s across the entire tree static void user3ClearTree() { VNUser3InUse::clear(); } // Clear userp()'s across the entire tree
@ -1680,13 +1680,13 @@ public:
VNUser user4u() const { VNUser user4u() const {
// Slows things down measurably, so disabled by default // Slows things down measurably, so disabled by default
//UASSERT_STATIC(VNUser4InUse::s_userBusy, "userp set w/o busy"); //UASSERT_STATIC(VNUser4InUse::s_userBusy, "userp set w/o busy");
return ((m_user4Cnt==VNUser4InUse::s_userCntGbl) ? m_user4u : VNUser(0)); return ((m_user4Cnt==VNUser4InUse::s_userCntGbl) ? m_user4u : VNUser{0});
} }
AstNode* user4p() const { return user4u().toNodep(); } AstNode* user4p() const { return user4u().toNodep(); }
void user4u(const VNUser& user) { m_user4u=user; m_user4Cnt=VNUser4InUse::s_userCntGbl; } void user4u(const VNUser& user) { m_user4u=user; m_user4Cnt=VNUser4InUse::s_userCntGbl; }
void user4p(void* userp) { user4u(VNUser(userp)); } void user4p(void* userp) { user4u(VNUser{userp}); }
int user4() const { return user4u().toInt(); } int user4() const { return user4u().toInt(); }
void user4(int val) { user4u(VNUser(val)); } void user4(int val) { user4u(VNUser{val}); }
int user4Inc(int val=1) { int v=user4(); user4(v+val); return v; } int user4Inc(int val=1) { int v=user4(); user4(v+val); return v; }
int user4SetOnce() { int v=user4(); if (!v) user4(1); return v; } // Better for cache than user4Inc() int user4SetOnce() { int v=user4(); if (!v) user4(1); return v; } // Better for cache than user4Inc()
static void user4ClearTree() { VNUser4InUse::clear(); } // Clear userp()'s across the entire tree static void user4ClearTree() { VNUser4InUse::clear(); } // Clear userp()'s across the entire tree
@ -1694,13 +1694,13 @@ public:
VNUser user5u() const { VNUser user5u() const {
// Slows things down measurably, so disabled by default // Slows things down measurably, so disabled by default
//UASSERT_STATIC(VNUser5InUse::s_userBusy, "userp set w/o busy"); //UASSERT_STATIC(VNUser5InUse::s_userBusy, "userp set w/o busy");
return ((m_user5Cnt==VNUser5InUse::s_userCntGbl) ? m_user5u : VNUser(0)); return ((m_user5Cnt==VNUser5InUse::s_userCntGbl) ? m_user5u : VNUser{0});
} }
AstNode* user5p() const { return user5u().toNodep(); } AstNode* user5p() const { return user5u().toNodep(); }
void user5u(const VNUser& user) { m_user5u=user; m_user5Cnt=VNUser5InUse::s_userCntGbl; } void user5u(const VNUser& user) { m_user5u=user; m_user5Cnt=VNUser5InUse::s_userCntGbl; }
void user5p(void* userp) { user5u(VNUser(userp)); } void user5p(void* userp) { user5u(VNUser{userp}); }
int user5() const { return user5u().toInt(); } int user5() const { return user5u().toInt(); }
void user5(int val) { user5u(VNUser(val)); } void user5(int val) { user5u(VNUser{val}); }
int user5Inc(int val=1) { int v=user5(); user5(v+val); return v; } int user5Inc(int val=1) { int v=user5(); user5(v+val); return v; }
int user5SetOnce() { int v=user5(); if (!v) user5(1); return v; } // Better for cache than user5Inc() int user5SetOnce() { int v=user5(); if (!v) user5(1); return v; } // Better for cache than user5Inc()
static void user5ClearTree() { VNUser5InUse::clear(); } // Clear userp()'s across the entire tree static void user5ClearTree() { VNUser5InUse::clear(); } // Clear userp()'s across the entire tree
@ -2406,7 +2406,7 @@ inline AstNode* VNVisitor::iterateSubtreeReturnEdits(AstNode* nodep) {
#define ASTNODE_NODE_FUNCS_NO_DTOR(name) \ #define ASTNODE_NODE_FUNCS_NO_DTOR(name) \
virtual void accept(VNVisitor& v) override { v.visit(this); } \ virtual void accept(VNVisitor& v) override { v.visit(this); } \
virtual AstNode* clone() override { return new Ast##name(*this); } \ virtual AstNode* clone() override { return new Ast##name{*this}; } \
static Ast##name* cloneTreeNull(Ast##name* nodep, bool cloneNextLink) { \ static Ast##name* cloneTreeNull(Ast##name* nodep, bool cloneNextLink) { \
return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; \ return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; \
} \ } \

View File

@ -191,7 +191,7 @@ private:
string m_name; ///< Filename string m_name; ///< Filename
public: public:
AstNodeFile(VNType t, FileLine* fl, const string& name) AstNodeFile(VNType t, FileLine* fl, const string& name)
: AstNode(t, fl) : AstNode{t, fl}
, m_name{name} {} , m_name{name} {}
ASTNODE_BASE_FUNCS(NodeFile) ASTNODE_BASE_FUNCS(NodeFile)
virtual void dump(std::ostream& str) const override; virtual void dump(std::ostream& str) const override;

View File

@ -1872,7 +1872,7 @@ void AstTypeTable::dump(std::ostream& str) const {
for (int i = 0; i < static_cast<int>(VBasicDTypeKwd::_ENUM_MAX); ++i) { for (int i = 0; i < static_cast<int>(VBasicDTypeKwd::_ENUM_MAX); ++i) {
if (AstBasicDType* const subnodep = m_basicps[i]) { if (AstBasicDType* const subnodep = m_basicps[i]) {
str << '\n'; // Newline from caller, so newline first str << '\n'; // Newline from caller, so newline first
str << "\t\t" << std::setw(8) << VBasicDTypeKwd(i).ascii(); str << "\t\t" << std::setw(8) << VBasicDTypeKwd{i}.ascii();
str << " -> "; str << " -> ";
subnodep->dump(str); subnodep->dump(str);
} }

View File

@ -56,15 +56,15 @@ private:
inline void setUserp(T_Node* nodep, T_Data* userp) const { inline void setUserp(T_Node* nodep, T_Data* userp) const {
if VL_CONSTEXPR_CXX17 (T_UserN == 1) { if VL_CONSTEXPR_CXX17 (T_UserN == 1) {
nodep->user1u(VNUser(userp)); nodep->user1u(VNUser{userp});
} else if VL_CONSTEXPR_CXX17 (T_UserN == 2) { } else if VL_CONSTEXPR_CXX17 (T_UserN == 2) {
nodep->user2u(VNUser(userp)); nodep->user2u(VNUser{userp});
} else if VL_CONSTEXPR_CXX17 (T_UserN == 3) { } else if VL_CONSTEXPR_CXX17 (T_UserN == 3) {
nodep->user3u(VNUser(userp)); nodep->user3u(VNUser{userp});
} else if VL_CONSTEXPR_CXX17 (T_UserN == 4) { } else if VL_CONSTEXPR_CXX17 (T_UserN == 4) {
nodep->user4u(VNUser(userp)); nodep->user4u(VNUser{userp});
} else { } else {
nodep->user5u(VNUser(userp)); nodep->user5u(VNUser{userp});
} }
} }

View File

@ -100,7 +100,7 @@ private:
const string newvarname const string newvarname
= (string("__Vclklast__") + vscp->scopep()->nameDotless() + "__" + varp->name()); = (string("__Vclklast__") + vscp->scopep()->nameDotless() + "__" + varp->name());
AstVar* const newvarp = new AstVar(vscp->fileline(), VVarType::MODULETEMP, newvarname, AstVar* const newvarp = new AstVar(vscp->fileline(), VVarType::MODULETEMP, newvarname,
VFlagLogicPacked(), 1); VFlagLogicPacked{}, 1);
newvarp->noReset(true); // Reset by below assign newvarp->noReset(true); // Reset by below assign
m_modp->addStmtp(newvarp); m_modp->addStmtp(newvarp);
AstVarScope* const newvscp = new AstVarScope(vscp->fileline(), m_scopep, newvarp); AstVarScope* const newvscp = new AstVarScope(vscp->fileline(), m_scopep, newvarp);

View File

@ -54,7 +54,7 @@ v3errorIniter v3errorInit;
V3ErrorCode::V3ErrorCode(const char* msgp) { V3ErrorCode::V3ErrorCode(const char* msgp) {
// Return error encoding for given string, or ERROR, which is a bad code // Return error encoding for given string, or ERROR, which is a bad code
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code = V3ErrorCode(codei); const V3ErrorCode code{codei};
if (0 == VL_STRCASECMP(msgp, code.ascii())) { if (0 == VL_STRCASECMP(msgp, code.ascii())) {
m_e = code; m_e = code;
return; return;
@ -69,9 +69,9 @@ V3ErrorCode::V3ErrorCode(const char* msgp) {
void V3Error::init() { void V3Error::init() {
for (int i = 0; i < V3ErrorCode::_ENUM_MAX; i++) { for (int i = 0; i < V3ErrorCode::_ENUM_MAX; i++) {
s_describedEachWarn[i] = false; s_describedEachWarn[i] = false;
s_pretendError[i] = V3ErrorCode(i).pretendError(); s_pretendError[i] = V3ErrorCode{i}.pretendError();
} }
if (VL_UNCOVERABLE(string(V3ErrorCode(V3ErrorCode::_ENUM_MAX).ascii()) != " MAX")) { if (VL_UNCOVERABLE(string(V3ErrorCode{V3ErrorCode::_ENUM_MAX}.ascii()) != " MAX")) {
v3fatalSrc("Enum table in V3ErrorCode::EC_ascii() is munged"); v3fatalSrc("Enum table in V3ErrorCode::EC_ascii() is munged");
} }
} }

View File

@ -149,7 +149,7 @@ FileLine::FileLine(FileLine::EmptySecret) {
m_warnOn = 0; m_warnOn = 0;
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code = V3ErrorCode(codei); const V3ErrorCode code{codei};
warnOff(code, code.defaultsOff()); warnOff(code, code.defaultsOff());
} }
} }
@ -309,14 +309,14 @@ bool FileLine::warnOff(const string& msg, bool flag) {
void FileLine::warnLintOff(bool flag) { void FileLine::warnLintOff(bool flag) {
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code = V3ErrorCode(codei); const V3ErrorCode code{codei};
if (code.lintError()) warnOff(code, flag); if (code.lintError()) warnOff(code, flag);
} }
} }
void FileLine::warnStyleOff(bool flag) { void FileLine::warnStyleOff(bool flag) {
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code = V3ErrorCode(codei); const V3ErrorCode code{codei};
if (code.styleError()) warnOff(code, flag); if (code.styleError()) warnOff(code, flag);
} }
} }
@ -335,7 +335,7 @@ bool FileLine::warnIsOff(V3ErrorCode code) const {
void FileLine::modifyStateInherit(const FileLine* fromp) { void FileLine::modifyStateInherit(const FileLine* fromp) {
// Any warnings that are off in "from", become off in "this". // Any warnings that are off in "from", become off in "this".
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) { for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code = V3ErrorCode(codei); const V3ErrorCode code{codei};
if (fromp->warnIsOff(code)) warnOff(code, true); if (fromp->warnIsOff(code)) warnOff(code, true);
} }
} }

View File

@ -62,8 +62,8 @@ public:
explicit GateGraphBaseVisitor(V3Graph* graphp) explicit GateGraphBaseVisitor(V3Graph* graphp)
: m_graphp{graphp} {} : m_graphp{graphp} {}
virtual ~GateGraphBaseVisitor() = default; virtual ~GateGraphBaseVisitor() = default;
virtual VNUser visit(GateLogicVertex* vertexp, VNUser vu = VNUser(0)) = 0; virtual VNUser visit(GateLogicVertex* vertexp, VNUser vu = VNUser{0}) = 0;
virtual VNUser visit(GateVarVertex* vertexp, VNUser vu = VNUser(0)) = 0; virtual VNUser visit(GateVarVertex* vertexp, VNUser vu = VNUser{0}) = 0;
VL_DEBUG_FUNC; // Declare debug() VL_DEBUG_FUNC; // Declare debug()
}; };
@ -102,10 +102,10 @@ public:
clearReducible(nonReducibleReason); clearReducible(nonReducibleReason);
clearDedupable(nonReducibleReason); clearDedupable(nonReducibleReason);
} }
virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) = 0; virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) = 0;
// Returns only the result from the LAST vertex iterated over // Returns only the result from the LAST vertex iterated over
VNUser iterateInEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) { VNUser iterateInEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) {
VNUser ret = VNUser(0); VNUser ret{0};
for (V3GraphEdge* edgep = inBeginp(); edgep; edgep = edgep->inNextp()) { for (V3GraphEdge* edgep = inBeginp(); edgep; edgep = edgep->inNextp()) {
ret = static_cast<GateEitherVertex*>(edgep->fromp())->accept(v, vu); ret = static_cast<GateEitherVertex*>(edgep->fromp())->accept(v, vu);
} }
@ -115,8 +115,8 @@ public:
// Note: This behaves differently than iterateInEdges() in that it will traverse // Note: This behaves differently than iterateInEdges() in that it will traverse
// all edges that exist when it is initially called, whereas // all edges that exist when it is initially called, whereas
// iterateInEdges() will stop traversing edges if one is deleted // iterateInEdges() will stop traversing edges if one is deleted
VNUser iterateCurrentOutEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) { VNUser iterateCurrentOutEdges(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) {
VNUser ret = VNUser(0); VNUser ret{0};
V3GraphEdge* next_edgep = nullptr; V3GraphEdge* next_edgep = nullptr;
for (V3GraphEdge* edgep = outBeginp(); edgep; edgep = next_edgep) { for (V3GraphEdge* edgep = outBeginp(); edgep; edgep = next_edgep) {
// Need to find the next edge before visiting in case the edge is deleted // Need to find the next edge before visiting in case the edge is deleted
@ -162,7 +162,7 @@ public:
setIsClock(); setIsClock();
} }
} }
virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) override { virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override {
return v.visit(this, vu); return v.visit(this, vu);
} }
}; };
@ -188,7 +188,7 @@ public:
AstNode* nodep() const { return m_nodep; } AstNode* nodep() const { return m_nodep; }
AstActive* activep() const { return m_activep; } AstActive* activep() const { return m_activep; }
bool slow() const { return m_slow; } bool slow() const { return m_slow; }
virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser(0)) override { virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override {
return v.visit(this, vu); return v.visit(this, vu);
} }
}; };
@ -1046,14 +1046,14 @@ private:
virtual VNUser visit(GateVarVertex* vvertexp, VNUser) override { virtual VNUser visit(GateVarVertex* vvertexp, VNUser) override {
// Check that we haven't been here before // Check that we haven't been here before
if (m_depth > GATE_DEDUP_MAX_DEPTH) if (m_depth > GATE_DEDUP_MAX_DEPTH)
return VNUser(0); // Break loops; before user2 set so hit this vertex later return VNUser{0}; // Break loops; before user2 set so hit this vertex later
if (vvertexp->varScp()->user2()) return VNUser(0); if (vvertexp->varScp()->user2()) return VNUser{0};
vvertexp->varScp()->user2(true); vvertexp->varScp()->user2(true);
m_depth++; m_depth++;
if (vvertexp->inSize1()) { if (vvertexp->inSize1()) {
AstNodeVarRef* const dupVarRefp = static_cast<AstNodeVarRef*>( AstNodeVarRef* const dupVarRefp = static_cast<AstNodeVarRef*>(
vvertexp->iterateInEdges(*this, VNUser(vvertexp)).toNodep()); vvertexp->iterateInEdges(*this, VNUser{vvertexp}).toNodep());
if (dupVarRefp) { // visit(GateLogicVertex*...) returned match if (dupVarRefp) { // visit(GateLogicVertex*...) returned match
const V3GraphEdge* edgep = vvertexp->inBeginp(); const V3GraphEdge* edgep = vvertexp->inBeginp();
GateLogicVertex* const lvertexp = static_cast<GateLogicVertex*>(edgep->fromp()); GateLogicVertex* const lvertexp = static_cast<GateLogicVertex*>(edgep->fromp());
@ -1100,7 +1100,7 @@ private:
} }
} }
m_depth--; m_depth--;
return VNUser(0); return VNUser{0};
} }
// Given iterated logic, starting at vu which was consumer's GateVarVertex // Given iterated logic, starting at vu which was consumer's GateVarVertex
@ -1118,9 +1118,9 @@ private:
// different generated clocks will never compare as equal, even if the // different generated clocks will never compare as equal, even if the
// generated clocks are deduped into one clock. // generated clocks are deduped into one clock.
AstActive* const activep = lvertexp->activep(); AstActive* const activep = lvertexp->activep();
return VNUser(m_varVisitor.findDupe(nodep, consumerVarScopep, activep)); return VNUser{m_varVisitor.findDupe(nodep, consumerVarScopep, activep)};
} }
return VNUser(0); return VNUser{0};
} }
public: public:
@ -1257,10 +1257,10 @@ private:
} }
} }
} }
return VNUser(0); return VNUser{0};
} }
virtual VNUser visit(GateLogicVertex*, VNUser) override { // virtual VNUser visit(GateLogicVertex*, VNUser) override { //
return VNUser(0); return VNUser{0};
} }
public: public:
@ -1363,7 +1363,7 @@ private:
virtual VNUser visit(GateVarVertex* vvertexp, VNUser vu) override { virtual VNUser visit(GateVarVertex* vvertexp, VNUser vu) override {
// Check that we haven't been here before // Check that we haven't been here before
AstVarScope* const vsp = vvertexp->varScp(); AstVarScope* const vsp = vvertexp->varScp();
if (vsp->user2SetOnce()) return VNUser(0); if (vsp->user2SetOnce()) return VNUser{0};
UINFO(9, "CLK DECOMP Var - " << vvertexp << " : " << vsp << endl); UINFO(9, "CLK DECOMP Var - " << vvertexp << " : " << vsp << endl);
if (vsp->varp()->width() > 1) { if (vsp->varp()->width() > 1) {
m_seen_clk_vectors++; m_seen_clk_vectors++;
@ -1371,10 +1371,10 @@ private:
} }
const GateClkDecompState* const currState = reinterpret_cast<GateClkDecompState*>(vu.c()); const GateClkDecompState* const currState = reinterpret_cast<GateClkDecompState*>(vu.c());
GateClkDecompState nextState(currState->m_offset, vsp); GateClkDecompState nextState(currState->m_offset, vsp);
vvertexp->iterateCurrentOutEdges(*this, VNUser(&nextState)); vvertexp->iterateCurrentOutEdges(*this, VNUser{&nextState});
if (vsp->varp()->width() > 1) --m_seen_clk_vectors; if (vsp->varp()->width() > 1) --m_seen_clk_vectors;
vsp->user2(false); vsp->user2(false);
return VNUser(0); // Unused return VNUser{0}; // Unused
} }
virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override { virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override {
@ -1390,37 +1390,37 @@ private:
UINFO(9, "CLK DECOMP Sel [ " << rselp->msbConst() << " : " UINFO(9, "CLK DECOMP Sel [ " << rselp->msbConst() << " : "
<< rselp->lsbConst() << " ] dropped clock (" << rselp->lsbConst() << " ] dropped clock ("
<< clk_offset << ")" << endl); << clk_offset << ")" << endl);
return VNUser(0); return VNUser{0};
} }
clk_offset -= rselp->lsbConst(); clk_offset -= rselp->lsbConst();
} else { } else {
return VNUser(0); return VNUser{0};
} }
} else if (AstConcat* const catp = VN_CAST(assignp->rhsp(), Concat)) { } else if (AstConcat* const catp = VN_CAST(assignp->rhsp(), Concat)) {
UINFO(9, "CLK DECOMP Concat searching - " << assignp->lhsp() << endl); UINFO(9, "CLK DECOMP Concat searching - " << assignp->lhsp() << endl);
int concat_offset; int concat_offset;
if (!m_concat_visitor.concatOffset(catp, currState->m_last_vsp, if (!m_concat_visitor.concatOffset(catp, currState->m_last_vsp,
concat_offset /*ref*/)) { concat_offset /*ref*/)) {
return VNUser(0); return VNUser{0};
} }
clk_offset += concat_offset; clk_offset += concat_offset;
} else if (VN_IS(assignp->rhsp(), VarRef)) { } else if (VN_IS(assignp->rhsp(), VarRef)) {
UINFO(9, "CLK DECOMP VarRef searching - " << assignp->lhsp() << endl); UINFO(9, "CLK DECOMP VarRef searching - " << assignp->lhsp() << endl);
} else { } else {
return VNUser(0); return VNUser{0};
} }
// LHS // LHS
if (const AstSel* const lselp = VN_CAST(assignp->lhsp(), Sel)) { if (const AstSel* const lselp = VN_CAST(assignp->lhsp(), Sel)) {
if (VN_IS(lselp->lsbp(), Const) && VN_IS(lselp->widthp(), Const)) { if (VN_IS(lselp->lsbp(), Const) && VN_IS(lselp->widthp(), Const)) {
clk_offset += lselp->lsbConst(); clk_offset += lselp->lsbConst();
} else { } else {
return VNUser(0); return VNUser{0};
} }
} else if (const AstVarRef* const vrp = VN_CAST(assignp->lhsp(), VarRef)) { } else if (const AstVarRef* const vrp = VN_CAST(assignp->lhsp(), VarRef)) {
if (vrp->dtypep()->width() == 1 && m_seen_clk_vectors) { if (vrp->dtypep()->width() == 1 && m_seen_clk_vectors) {
if (clk_offset != 0) { if (clk_offset != 0) {
UINFO(9, "Should only make it here with clk_offset = 0" << endl); UINFO(9, "Should only make it here with clk_offset = 0" << endl);
return VNUser(0); return VNUser{0};
} }
UINFO(9, "CLK DECOMP Connecting - " << assignp->lhsp() << endl); UINFO(9, "CLK DECOMP Connecting - " << assignp->lhsp() << endl);
UINFO(9, " to - " << m_clk_vsp << endl); UINFO(9, " to - " << m_clk_vsp << endl);
@ -1433,12 +1433,12 @@ private:
m_total_decomposed_clk_vectors++; m_total_decomposed_clk_vectors++;
} }
} else { } else {
return VNUser(0); return VNUser{0};
} }
GateClkDecompState nextState(clk_offset, currState->m_last_vsp); GateClkDecompState nextState(clk_offset, currState->m_last_vsp);
return lvertexp->iterateCurrentOutEdges(*this, VNUser(&nextState)); return lvertexp->iterateCurrentOutEdges(*this, VNUser{&nextState});
} }
return VNUser(0); return VNUser{0};
} }
public: public:
@ -1455,7 +1455,7 @@ public:
m_clk_vsp = vvertexp->varScp(); m_clk_vsp = vvertexp->varScp();
m_clk_vvertexp = vvertexp; m_clk_vvertexp = vvertexp;
GateClkDecompState nextState(0, m_clk_vsp); GateClkDecompState nextState(0, m_clk_vsp);
vvertexp->accept(*this, VNUser(&nextState)); vvertexp->accept(*this, VNUser{&nextState});
} }
}; };

View File

@ -48,7 +48,7 @@ public:
"1800-2005", "1800-2009", "1800-2012", "1800-2017"}; "1800-2005", "1800-2009", "1800-2012", "1800-2017"};
return names[m_e]; return names[m_e];
} }
static V3LangCode mostRecent() { return V3LangCode(L1800_2017); } static V3LangCode mostRecent() { return V3LangCode{L1800_2017}; }
bool systemVerilog() const { bool systemVerilog() const {
return m_e == L1800_2005 || m_e == L1800_2009 || m_e == L1800_2012 || m_e == L1800_2017; return m_e == L1800_2005 || m_e == L1800_2009 || m_e == L1800_2012 || m_e == L1800_2017;
} }

View File

@ -165,7 +165,7 @@ public:
checkRemoveAssign(it); checkRemoveAssign(it);
it->second.simpleAssign(assp); it->second.simpleAssign(assp);
} else { } else {
m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::SIMPLEASSIGN(), assp)); m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::SIMPLEASSIGN{}, assp});
} }
// lifeDump(); // lifeDump();
} }
@ -175,7 +175,7 @@ public:
if (it != m_map.end()) { if (it != m_map.end()) {
it->second.complexAssign(); it->second.complexAssign();
} else { } else {
m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::COMPLEXASSIGN())); m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::COMPLEXASSIGN{}});
} }
} }
void varUsageReplace(AstVarScope* nodep, AstVarRef* varrefp) { void varUsageReplace(AstVarScope* nodep, AstVarRef* varrefp) {
@ -196,7 +196,7 @@ public:
UINFO(4, " usage: " << nodep << endl); UINFO(4, " usage: " << nodep << endl);
it->second.consumed(); it->second.consumed();
} else { } else {
m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::CONSUMED())); m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::CONSUMED{}});
} }
} }
void complexAssignFind(AstVarScope* nodep) { void complexAssignFind(AstVarScope* nodep) {
@ -205,7 +205,7 @@ public:
UINFO(4, " casfind: " << it->first << endl); UINFO(4, " casfind: " << it->first << endl);
it->second.complexAssign(); it->second.complexAssign();
} else { } else {
m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::COMPLEXASSIGN())); m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::COMPLEXASSIGN{}});
} }
} }
void consumedFind(AstVarScope* nodep) { void consumedFind(AstVarScope* nodep) {
@ -213,7 +213,7 @@ public:
if (it != m_map.end()) { if (it != m_map.end()) {
it->second.consumed(); it->second.consumed();
} else { } else {
m_map.emplace(nodep, LifeVarEntry(LifeVarEntry::CONSUMED())); m_map.emplace(nodep, LifeVarEntry{LifeVarEntry::CONSUMED{}});
} }
} }
void lifeToAbove() { void lifeToAbove() {

View File

@ -59,7 +59,7 @@ private:
UASSERT_OBJ(vscp, nodep, "Scope not assigned"); UASSERT_OBJ(vscp, nodep, "Scope not assigned");
if (AstVarScope* const newvscp = reinterpret_cast<AstVarScope*>(vscp->user4p())) { if (AstVarScope* const newvscp = reinterpret_cast<AstVarScope*>(vscp->user4p())) {
UINFO(9, " Replace " << nodep << " to " << newvscp << endl); UINFO(9, " Replace " << nodep << " to " << newvscp << endl);
AstVarRef* const newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->access()); AstVarRef* const newrefp = new AstVarRef{nodep->fileline(), newvscp, nodep->access()};
nodep->replaceWith(newrefp); nodep->replaceWith(newrefp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
} }

View File

@ -1024,7 +1024,7 @@ class LinkDotFindVisitor final : public VNVisitor {
} }
AstVar* const newvarp AstVar* const newvarp
= new AstVar(nodep->fileline(), VVarType::VAR, nodep->name(), = new AstVar(nodep->fileline(), VVarType::VAR, nodep->name(),
VFlagChildDType(), dtypep); // Not dtype resolved yet VFlagChildDType{}, dtypep); // Not dtype resolved yet
newvarp->direction(VDirection::OUTPUT); newvarp->direction(VDirection::OUTPUT);
newvarp->lifetime(VLifetime::AUTOMATIC); newvarp->lifetime(VLifetime::AUTOMATIC);
newvarp->funcReturn(true); newvarp->funcReturn(true);
@ -1139,8 +1139,8 @@ class LinkDotFindVisitor final : public VNVisitor {
// We first search if the parameter is overwritten and then replace it with a // We first search if the parameter is overwritten and then replace it with a
// new value. It will keep the same FileLine information. // new value. It will keep the same FileLine information.
if (v3Global.opt.hasParameter(nodep->name())) { if (v3Global.opt.hasParameter(nodep->name())) {
AstVar* const newp = new AstVar( AstVar* const newp = new AstVar{
nodep->fileline(), VVarType(VVarType::GPARAM), nodep->name(), nodep); nodep->fileline(), VVarType{VVarType::GPARAM}, nodep->name(), nodep};
newp->combineType(nodep); newp->combineType(nodep);
const string svalue = v3Global.opt.parameter(nodep->name()); const string svalue = v3Global.opt.parameter(nodep->name());
if (AstNode* const valuep if (AstNode* const valuep
@ -1935,7 +1935,7 @@ private:
} }
} }
AstVar* const newp = new AstVar(nodep->fileline(), VVarType::WIRE, nodep->name(), AstVar* const newp = new AstVar(nodep->fileline(), VVarType::WIRE, nodep->name(),
VFlagLogicPacked(), 1); VFlagLogicPacked{}, 1);
newp->trace(modp->modTrace()); newp->trace(modp->modTrace());
nodep->varp(newp); nodep->varp(newp);
modp->addStmtp(newp); modp->addStmtp(newp);
@ -2509,7 +2509,7 @@ private:
UINFO(7, " ErrParseRef curSymp=se" << cvtToHex(m_curSymp) UINFO(7, " ErrParseRef curSymp=se" << cvtToHex(m_curSymp)
<< " ds=" << m_ds.ascii() << endl); << " ds=" << m_ds.ascii() << endl);
const string suggest = m_statep->suggestSymFallback( const string suggest = m_statep->suggestSymFallback(
m_ds.m_dotSymp, nodep->name(), VNodeMatcher()); m_ds.m_dotSymp, nodep->name(), VNodeMatcher{});
nodep->v3error("Can't find definition of " nodep->v3error("Can't find definition of "
<< expectWhat << ": " << nodep->prettyNameQ() << '\n' << expectWhat << ": " << nodep->prettyNameQ() << '\n'
<< (suggest.empty() ? "" : nodep->warnMore() + suggest)); << (suggest.empty() ? "" : nodep->warnMore() + suggest));

View File

@ -94,7 +94,7 @@ void V3LinkLevel::timescaling(const ModVec& mods) {
} }
} }
unit = v3Global.opt.timeComputeUnit(unit); // Apply override unit = v3Global.opt.timeComputeUnit(unit); // Apply override
if (unit.isNone()) unit = VTimescale(VTimescale::TS_DEFAULT); if (unit.isNone()) unit = VTimescale{VTimescale::TS_DEFAULT};
v3Global.rootp()->timeunit(unit); v3Global.rootp()->timeunit(unit);
bool dunitTimed = false; // $unit had a timeunit bool dunitTimed = false; // $unit had a timeunit
@ -127,7 +127,7 @@ void V3LinkLevel::timescaling(const ModVec& mods) {
if (v3Global.rootp()->timeprecision().isNone()) { if (v3Global.rootp()->timeprecision().isNone()) {
v3Global.rootp()->timeprecisionMerge(v3Global.rootp()->fileline(), v3Global.rootp()->timeprecisionMerge(v3Global.rootp()->fileline(),
VTimescale(VTimescale::TS_DEFAULT)); VTimescale{VTimescale::TS_DEFAULT});
} }
// Classes under package have timescale propaged in V3LinkParse // Classes under package have timescale propaged in V3LinkParse

View File

@ -73,7 +73,7 @@ private:
// We could have verilog.l create a new one on every token, // We could have verilog.l create a new one on every token,
// but that's a lot more structures than only doing AST nodes. // but that's a lot more structures than only doing AST nodes.
if (m_filelines.find(nodep->fileline()) != m_filelines.end()) { if (m_filelines.find(nodep->fileline()) != m_filelines.end()) {
nodep->fileline(new FileLine(nodep->fileline())); nodep->fileline(new FileLine{nodep->fileline()});
} }
m_filelines.insert(nodep->fileline()); m_filelines.insert(nodep->fileline());
} }

View File

@ -113,7 +113,7 @@ public:
V3LangCode::V3LangCode(const char* textp) { V3LangCode::V3LangCode(const char* textp) {
// Return code for given string, or ERROR, which is a bad code // Return code for given string, or ERROR, which is a bad code
for (int codei = V3LangCode::L_ERROR; codei < V3LangCode::_ENUM_END; ++codei) { for (int codei = V3LangCode::L_ERROR; codei < V3LangCode::_ENUM_END; ++codei) {
const V3LangCode code = V3LangCode(codei); const V3LangCode code{codei};
if (0 == VL_STRCASECMP(textp, code.ascii())) { if (0 == VL_STRCASECMP(textp, code.ascii())) {
m_e = code; m_e = code;
return; return;
@ -265,7 +265,7 @@ void VTimescale::parseSlashed(FileLine* fl, const char* textp, VTimescale& unitr
if (!precStr.empty()) { if (!precStr.empty()) {
VTimescale prec(VTimescale::NONE); VTimescale prec(VTimescale::NONE);
bool precbad; bool precbad;
prec = VTimescale(precStr, precbad /*ref*/); prec = VTimescale{precStr, precbad /*ref*/};
if (precbad) { if (precbad) {
fl->v3error("`timescale timeprecision syntax error: '" << precStr << "'"); fl->v3error("`timescale timeprecision syntax error: '" << precStr << "'");
return; return;
@ -1164,7 +1164,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
DECL_OPTION("-LDFLAGS", CbVal, callStrSetter(&V3Options::addLdLibs)); DECL_OPTION("-LDFLAGS", CbVal, callStrSetter(&V3Options::addLdLibs));
const auto setLang = [this, fl](const char* valp) { const auto setLang = [this, fl](const char* valp) {
const V3LangCode optval = V3LangCode(valp); const V3LangCode optval{valp};
if (optval.legal()) { if (optval.legal()) {
m_defaultLanguage = optval; m_defaultLanguage = optval;
} else { } else {

View File

@ -1335,9 +1335,10 @@ class OrderProcess final : VNDeleter {
~OrderProcess() override { ~OrderProcess() override {
// Stats // Stats
for (int type = 0; type < OrderVEdgeType::_ENUM_END; type++) { for (int type = 0; type < OrderVEdgeType::_ENUM_END; type++) {
const double count = double(m_statCut[type]); const double count{m_statCut[type]};
if (count != 0.0) { if (count != 0.0) {
V3Stats::addStat(string("Order, cut, ") + OrderVEdgeType(type).ascii(), count); V3Stats::addStat(std::string{"Order, cut, "} + OrderVEdgeType{type}.ascii(),
count);
} }
} }
} }

View File

@ -89,19 +89,19 @@ void V3ParseImp::lexTimescaleParse(FileLine* fl, const char* textp) {
} }
void V3ParseImp::timescaleMod(FileLine* fl, AstNodeModule* modp, bool unitSet, double unitVal, void V3ParseImp::timescaleMod(FileLine* fl, AstNodeModule* modp, bool unitSet, double unitVal,
bool precSet, double precVal) { bool precSet, double precVal) {
VTimescale unit(VTimescale::NONE); VTimescale unit{VTimescale::NONE};
if (unitSet) { if (unitSet) {
bool bad; bool bad;
unit = VTimescale(unitVal, bad /*ref*/); unit = VTimescale{unitVal, bad /*ref*/};
if (bad) { if (bad) {
UINFO(1, "Value = " << unitVal << endl); UINFO(1, "Value = " << unitVal << endl);
fl->v3error("timeunit illegal value"); fl->v3error("timeunit illegal value");
} }
} }
VTimescale prec(VTimescale::NONE); VTimescale prec{VTimescale::NONE};
if (precSet) { if (precSet) {
bool bad; bool bad;
prec = VTimescale(precVal, bad /*ref*/); prec = VTimescale{precVal, bad /*ref*/};
if (bad) { if (bad) {
UINFO(1, "Value = " << precVal << endl); UINFO(1, "Value = " << precVal << endl);
fl->v3error("timeprecision illegal value"); fl->v3error("timeprecision illegal value");

View File

@ -625,8 +625,8 @@ private:
iterate(nodep->lhsp()); iterate(nodep->lhsp());
if (optimizable()) { if (optimizable()) {
if (fetchConst(nodep->lhsp())->num().isEqZero()) { if (fetchConst(nodep->lhsp())->num().isEqZero()) {
const AstConst cnst(nodep->fileline(), AstConst::WidthedValue(), 1, const AstConst cnst{nodep->fileline(), AstConst::WidthedValue{}, 1,
1); // a one 1}; // a one
newValue(nodep, &cnst); // a one newValue(nodep, &cnst); // a one
} else { } else {
iterate(nodep->rhsp()); iterate(nodep->rhsp());
@ -1022,8 +1022,8 @@ private:
m_callStack.push_back(&stackNode); m_callStack.push_back(&stackNode);
// Clear output variable // Clear output variable
if (const auto* const basicp = VN_CAST(funcp->fvarp(), Var)->basicp()) { if (const auto* const basicp = VN_CAST(funcp->fvarp(), Var)->basicp()) {
AstConst cnst(funcp->fvarp()->fileline(), AstConst::WidthedValue(), basicp->widthMin(), AstConst cnst{funcp->fvarp()->fileline(), AstConst::WidthedValue{}, basicp->widthMin(),
0); 0};
if (basicp->isZeroInit()) { if (basicp->isZeroInit()) {
cnst.num().setAllBits0(); cnst.num().setAllBits0();
} else { } else {

View File

@ -231,7 +231,7 @@ public:
V3Stats::addStat(m_stage, "Var space, scoped, bytes", m_statVarScpBytes); V3Stats::addStat(m_stage, "Var space, scoped, bytes", m_statVarScpBytes);
} }
for (unsigned i = 0; i < m_statVarWidths.size(); i++) { for (unsigned i = 0; i < m_statVarWidths.size(); i++) {
const double count = double(m_statVarWidths.at(i)); const double count{m_statVarWidths.at(i)};
if (count != 0.0) { if (count != 0.0) {
if (v3Global.opt.statsVars()) { if (v3Global.opt.statsVars()) {
const NameMap& nameMapr = m_statVarWidthNames.at(i); const NameMap& nameMapr = m_statVarWidthNames.at(i);
@ -249,7 +249,7 @@ public:
} }
// Node types // Node types
for (int type = 0; type < VNType::_ENUM_END; type++) { for (int type = 0; type < VNType::_ENUM_END; type++) {
const double count = double(m_statTypeCount.at(type)); const double count{m_statTypeCount.at(type)};
if (count != 0.0) { if (count != 0.0) {
V3Stats::addStat(m_stage, std::string{"Node count, "} + VNType{type}.ascii(), V3Stats::addStat(m_stage, std::string{"Node count, "} + VNType{type}.ascii(),
count); count);
@ -257,18 +257,18 @@ public:
} }
for (int type = 0; type < VNType::_ENUM_END; type++) { for (int type = 0; type < VNType::_ENUM_END; type++) {
for (int type2 = 0; type2 < VNType::_ENUM_END; type2++) { for (int type2 = 0; type2 < VNType::_ENUM_END; type2++) {
const double count = double(m_statAbove[type][type2]); const double count{m_statAbove[type][type2]};
if (count != 0.0) { if (count != 0.0) {
V3Stats::addStat(m_stage, V3Stats::addStat(m_stage,
(std::string{"Node pairs, "} + VNType{type}.ascii() + "_" (std::string{"Node pairs, "} + VNType{type}.ascii() + "_"
+ VNType(type2).ascii()), + VNType{type2}.ascii()),
count); count);
} }
} }
} }
// Branch pred // Branch pred
for (int type = 0; type < VBranchPred::_ENUM_END; type++) { for (int type = 0; type < VBranchPred::_ENUM_END; type++) {
const double count = double(m_statPred[type]); const double count{m_statPred[type]};
if (count != 0.0) { if (count != 0.0) {
V3Stats::addStat(m_stage, V3Stats::addStat(m_stage,
(std::string{"Branch prediction, "} + VBranchPred{type}.ascii()), (std::string{"Branch prediction, "} + VBranchPred{type}.ascii()),

View File

@ -298,8 +298,8 @@ private:
uint32_t shift = 0; uint32_t shift = 0;
for (AstVarScope* invscp : m_inVarps) { for (AstVarScope* invscp : m_inVarps) {
// LSB is first variable, so extract it that way // LSB is first variable, so extract it that way
const AstConst cnst(invscp->fileline(), AstConst::WidthedValue(), invscp->width(), const AstConst cnst{invscp->fileline(), AstConst::WidthedValue{}, invscp->width(),
VL_MASK_I(invscp->width()) & (inValue >> shift)); VL_MASK_I(invscp->width()) & (inValue >> shift)};
simvis.newValue(invscp, &cnst); simvis.newValue(invscp, &cnst);
shift += invscp->width(); shift += invscp->width();
// We are using 32 bit arithmetic, because there's no way the input table can be // We are using 32 bit arithmetic, because there's no way the input table can be

View File

@ -392,7 +392,7 @@ private:
// Everything downstream is packed, so deal with as one trace unit. // Everything downstream is packed, so deal with as one trace unit.
// This may not be the nicest for user presentation, but is // This may not be the nicest for user presentation, but is
// a much faster way to trace // a much faster way to trace
addTraceDecl(VNumRange(), nodep->width()); addTraceDecl(VNumRange{}, nodep->width());
} else { } else {
FileLine* const flp = nodep->fileline(); FileLine* const flp = nodep->fileline();
AstNodeDType* const subtypep = nodep->subDTypep()->skipRefToEnump(); AstNodeDType* const subtypep = nodep->subDTypep()->skipRefToEnump();
@ -418,7 +418,7 @@ private:
// Everything downstream is packed, so deal with as one trace unit // Everything downstream is packed, so deal with as one trace unit
// This may not be the nicest for user presentation, but is // This may not be the nicest for user presentation, but is
// a much faster way to trace // a much faster way to trace
addTraceDecl(VNumRange(), nodep->width()); addTraceDecl(VNumRange{}, nodep->width());
} else if (!nodep->packed()) { } else if (!nodep->packed()) {
addIgnore("Unsupported: Unpacked struct/union"); addIgnore("Unsupported: Unpacked struct/union");
} else { } else {
@ -454,7 +454,7 @@ private:
if (nodep->isString()) { if (nodep->isString()) {
addIgnore("Unsupported: strings"); addIgnore("Unsupported: strings");
} else { } else {
addTraceDecl(VNumRange(), 0); addTraceDecl(VNumRange{}, 0);
} }
} }
} }

View File

@ -331,8 +331,8 @@ private:
// We use the special XTEMP type so it doesn't break pure functions // We use the special XTEMP type so it doesn't break pure functions
UASSERT_OBJ(m_modp, nodep, "X number not under module"); UASSERT_OBJ(m_modp, nodep, "X number not under module");
AstVar* const newvarp AstVar* const newvarp
= new AstVar(nodep->fileline(), VVarType::XTEMP, m_xrandNames.get(nodep), = new AstVar{nodep->fileline(), VVarType::XTEMP, m_xrandNames.get(nodep),
VFlagLogicPacked(), nodep->width()); VFlagLogicPacked{}, nodep->width()};
newvarp->lifetime(VLifetime::STATIC); newvarp->lifetime(VLifetime::STATIC);
++m_statUnkVars; ++m_statUnkVars;
VNRelinker replaceHandle; VNRelinker replaceHandle;
@ -454,7 +454,7 @@ private:
nodep->unlinkFrBack(&replaceHandle); nodep->unlinkFrBack(&replaceHandle);
V3Number xnum(nodep, nodep->width()); V3Number xnum(nodep, nodep->width());
if (nodep->isString()) { if (nodep->isString()) {
xnum = V3Number(V3Number::String(), nodep, ""); xnum = V3Number{V3Number::String{}, nodep, ""};
} else { } else {
xnum.setAllBitsX(); xnum.setAllBitsX();
} }

View File

@ -6282,7 +6282,7 @@ private:
VNumRange declRange; // ranged() set false VNumRange declRange; // ranged() set false
for (int i = 1; i <= dim; ++i) { for (int i = 1; i <= dim; ++i) {
// UINFO(9, " dim at "<<dim<<" "<<dtypep<<endl); // UINFO(9, " dim at "<<dim<<" "<<dtypep<<endl);
declRange = VNumRange(); // ranged() set false declRange = VNumRange{}; // ranged() set false
if (const AstNodeArrayDType* const adtypep = VN_CAST(dtypep, NodeArrayDType)) { if (const AstNodeArrayDType* const adtypep = VN_CAST(dtypep, NodeArrayDType)) {
declRange = adtypep->declRange(); declRange = adtypep->declRange();
if (i < dim) dtypep = adtypep->subDTypep()->skipRefp(); if (i < dim) dtypep = adtypep->subDTypep()->skipRefp();

View File

@ -524,8 +524,8 @@ private:
// up array: lsb/hi -: width // up array: lsb/hi -: width
const int32_t msb = VN_IS(nodep, SelPlus) ? rhs + width - 1 : rhs; const int32_t msb = VN_IS(nodep, SelPlus) ? rhs + width - 1 : rhs;
const int32_t lsb = VN_IS(nodep, SelPlus) ? rhs : rhs - width + 1; const int32_t lsb = VN_IS(nodep, SelPlus) ? rhs : rhs - width + 1;
AstSliceSel* const newp = new AstSliceSel( AstSliceSel* const newp = new AstSliceSel{
nodep->fileline(), fromp, VNumRange(msb, lsb, fromRange.littleEndian())); nodep->fileline(), fromp, VNumRange{msb, lsb, fromRange.littleEndian()}};
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { } else {

View File

@ -3926,7 +3926,7 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or
| yD_POW '(' expr ',' expr ')' { $$ = new AstPowD($1,$3,$5); } | yD_POW '(' expr ',' expr ')' { $$ = new AstPowD($1,$3,$5); }
| yD_RANDOM '(' expr ')' { $$ = new AstRand($1, $3, false); } | yD_RANDOM '(' expr ')' { $$ = new AstRand($1, $3, false); }
| yD_RANDOM parenE { $$ = new AstRand($1, nullptr, false); } | yD_RANDOM parenE { $$ = new AstRand($1, nullptr, false); }
| yD_REALTIME parenE { $$ = new AstTimeD($1, VTimescale(VTimescale::NONE)); } | yD_REALTIME parenE { $$ = new AstTimeD{$1, VTimescale{VTimescale::NONE}}; }
| yD_REALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); } | yD_REALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); }
| yD_REWIND '(' idClassSel ')' { $$ = new AstFSeek($1, $3, new AstConst($1, 0), new AstConst($1, 0)); } | yD_REWIND '(' idClassSel ')' { $$ = new AstFSeek($1, $3, new AstConst($1, 0), new AstConst($1, 0)); }
| yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_RIGHT,$3,nullptr); } | yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_RIGHT,$3,nullptr); }
@ -3944,13 +3944,14 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or
| yD_SIZE '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_SIZE,$3,$5); } | yD_SIZE '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_SIZE,$3,$5); }
| yD_SQRT '(' expr ')' { $$ = new AstSqrtD($1,$3); } | yD_SQRT '(' expr ')' { $$ = new AstSqrtD($1,$3); }
| yD_SSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstSScanF($1,*$5,$3,$6); } | yD_SSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstSScanF($1,*$5,$3,$6); }
| yD_STIME parenE { $$ = new AstSel($1, new AstTime($1, VTimescale(VTimescale::NONE)), 0, 32); } | yD_STIME parenE
{ $$ = new AstSel{$1, new AstTime{$1, VTimescale{VTimescale::NONE}}, 0, 32}; }
| yD_STABLE '(' expr ')' { $$ = new AstStable($1,$3); } | yD_STABLE '(' expr ')' { $$ = new AstStable($1,$3); }
| yD_STABLE '(' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $stable and clock arguments"); } | yD_STABLE '(' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $stable and clock arguments"); }
| yD_TAN '(' expr ')' { $$ = new AstTanD($1,$3); } | yD_TAN '(' expr ')' { $$ = new AstTanD($1,$3); }
| yD_TANH '(' expr ')' { $$ = new AstTanhD($1,$3); } | yD_TANH '(' expr ')' { $$ = new AstTanhD($1,$3); }
| yD_TESTPLUSARGS '(' expr ')' { $$ = new AstTestPlusArgs($1, $3); } | yD_TESTPLUSARGS '(' expr ')' { $$ = new AstTestPlusArgs($1, $3); }
| yD_TIME parenE { $$ = new AstTime($1, VTimescale(VTimescale::NONE)); } | yD_TIME parenE { $$ = new AstTime{$1, VTimescale{VTimescale::NONE}}; }
| yD_TYPENAME '(' exprOrDataType ')' { $$ = new AstAttrOf($1, VAttrType::TYPENAME, $3); } | yD_TYPENAME '(' exprOrDataType ')' { $$ = new AstAttrOf($1, VAttrType::TYPENAME, $3); }
| yD_UNGETC '(' expr ',' expr ')' { $$ = new AstFUngetC($1, $5, $3); } // Arg swap to file first | yD_UNGETC '(' expr ',' expr ')' { $$ = new AstFUngetC($1, $5, $3); } // Arg swap to file first
| yD_UNPACKED_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_UNPK_DIMENSIONS,$3); } | yD_UNPACKED_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_UNPK_DIMENSIONS,$3); }
@ -6631,7 +6632,7 @@ vltOffFront<errcodeen>:
| yVLT_TRACING_OFF { $$ = V3ErrorCode::I_TRACING; } | yVLT_TRACING_OFF { $$ = V3ErrorCode::I_TRACING; }
| yVLT_LINT_OFF { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_OFF { $$ = V3ErrorCode::I_LINT; }
| yVLT_LINT_OFF yVLT_D_RULE idAny | yVLT_LINT_OFF yVLT_D_RULE idAny
{ $$ = V3ErrorCode((*$3).c_str()); { $$ = V3ErrorCode{(*$3).c_str()};
if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: " << *$3); } } if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: " << *$3); } }
; ;
@ -6640,7 +6641,7 @@ vltOnFront<errcodeen>:
| yVLT_TRACING_ON { $$ = V3ErrorCode::I_TRACING; } | yVLT_TRACING_ON { $$ = V3ErrorCode::I_TRACING; }
| yVLT_LINT_ON { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_ON { $$ = V3ErrorCode::I_LINT; }
| yVLT_LINT_ON yVLT_D_RULE idAny | yVLT_LINT_ON yVLT_D_RULE idAny
{ $$ = V3ErrorCode((*$3).c_str()); { $$ = V3ErrorCode{(*$3).c_str()};
if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: " << *$3); } } if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: " << *$3); } }
; ;