Internals: Fix constructor style.

This commit is contained in:
Wilson Snyder 2022-11-20 15:06:49 -05:00
parent 3abb65d732
commit 25f970eac2
23 changed files with 201 additions and 201 deletions

View File

@ -59,9 +59,9 @@ private:
if (!senip) senip = m_seniAlwaysp;
if (!senip) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Unclocked assertion");
newp = new AstSenTree(nodep->fileline(), nullptr);
newp = new AstSenTree{nodep->fileline(), nullptr};
} else {
newp = new AstSenTree(nodep->fileline(), senip->cloneTree(true));
newp = new AstSenTree{nodep->fileline(), senip->cloneTree(true)};
}
return newp;
}
@ -171,10 +171,10 @@ private:
iterateChildren(nodep);
FileLine* const fl = nodep->fileline();
AstNodeExpr* exprp = nodep->exprp()->unlinkFrBack();
if (exprp->width() > 1) exprp = new AstSel(fl, exprp, 0, 1);
AstNodeExpr* const past = new AstPast(fl, exprp, nullptr);
if (exprp->width() > 1) exprp = new AstSel{fl, exprp, 0, 1};
AstNodeExpr* const past = new AstPast{fl, exprp, nullptr};
past->dtypeFrom(exprp);
exprp = new AstAnd(fl, past, new AstNot(fl, exprp->cloneTree(false)));
exprp = new AstAnd{fl, past, new AstNot{fl, exprp->cloneTree(false)}};
exprp->dtypeSetBit();
nodep->replaceWith(exprp);
nodep->sentreep(newSenTree(nodep));
@ -190,10 +190,10 @@ private:
iterateChildren(nodep);
FileLine* const fl = nodep->fileline();
AstNodeExpr* exprp = nodep->exprp()->unlinkFrBack();
if (exprp->width() > 1) exprp = new AstSel(fl, exprp, 0, 1);
AstNodeExpr* const past = new AstPast(fl, exprp, nullptr);
if (exprp->width() > 1) exprp = new AstSel{fl, exprp, 0, 1};
AstNodeExpr* const past = new AstPast{fl, exprp, nullptr};
past->dtypeFrom(exprp);
exprp = new AstAnd(fl, new AstNot(fl, past), exprp->cloneTree(false));
exprp = new AstAnd{fl, new AstNot{fl, past}, exprp->cloneTree(false)};
exprp->dtypeSetBit();
nodep->replaceWith(exprp);
nodep->sentreep(newSenTree(nodep));
@ -204,9 +204,9 @@ private:
iterateChildren(nodep);
FileLine* const fl = nodep->fileline();
AstNodeExpr* exprp = nodep->exprp()->unlinkFrBack();
AstNodeExpr* const past = new AstPast(fl, exprp, nullptr);
AstNodeExpr* const past = new AstPast{fl, exprp, nullptr};
past->dtypeFrom(exprp);
exprp = new AstEq(fl, past, exprp->cloneTree(false));
exprp = new AstEq{fl, past, exprp->cloneTree(false)};
exprp->dtypeSetBit();
nodep->replaceWith(exprp);
nodep->sentreep(newSenTree(nodep));
@ -220,11 +220,11 @@ private:
AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack();
AstNodeExpr* lhsp = nodep->lhsp()->unlinkFrBack();
if (m_disablep) lhsp = new AstAnd(fl, new AstNot(fl, m_disablep), lhsp);
if (m_disablep) lhsp = new AstAnd{fl, new AstNot{fl, m_disablep}, lhsp};
AstNodeExpr* const past = new AstPast(fl, lhsp, nullptr);
AstNodeExpr* const past = new AstPast{fl, lhsp, nullptr};
past->dtypeFrom(lhsp);
AstNodeExpr* const exprp = new AstOr(fl, new AstNot(fl, past), rhsp);
AstNodeExpr* const exprp = new AstOr{fl, new AstNot{fl, past}, rhsp};
exprp->dtypeSetBit();
nodep->replaceWith(exprp);
nodep->sentreep(newSenTree(nodep));
@ -242,11 +242,11 @@ private:
if (AstNodeExpr* const disablep = nodep->disablep()) {
m_disablep = disablep->cloneTree(false);
if (VN_IS(nodep->backp(), Cover)) {
blockp = new AstAnd(disablep->fileline(),
new AstNot(disablep->fileline(), disablep->unlinkFrBack()),
blockp);
blockp = new AstAnd{disablep->fileline(),
new AstNot{disablep->fileline(), disablep->unlinkFrBack()},
blockp};
} else {
blockp = new AstOr(disablep->fileline(), disablep->unlinkFrBack(), blockp);
blockp = new AstOr{disablep->fileline(), disablep->unlinkFrBack(), blockp};
}
}
// Unlink and just keep a pointer to it, convert to sentree as needed

View File

@ -132,7 +132,7 @@ bool AstActive::hasCombo() const { return m_sensesp->hasCombo(); }
AstElabDisplay::AstElabDisplay(FileLine* fl, VDisplayType dispType, AstNodeExpr* exprsp)
: ASTGEN_SUPER_ElabDisplay(fl) {
addFmtp(new AstSFormatF{fl, AstSFormatF::NoFormat(), exprsp});
addFmtp(new AstSFormatF{fl, AstSFormatF::NoFormat{}, exprsp});
m_displayType = dispType;
}

View File

@ -436,7 +436,7 @@ class AstNodeReadWriteMem VL_NOT_FINAL : public AstNodeStmt {
public:
AstNodeReadWriteMem(VNType t, FileLine* fl, bool hex, AstNodeExpr* filenamep,
AstNodeExpr* memp, AstNodeExpr* lsbp, AstNodeExpr* msbp)
: AstNodeStmt(t, fl)
: AstNodeStmt{t, fl}
, m_isHex(hex) {
this->filenamep(filenamep);
this->memp(memp);
@ -480,8 +480,8 @@ private:
bool m_tracking; // When emit, it's ok to parse the string to do indentation
public:
AstNodeSimpleText(VNType t, FileLine* fl, const string& textp, bool tracking = false)
: AstNodeText(t, fl, textp)
, m_tracking(tracking) {}
: AstNodeText{t, fl, textp}
, m_tracking{tracking} {}
ASTGEN_MEMBERS_AstNodeSimpleText;
void tracking(bool flag) { m_tracking = flag; }
bool tracking() const { return m_tracking; }
@ -2541,7 +2541,7 @@ public:
char missingArgChar = 'd')
: ASTGEN_SUPER_Display(fl)
, m_displayType{dispType} {
this->fmtp(new AstSFormatF{fl, AstSFormatF::NoFormat(), exprsp, missingArgChar});
this->fmtp(new AstSFormatF{fl, AstSFormatF::NoFormat{}, exprsp, missingArgChar});
this->filep(filep);
}
ASTGEN_MEMBERS_AstDisplay;
@ -2916,7 +2916,7 @@ public:
}
AstSFormat(FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* exprsp, char missingArgChar = 'd')
: ASTGEN_SUPER_SFormat(fl) {
this->fmtp(new AstSFormatF{fl, AstSFormatF::NoFormat(), exprsp, missingArgChar});
this->fmtp(new AstSFormatF{fl, AstSFormatF::NoFormat{}, exprsp, missingArgChar});
this->lhsp(lhsp);
}
ASTGEN_MEMBERS_AstSFormat;
@ -3507,7 +3507,7 @@ public:
void commas(bool flag) { m_commas = flag; }
bool commas() const { return m_commas; }
void addText(FileLine* fl, const string& textp, bool tracking = false) {
addNodesp(new AstText(fl, textp, tracking));
addNodesp(new AstText{fl, textp, tracking});
}
};

View File

@ -254,21 +254,21 @@ int AstNodeUOrStructDType::widthAlignBytes() const {
AstNodeBiop* AstEq::newTyped(FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp) {
if (lhsp->isString() && rhsp->isString()) {
return new AstEqN(fl, lhsp, rhsp);
return new AstEqN{fl, lhsp, rhsp};
} else if (lhsp->isDouble() && rhsp->isDouble()) {
return new AstEqD(fl, lhsp, rhsp);
return new AstEqD{fl, lhsp, rhsp};
} else {
return new AstEq(fl, lhsp, rhsp);
return new AstEq{fl, lhsp, rhsp};
}
}
AstNodeBiop* AstEqWild::newTyped(FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* rhsp) {
if (lhsp->isString() && rhsp->isString()) {
return new AstEqN(fl, lhsp, rhsp);
return new AstEqN{fl, lhsp, rhsp};
} else if (lhsp->isDouble() && rhsp->isDouble()) {
return new AstEqD(fl, lhsp, rhsp);
return new AstEqD{fl, lhsp, rhsp};
} else {
return new AstEqWild(fl, lhsp, rhsp);
return new AstEqWild{fl, lhsp, rhsp};
}
}
@ -285,7 +285,7 @@ AstNodeExpr* AstInsideRange::newAndFromInside(AstNodeExpr* exprp, AstNodeExpr* l
AstNodeExpr* const bp = new AstLte{fileline(), exprp->cloneTree(true), rhsp};
ap->fileline()->modifyWarnOff(V3ErrorCode::UNSIGNED, true);
bp->fileline()->modifyWarnOff(V3ErrorCode::CMPCONST, true);
return new AstAnd(fileline(), ap, bp);
return new AstAnd{fileline(), ap, bp};
}
AstConst* AstConst::parseParamLiteral(FileLine* fl, const string& literal) {
@ -293,11 +293,11 @@ AstConst* AstConst::parseParamLiteral(FileLine* fl, const string& literal) {
if (literal[0] == '"') {
// This is a string
const string v = literal.substr(1, literal.find('"', 1) - 1);
return new AstConst(fl, AstConst::VerilogStringLiteral(), v);
return new AstConst{fl, AstConst::VerilogStringLiteral{}, v};
} else if (literal.find_first_of(".eEpP") != string::npos) {
// This may be a real
const double v = VString::parseDouble(literal, &success);
if (success) return new AstConst(fl, AstConst::RealDouble(), v);
if (success) return new AstConst{fl, AstConst::RealDouble{}, v};
}
if (!success) {
// This is either an integer or an error
@ -310,18 +310,18 @@ AstConst* AstConst::parseParamLiteral(FileLine* fl, const string& literal) {
char* endp;
const int v = strtol(literal.c_str(), &endp, 0);
if ((v != 0) && (endp[0] == 0)) { // C literal
return new AstConst(fl, AstConst::Signed32(), v);
return new AstConst{fl, AstConst::Signed32{}, v};
} else { // Try a Verilog literal (fatals if not)
return new AstConst(fl, AstConst::StringToParse(), literal.c_str());
return new AstConst{fl, AstConst::StringToParse{}, literal.c_str()};
}
}
return nullptr;
}
AstNetlist::AstNetlist()
: ASTGEN_SUPER_Netlist(new FileLine(FileLine::builtInFilename()))
, m_typeTablep{new AstTypeTable(fileline())}
, m_constPoolp{new AstConstPool(fileline())} {
: ASTGEN_SUPER_Netlist(new FileLine{FileLine::builtInFilename()})
, m_typeTablep{new AstTypeTable{fileline()}}
, m_constPoolp{new AstConstPool{fileline()}} {
addMiscsp(m_typeTablep);
addMiscsp(m_constPoolp);
}
@ -1047,7 +1047,7 @@ AstVoidDType* AstTypeTable::findVoidDType(FileLine* fl) {
AstQueueDType* AstTypeTable::findQueueIndexDType(FileLine* fl) {
if (VL_UNLIKELY(!m_queueIndexp)) {
AstQueueDType* const newp = new AstQueueDType(fl, AstNode::findUInt32DType(), nullptr);
AstQueueDType* const newp = new AstQueueDType{fl, AstNode::findUInt32DType(), nullptr};
addTypesp(newp);
m_queueIndexp = newp;
}
@ -1057,7 +1057,7 @@ AstQueueDType* AstTypeTable::findQueueIndexDType(FileLine* fl) {
AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, VBasicDTypeKwd kwd) {
if (m_basicps[kwd]) return m_basicps[kwd];
//
AstBasicDType* const new1p = new AstBasicDType(fl, kwd);
AstBasicDType* const new1p = new AstBasicDType{fl, kwd};
// Because the detailed map doesn't update this map,
// check the detailed map for this same node
// Also adds this new node to the detailed map
@ -1074,7 +1074,7 @@ AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, VBasicDTypeKwd kwd) {
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd, int width,
int widthMin, VSigning numeric) {
AstBasicDType* const new1p = new AstBasicDType(fl, kwd, numeric, width, widthMin);
AstBasicDType* const new1p = new AstBasicDType{fl, kwd, numeric, width, widthMin};
AstBasicDType* const newp = findInsertSameDType(new1p);
if (newp != new1p) {
VL_DO_DANGLING(new1p->deleteTree(), new1p);
@ -1087,7 +1087,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd,
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd,
const VNumRange& range, int widthMin,
VSigning numeric) {
AstBasicDType* const new1p = new AstBasicDType(fl, kwd, numeric, range, widthMin);
AstBasicDType* const new1p = new AstBasicDType{fl, kwd, numeric, range, widthMin};
AstBasicDType* const newp = findInsertSameDType(new1p);
if (newp != new1p) {
VL_DO_DANGLING(new1p->deleteTree(), new1p);
@ -1098,8 +1098,8 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd,
}
AstBasicDType* AstTypeTable::findInsertSameDType(AstBasicDType* nodep) {
const VBasicTypeKey key(nodep->width(), nodep->widthMin(), nodep->numeric(), nodep->keyword(),
nodep->nrange());
const VBasicTypeKey key{nodep->width(), nodep->widthMin(), nodep->numeric(), nodep->keyword(),
nodep->nrange()};
DetailedMap& mapr = m_detailedMap;
const auto it = mapr.find(key);
if (it != mapr.end()) return it->second;
@ -1111,8 +1111,8 @@ AstBasicDType* AstTypeTable::findInsertSameDType(AstBasicDType* nodep) {
AstConstPool::AstConstPool(FileLine* fl)
: ASTGEN_SUPER_ConstPool(fl)
, m_modp{new AstModule(fl, "@CONST-POOL@")}
, m_scopep{new AstScope(fl, m_modp, "@CONST-POOL@", nullptr, nullptr)} {
, m_modp{new AstModule{fl, "@CONST-POOL@"}}
, m_scopep{new AstScope{fl, m_modp, "@CONST-POOL@", nullptr, nullptr}} {
this->modulep(m_modp);
m_modp->addStmtsp(m_scopep);
}
@ -1124,12 +1124,12 @@ const char* AstConstPool::broken() const {
AstVarScope* AstConstPool::createNewEntry(const string& name, AstNodeExpr* initp) {
FileLine* const fl = initp->fileline();
AstVar* const varp = new AstVar(fl, VVarType::MODULETEMP, name, initp->dtypep());
AstVar* const varp = new AstVar{fl, VVarType::MODULETEMP, name, initp->dtypep()};
varp->isConst(true);
varp->isStatic(true);
varp->valuep(initp->cloneTree(false));
m_modp->addStmtsp(varp);
AstVarScope* const varScopep = new AstVarScope(fl, m_scopep, varp);
AstVarScope* const varScopep = new AstVarScope{fl, m_scopep, varp};
m_scopep->addVarsp(varScopep);
return varScopep;
}
@ -1580,7 +1580,7 @@ void AstInitArray::addIndexValuep(uint64_t index, AstNodeExpr* newp) {
if (it != m_map.end()) {
it->second->valuep(newp);
} else {
AstInitItem* const itemp = new AstInitItem(fileline(), newp);
AstInitItem* const itemp = new AstInitItem{fileline(), newp};
m_map.emplace(index, itemp);
addInitsp(itemp);
}
@ -1870,7 +1870,7 @@ const char* AstNetlist::broken() const {
}
AstPackage* AstNetlist::dollarUnitPkgAddp() {
if (!m_dollarUnitPkgp) {
m_dollarUnitPkgp = new AstPackage(fileline(), AstPackage::dollarUnitName());
m_dollarUnitPkgp = new AstPackage{fileline(), AstPackage::dollarUnitName()};
// packages are always libraries; don't want to make them a "top"
m_dollarUnitPkgp->inLibrary(true);
m_dollarUnitPkgp->modTrace(false); // may reconsider later

View File

@ -160,7 +160,7 @@ void V3CCtors::evalAsserts() {
}
const uint64_t value = VL_MASK_Q(storedWidth) & ~VL_MASK_Q(lastWordWidth);
newp = new AstAnd{varp->fileline(), newp,
new AstConst(varp->fileline(), AstConst::WidthedValue(),
new AstConst(varp->fileline(), AstConst::WidthedValue{},
storedWidth, value)};
AstNodeIf* const ifp = new AstIf{
varp->fileline(), newp,

View File

@ -239,7 +239,7 @@ private:
if (m_scopep) {
VL_RESTORER(m_logicVertexp);
UINFO(4, " STMT " << nodep << endl);
m_logicVertexp = new CdcLogicVertex(&m_graph, m_scopep, nodep, m_domainp);
m_logicVertexp = new CdcLogicVertex{&m_graph, m_scopep, nodep, m_domainp};
if (m_domainp && m_domainp->hasClocked()) { // To/from a flop
m_logicVertexp->isFlop(true);
m_logicVertexp->srcDomainp(m_domainp);
@ -260,18 +260,18 @@ private:
CdcVarVertex* vertexp = reinterpret_cast<CdcVarVertex*>(varscp->user1p());
if (!vertexp) {
UINFO(6, "New vertex " << varscp << endl);
vertexp = new CdcVarVertex(&m_graph, m_scopep, varscp);
vertexp = new CdcVarVertex{&m_graph, m_scopep, varscp};
varscp->user1p(vertexp);
if (varscp->varp()->isUsedClock()) {}
if (varscp->varp()->isPrimaryIO()) {
// Create IO vertex - note it's relative to the pointed to var, not where we are
// now This allows reporting to easily print the input statement
CdcLogicVertex* const ioVertexp
= new CdcLogicVertex(&m_graph, varscp->scopep(), varscp->varp(), nullptr);
= new CdcLogicVertex{&m_graph, varscp->scopep(), varscp->varp(), nullptr};
if (varscp->varp()->isWritable()) {
new V3GraphEdge(&m_graph, vertexp, ioVertexp, 1);
new V3GraphEdge{&m_graph, vertexp, ioVertexp, 1};
} else {
new V3GraphEdge(&m_graph, ioVertexp, vertexp, 1);
new V3GraphEdge{&m_graph, ioVertexp, vertexp, 1};
}
}
}
@ -466,7 +466,7 @@ private:
} else {
V3EmitV::verilogPrefixedTree(nodep, *m_ofp, prefix + " +- ", filelineWidth(),
vertexp->srcDomainp(), true);
if (debug()) { CdcDumpVisitor visitor(nodep, m_ofp, front + "DBG: "); }
if (debug()) { CdcDumpVisitor{nodep, m_ofp, front + "DBG: "}; }
}
nextsep = " | ";
@ -564,8 +564,8 @@ private:
// If primary I/O, give it domain of the input
const AstVar* const varp = vvertexp->varScp()->varp();
if (varp->isPrimaryIO() && varp->isNonOutput() && !traceDests) {
senouts.insert(new AstSenTree(
varp->fileline(), new AstSenItem(varp->fileline(), AstSenItem::Combo())));
senouts.insert(new AstSenTree{
varp->fileline(), new AstSenItem{varp->fileline(), AstSenItem::Combo{}}});
}
}
@ -662,7 +662,7 @@ private:
// Weight of CDC_WEIGHT_ASYNC to indicate feeds async (for reporting)
// When simplify we'll take the MAX weight
if (nodep->access().isWriteOrRW()) {
new V3GraphEdge(&m_graph, m_logicVertexp, varvertexp, 1);
new V3GraphEdge{&m_graph, m_logicVertexp, varvertexp, 1};
if (m_inDly) {
varvertexp->fromFlop(true);
varvertexp->srcDomainp(m_domainp);
@ -671,10 +671,10 @@ private:
} else {
if (varvertexp->cntAsyncRst()) {
// UINFO(9," edgeasync "<<varvertexp->name()<<" to "<<m_logicVertexp<<endl);
new V3GraphEdge(&m_graph, varvertexp, m_logicVertexp, CDC_WEIGHT_ASYNC);
new V3GraphEdge{&m_graph, varvertexp, m_logicVertexp, CDC_WEIGHT_ASYNC};
} else {
// UINFO(9," edgena "<<varvertexp->name()<<" to "<<m_logicVertexp<<endl);
new V3GraphEdge(&m_graph, varvertexp, m_logicVertexp, 1);
new V3GraphEdge{&m_graph, varvertexp, m_logicVertexp, 1};
}
}
}

View File

@ -127,10 +127,10 @@ private:
nodep->unlinkFrBack(&relinkHandle);
//
computeCppWidth(nodep);
V3Number mask(nodep, cppWidth(nodep));
V3Number mask{nodep, cppWidth(nodep)};
mask.setMask(nodep->widthMin());
AstNode* const cleanp
= new AstAnd(nodep->fileline(), new AstConst(nodep->fileline(), mask), nodep);
= new AstAnd{nodep->fileline(), new AstConst{nodep->fileline(), mask}, nodep};
cleanp->dtypeFrom(nodep); // Otherwise the AND normally picks LHS
relinkHandle.relink(cleanp);
}

View File

@ -65,7 +65,7 @@ private:
void visit(AstNode* nodep) override { iterateChildren(nodep); }
public:
static AstNodeExpr* main(AstNodeExpr* nodep) { return ConvertWriteRefsToRead(nodep).m_result; }
static AstNodeExpr* main(AstNodeExpr* nodep) { return ConvertWriteRefsToRead{nodep}.m_result; }
};
//######################################################################

View File

@ -118,7 +118,7 @@ private:
// Someday the user might be allowed to specify a different page suffix
const string page = page_prefix + "/" + m_modp->prettyName();
AstCoverDecl* const declp = new AstCoverDecl(fl, page, comment, linescov, offset);
AstCoverDecl* const declp = new AstCoverDecl{fl, page, comment, linescov, offset};
declp->hier(hier);
m_modp->addStmtsp(declp);
UINFO(9, "new " << declp << endl);
@ -132,10 +132,10 @@ private:
varp->trace(true);
m_modp->addStmtsp(varp);
UINFO(5, "New coverage trace: " << varp << endl);
AstAssign* const assp = new AstAssign(
incp->fileline(), new AstVarRef(incp->fileline(), varp, VAccess::WRITE),
new AstAdd(incp->fileline(), new AstVarRef(incp->fileline(), varp, VAccess::READ),
new AstConst(incp->fileline(), AstConst::WidthedValue(), 32, 1)));
AstAssign* const assp = new AstAssign{
incp->fileline(), new AstVarRef{incp->fileline(), varp, VAccess::WRITE},
new AstAdd{incp->fileline(), new AstVarRef{incp->fileline(), varp, VAccess::READ},
new AstConst{incp->fileline(), AstConst::WidthedValue{}, 32, 1}}};
AstNode::addNext<AstNode, AstNode>(incp, assp);
}
return incp;
@ -301,11 +301,11 @@ private:
}
void toggleVarBottom(const ToggleEnt& above, const AstVar* varp) {
AstCoverToggle* const newp = new AstCoverToggle(
AstCoverToggle* const newp = new AstCoverToggle{
varp->fileline(),
newCoverInc(varp->fileline(), "", "v_toggle", varp->name() + above.m_comment, "", 0,
""),
above.m_varRefp->cloneTree(true), above.m_chgRefp->cloneTree(true));
above.m_varRefp->cloneTree(true), above.m_chgRefp->cloneTree(true)};
m_modp->addStmtsp(newp);
}

View File

@ -71,7 +71,7 @@ private:
return (nodep->width() + (VL_EDATASIZE - 1)) & ~(VL_EDATASIZE - 1);
}
static V3Number notWideMask(AstNode* nodep) {
return V3Number(nodep, VL_EDATASIZE, ~VL_MASK_E(nodep->widthMin()));
return V3Number{nodep, VL_EDATASIZE, ~VL_MASK_E(nodep->widthMin())};
}
static V3Number wordMask(AstNode* nodep) {
if (nodep->isWide()) {
@ -157,11 +157,11 @@ private:
const int nbitsonright = VL_EDATASIZE - loffset; // bits that end up in lword
newp = new AstOr{
fl,
new AstAnd{fl, new AstConst{fl, AstConst::SizedEData(), VL_MASK_E(loffset)},
new AstAnd{fl, new AstConst{fl, AstConst::SizedEData{}, VL_MASK_E(loffset)},
new AstShiftR{fl, lhip,
new AstConst{fl, static_cast<uint32_t>(nbitsonright)},
VL_EDATASIZE}},
new AstAnd{fl, new AstConst{fl, AstConst::SizedEData(), ~VL_MASK_E(loffset)},
new AstAnd{fl, new AstConst{fl, AstConst::SizedEData{}, ~VL_MASK_E(loffset)},
new AstShiftL{fl, llowp,
new AstConst{fl, static_cast<uint32_t>(loffset)},
VL_EDATASIZE}}};
@ -181,7 +181,7 @@ private:
// Squash before C++ to avoid getting a C++ compiler warning
// (even though code would be unreachable as presumably a
// AstCondBound is protecting above this node.
return new AstConst{fl, AstConst::SizedEData(), 0};
return new AstConst{fl, AstConst::SizedEData{}, 0};
} else {
AstNodeExpr* wordp;
FileLine* const lfl = lsbp->fileline();
@ -234,7 +234,7 @@ private:
FileLine* const fl = nodep->fileline();
for (int w = 0; w < nodep->widthWords(); ++w) {
addWordAssign(nodep, w,
new AstConst{fl, AstConst::SizedEData(), rhsp->num().edataWord(w)});
new AstConst{fl, AstConst::SizedEData{}, rhsp->num().edataWord(w)});
}
return true;
}
@ -512,7 +512,7 @@ private:
if (!ones) {
oldvalp = new AstAnd{
lfl,
new AstConst{lfl, AstConst::SizedEData(), maskold.edataWord(w)},
new AstConst{lfl, AstConst::SizedEData{}, maskold.edataWord(w)},
oldvalp};
}
@ -746,9 +746,9 @@ private:
newp = newp ? new AstOr{fl, newp, eqp} : eqp;
}
if (VN_IS(nodep, Neq)) {
newp = new AstNeq{fl, new AstConst{fl, AstConst::SizedEData(), 0}, newp};
newp = new AstNeq{fl, new AstConst{fl, AstConst::SizedEData{}, 0}, newp};
} else {
newp = new AstEq{fl, new AstConst{fl, AstConst::SizedEData(), 0}, newp};
newp = new AstEq{fl, new AstConst{fl, AstConst::SizedEData{}, 0}, newp};
}
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
}
@ -768,13 +768,13 @@ private:
AstNodeExpr* const eqp = newAstWordSelClone(nodep->lhsp(), w);
newp = newp ? new AstOr{fl, newp, eqp} : eqp;
}
newp = new AstNeq{fl, new AstConst{fl, AstConst::SizedEData(), 0}, newp};
newp = new AstNeq{fl, new AstConst{fl, AstConst::SizedEData{}, 0}, newp};
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
} else {
UINFO(8, " REDOR->EQ " << nodep << endl);
AstNodeExpr* const lhsp = nodep->lhsp()->unlinkFrBack();
AstNodeExpr* const newp = new AstNeq{
fl, new AstConst{fl, AstConst::WidthedValue(), longOrQuadWidth(nodep), 0}, lhsp};
fl, new AstConst{fl, AstConst::WidthedValue{}, longOrQuadWidth(nodep), 0}, lhsp};
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
}
}
@ -798,7 +798,7 @@ private:
}
newp = newp ? new AstAnd{fl, newp, eqp} : eqp;
}
newp = new AstEq{fl, new AstConst{fl, AstConst::SizedEData(), VL_MASK_E(VL_EDATASIZE)},
newp = new AstEq{fl, new AstConst{fl, AstConst::SizedEData{}, VL_MASK_E(VL_EDATASIZE)},
newp};
VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep);
} else {

View File

@ -123,7 +123,7 @@ private:
// METHODS
V3GraphVertex* vertex(AstNodeModule* nodep) {
// Return corresponding vertex for this module
if (!nodep->user1p()) nodep->user1p(new LinkCellsVertex(&m_graph, nodep));
if (!nodep->user1p()) nodep->user1p(new LinkCellsVertex{&m_graph, nodep});
return nodep->user1u().toGraphVertex();
}
@ -143,7 +143,7 @@ private:
// If file not found, make AstNotFoundModule, rather than error out.
// We'll throw the error when we know the module will really be needed.
const string prettyName = AstNode::prettyName(modName);
V3Parse parser(v3Global.rootp(), m_filterp, m_parseSymp);
V3Parse parser{v3Global.rootp(), m_filterp, m_parseSymp};
// true below -> other simulators treat modules in link-found files as library cells
parser.parseFile(nodep->fileline(), prettyName, true, "");
V3Error::abortIfErrors();
@ -218,8 +218,8 @@ private:
: !topMatch) { // Any non-specified module is lower
// Put under a fake vertex so that the graph ranking won't indicate
// this is a top level module
if (!m_libVertexp) m_libVertexp = new LibraryVertex(&m_graph);
new V3GraphEdge(&m_graph, m_libVertexp, vertex(nodep), 1, false);
if (!m_libVertexp) m_libVertexp = new LibraryVertex{&m_graph};
new V3GraphEdge{&m_graph, m_libVertexp, vertex(nodep), 1, false};
}
// Note AstBind also has iteration on cells
iterateChildren(nodep);
@ -236,7 +236,7 @@ private:
if (modp) {
if (VN_IS(modp, Iface)) {
// Track module depths, so can sort list from parent down to children
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(modp), 1, false);
new V3GraphEdge{&m_graph, vertex(m_modp), vertex(modp), 1, false};
if (!nodep->cellp()) nodep->ifacep(VN_AS(modp, Iface));
} else if (VN_IS(modp, NotFoundModule)) { // Will error out later
} else {
@ -250,7 +250,7 @@ private:
// Package Import: We need to do the package before the use of a package
iterateChildren(nodep);
UASSERT_OBJ(nodep->packagep(), nodep, "Unlinked package"); // Parser should set packagep
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false);
new V3GraphEdge{&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false};
}
void visit(AstBind* nodep) override {
@ -322,8 +322,8 @@ private:
// user1 etc will retain its pre-clone value
cellmodp->user2p(otherModp);
v3Global.rootp()->addModulesp(otherModp);
new V3GraphEdge(&m_graph, vertex(cellmodp), vertex(otherModp), 1,
false);
new V3GraphEdge{&m_graph, vertex(cellmodp), vertex(otherModp), 1,
false};
}
cellmodp = otherModp;
nodep->modp(cellmodp);
@ -336,7 +336,7 @@ private:
} else { // Non-recursive
// Track module depths, so can sort list from parent down to children
nodep->modp(cellmodp);
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(cellmodp), 1, false);
new V3GraphEdge{&m_graph, vertex(m_modp), vertex(cellmodp), 1, false};
}
}
}
@ -400,17 +400,17 @@ private:
if (pinStar) {
UINFO(9, " need .* PORT " << portp << endl);
// Create any not already connected
AstPin* const newp = new AstPin(
AstPin* const newp = new AstPin{
nodep->fileline(), 0, portp->name(),
new AstParseRef(nodep->fileline(), VParseRefExp::PX_TEXT,
portp->name(), nullptr, nullptr));
new AstParseRef{nodep->fileline(), VParseRefExp::PX_TEXT,
portp->name(), nullptr, nullptr}};
newp->svImplicit(true);
nodep->addPinsp(newp);
} else { // warn on the CELL that needs it, not the port
nodep->v3warn(PINMISSING,
"Cell has missing pin: " << portp->prettyNameQ());
AstPin* const newp
= new AstPin(nodep->fileline(), 0, portp->name(), nullptr);
= new AstPin{nodep->fileline(), 0, portp->name(), nullptr};
nodep->addPinsp(newp);
}
}
@ -427,21 +427,21 @@ private:
if (!nodep->hasIfaceVar()) {
const string varName
= nodep->name() + "__Viftop"; // V3LinkDot looks for this naming
AstIfaceRefDType* const idtypep = new AstIfaceRefDType(
nodep->fileline(), nodep->name(), nodep->modp()->name());
AstIfaceRefDType* const idtypep = new AstIfaceRefDType{
nodep->fileline(), nodep->name(), nodep->modp()->name()};
idtypep->ifacep(nullptr); // cellp overrides
// In the case of arrayed interfaces, we replace cellp when de-arraying in V3Inst
idtypep->cellp(nodep); // Only set when real parent cell known.
AstVar* varp;
if (nodep->rangep()) {
AstNodeArrayDType* const arrp
= new AstUnpackArrayDType(nodep->fileline(), VFlagChildDType(), idtypep,
nodep->rangep()->cloneTree(true));
varp = new AstVar(nodep->fileline(), VVarType::IFACEREF, varName,
VFlagChildDType(), arrp);
= new AstUnpackArrayDType{nodep->fileline(), VFlagChildDType{}, idtypep,
nodep->rangep()->cloneTree(true)};
varp = new AstVar{nodep->fileline(), VVarType::IFACEREF, varName,
VFlagChildDType{}, arrp};
} else {
varp = new AstVar(nodep->fileline(), VVarType::IFACEREF, varName,
VFlagChildDType(), idtypep);
varp = new AstVar{nodep->fileline(), VVarType::IFACEREF, varName,
VFlagChildDType{}, idtypep};
}
varp->isIfaceParent(true);
nodep->addNextHere(varp);
@ -504,7 +504,7 @@ private:
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (!foundp) {
m_mods.rootp()->insert(nodep->name(), new VSymEnt(&m_mods, nodep));
m_mods.rootp()->insert(nodep->name(), new VSymEnt{&m_mods, nodep});
}
}
// if (debug() >= 9) m_mods.dump(cout, "-syms: ");

View File

@ -213,11 +213,11 @@ private:
AstAssign* assignp;
if (VN_IS(nodep, PreSub) || VN_IS(nodep, PostSub)) {
assignp = new AstAssign(nodep->fileline(), storetop,
new AstSub(nodep->fileline(), valuep, newconstp));
assignp = new AstAssign{nodep->fileline(), storetop,
new AstSub{nodep->fileline(), valuep, newconstp}};
} else {
assignp = new AstAssign(nodep->fileline(), storetop,
new AstAdd(nodep->fileline(), valuep, newconstp));
assignp = new AstAssign{nodep->fileline(), storetop,
new AstAdd{nodep->fileline(), valuep, newconstp}};
}
nodep->replaceWith(assignp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -239,8 +239,8 @@ private:
// Prepare a temporary variable
FileLine* const fl = backp->fileline();
const string name = string("__Vincrement") + cvtToStr(++m_modIncrementsNum);
AstVar* const varp = new AstVar(fl, VVarType::BLOCKTEMP, name, VFlagChildDType(),
varrefp->varp()->subDTypep()->cloneTree(true));
AstVar* const varp = new AstVar{fl, VVarType::BLOCKTEMP, name, VFlagChildDType{},
varrefp->varp()->subDTypep()->cloneTree(true)};
if (m_ftaskp) varp->funcLocal(true);
// Declare the variable
@ -249,9 +249,9 @@ private:
// Define what operation will we be doing
AstNodeExpr* operp;
if (VN_IS(nodep, PostSub) || VN_IS(nodep, PreSub)) {
operp = new AstSub(fl, new AstVarRef(fl, varrefp->varp(), VAccess::READ), newconstp);
operp = new AstSub{fl, new AstVarRef{fl, varrefp->varp(), VAccess::READ}, newconstp};
} else {
operp = new AstAdd(fl, new AstVarRef(fl, varrefp->varp(), VAccess::READ), newconstp);
operp = new AstAdd{fl, new AstVarRef{fl, varrefp->varp(), VAccess::READ}, newconstp};
}
if (VN_IS(nodep, PreAdd) || VN_IS(nodep, PreSub)) {

View File

@ -105,8 +105,8 @@ private:
if (VN_IS(underp, JumpLabel)) {
return VN_AS(underp, JumpLabel);
} else { // Move underp stuff to be under a new label
AstJumpBlock* const blockp = new AstJumpBlock(nodep->fileline(), nullptr);
AstJumpLabel* const labelp = new AstJumpLabel(nodep->fileline(), blockp);
AstJumpBlock* const blockp = new AstJumpBlock{nodep->fileline(), nullptr};
AstJumpLabel* const labelp = new AstJumpLabel{nodep->fileline(), blockp};
blockp->labelp(labelp);
VNRelinker repHandle;
@ -163,21 +163,21 @@ private:
const string name = string("__Vrepeat") + cvtToStr(m_modRepeatNum++);
// Spec says value is integral, if negative is ignored
AstVar* const varp
= new AstVar(nodep->fileline(), VVarType::BLOCKTEMP, name, nodep->findSigned32DType());
= new AstVar{nodep->fileline(), VVarType::BLOCKTEMP, name, nodep->findSigned32DType()};
varp->usedLoopIdx(true);
m_modp->addStmtsp(varp);
AstNode* initsp = new AstAssign(
nodep->fileline(), new AstVarRef(nodep->fileline(), varp, VAccess::WRITE), countp);
AstNode* const decp = new AstAssign(
nodep->fileline(), new AstVarRef(nodep->fileline(), varp, VAccess::WRITE),
new AstSub(nodep->fileline(), new AstVarRef(nodep->fileline(), varp, VAccess::READ),
new AstConst(nodep->fileline(), 1)));
AstNodeExpr* const zerosp = new AstConst(nodep->fileline(), AstConst::Signed32(), 0);
AstNodeExpr* const condp = new AstGtS(
nodep->fileline(), new AstVarRef(nodep->fileline(), varp, VAccess::READ), zerosp);
AstNode* initsp = new AstAssign{
nodep->fileline(), new AstVarRef{nodep->fileline(), varp, VAccess::WRITE}, countp};
AstNode* const decp = new AstAssign{
nodep->fileline(), new AstVarRef{nodep->fileline(), varp, VAccess::WRITE},
new AstSub{nodep->fileline(), new AstVarRef{nodep->fileline(), varp, VAccess::READ},
new AstConst{nodep->fileline(), 1}}};
AstNodeExpr* const zerosp = new AstConst{nodep->fileline(), AstConst::Signed32{}, 0};
AstNodeExpr* const condp = new AstGtS{
nodep->fileline(), new AstVarRef{nodep->fileline(), varp, VAccess::READ}, zerosp};
AstNode* const bodysp = nodep->stmtsp();
if (bodysp) bodysp->unlinkFrBackWithNext();
AstNode* newp = new AstWhile(nodep->fileline(), condp, bodysp, decp);
AstNode* newp = new AstWhile{nodep->fileline(), condp, bodysp, decp};
initsp = initsp->addNext(newp);
newp = initsp;
nodep->replaceWith(newp);
@ -241,14 +241,14 @@ private:
} else {
if (funcp && nodep->lhsp()) {
// Set output variable to return value
nodep->addHereThisAsNext(new AstAssign(
nodep->addHereThisAsNext(new AstAssign{
nodep->fileline(),
new AstVarRef(nodep->fileline(), VN_AS(funcp->fvarp(), Var), VAccess::WRITE),
nodep->lhsp()->unlinkFrBackWithNext()));
new AstVarRef{nodep->fileline(), VN_AS(funcp->fvarp(), Var), VAccess::WRITE},
nodep->lhsp()->unlinkFrBackWithNext()});
}
// Jump to the end of the function call
AstJumpLabel* const labelp = findAddLabel(m_ftaskp, false);
nodep->addHereThisAsNext(new AstJumpGo(nodep->fileline(), labelp));
nodep->addHereThisAsNext(new AstJumpGo{nodep->fileline(), labelp});
}
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -260,7 +260,7 @@ private:
} else {
// Jump to the end of the loop
AstJumpLabel* const labelp = findAddLabel(m_loopp, false);
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
nodep->addNextHere(new AstJumpGo{nodep->fileline(), labelp});
}
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -273,7 +273,7 @@ private:
// Jump to the end of this iteration
// If a "for" loop then need to still do the post-loop increment
AstJumpLabel* const labelp = findAddLabel(m_loopp, true);
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
nodep->addNextHere(new AstJumpGo{nodep->fileline(), labelp});
}
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -295,7 +295,7 @@ private:
} else if (AstBegin* const beginp = VN_CAST(blockp, Begin)) {
// Jump to the end of the named block
AstJumpLabel* const labelp = findAddLabel(beginp, false);
nodep->addNextHere(new AstJumpGo(nodep->fileline(), labelp));
nodep->addNextHere(new AstJumpGo{nodep->fileline(), labelp});
} else {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disable fork");
}

View File

@ -184,8 +184,8 @@ private:
AstNodeExpr* valuep = nullptr;
if (nodep->valuep()) {
valuep
= new AstAdd(flp, nodep->valuep()->cloneTree(true),
new AstConst(flp, AstConst::Unsized32(), offset_from_init));
= new AstAdd{flp, nodep->valuep()->cloneTree(true),
new AstConst(flp, AstConst::Unsized32{}, offset_from_init)};
}
addp = AstNode::addNext(addp, new AstEnumItem{flp, name, nullptr, valuep});
}
@ -262,11 +262,11 @@ private:
// AstInitial
else if (m_valueModp) {
// Making an AstAssign (vs AstAssignW) to a wire is an error, suppress it
FileLine* const newfl = new FileLine(fl);
FileLine* const newfl = new FileLine{fl};
newfl->warnOff(V3ErrorCode::PROCASSWIRE, true);
auto* const assp
= new AstAssign(newfl, new AstVarRef(newfl, nodep->name(), VAccess::WRITE),
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr));
= new AstAssign{newfl, new AstVarRef{newfl, nodep->name(), VAccess::WRITE},
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr)};
if (nodep->lifetime().isAutomatic()) {
nodep->addNextHere(new AstInitialAutomatic{newfl, assp});
} else {
@ -275,8 +275,8 @@ private:
} // 4. Under blocks, it's an initial value to be under an assign
else {
nodep->addNextHere(
new AstAssign(fl, new AstVarRef(fl, nodep->name(), VAccess::WRITE),
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr)));
new AstAssign{fl, new AstVarRef{fl, nodep->name(), VAccess::WRITE},
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr)});
}
}
if (nodep->isIfaceRef() && !nodep->isIfaceParent() && !v3Global.opt.topIfacesSupported()) {
@ -371,7 +371,7 @@ private:
// but someday we may be more general
const bool lvalue = m_varp->isSigUserRWPublic();
nodep->addStmtsp(
new AstVarRef(nodep->fileline(), m_varp, lvalue ? VAccess::WRITE : VAccess::READ));
new AstVarRef{nodep->fileline(), m_varp, lvalue ? VAccess::WRITE : VAccess::READ});
}
}
@ -405,14 +405,14 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
return;
} else {
defp = new AstTypedef(nodep->fileline(), nodep->name(), nullptr, VFlagChildDType(),
dtypep);
defp = new AstTypedef{nodep->fileline(), nodep->name(), nullptr, VFlagChildDType{},
dtypep};
m_implTypedef.insert(
std::make_pair(std::make_pair(nodep->containerp(), defp->name()), defp));
backp->addNextHere(defp);
}
}
nodep->replaceWith(new AstRefDType(nodep->fileline(), defp->name()));
nodep->replaceWith(new AstRefDType{nodep->fileline(), defp->name()});
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}

View File

@ -581,7 +581,7 @@ private:
static AstNodeExpr* maskLsb(AstNodeExpr* nodep) {
if (yieldsOneOrZero(nodep)) return nodep;
// Otherwise apply masking
AstConst* const maskp = new AstConst{nodep->fileline(), AstConst::BitTrue()};
AstConst* const maskp = new AstConst{nodep->fileline(), AstConst::BitTrue{}};
// Mask on left, as conventional
return new AstAnd{nodep->fileline(), maskp, nodep};
}
@ -603,12 +603,12 @@ private:
} else if (const AstAnd* const andp = VN_CAST(rhsp, And)) {
if (andp->lhsp()->sameTree(m_mgCondp)) {
return condTrue ? maskLsb(andp->rhsp()->unlinkFrBack())
: new AstConst{rhsp->fileline(), AstConst::BitFalse()};
: new AstConst{rhsp->fileline(), AstConst::BitFalse{}};
} else {
UASSERT_OBJ(andp->rhsp()->sameTree(m_mgCondp), rhsp,
"AstAnd doesn't hold condition expression");
return condTrue ? maskLsb(andp->lhsp()->unlinkFrBack())
: new AstConst{rhsp->fileline(), AstConst::BitFalse()};
: new AstConst{rhsp->fileline(), AstConst::BitFalse{}};
}
} else if (VN_IS(rhsp, ArraySel) || VN_IS(rhsp, WordSel) || VN_IS(rhsp, VarRef)
|| VN_IS(rhsp, Const)) {

View File

@ -127,11 +127,11 @@ AstNodeDType* V3ParseGrammar::createArray(AstNodeDType* basep, AstNodeRange* nra
AstRange* const rangep = VN_CAST(nrangep, Range);
if (rangep && isPacked) {
arrayp
= new AstPackArrayDType{rangep->fileline(), VFlagChildDType(), arrayp, rangep};
= new AstPackArrayDType{rangep->fileline(), VFlagChildDType{}, arrayp, rangep};
} else if (rangep
&& (VN_IS(rangep->leftp(), Unbounded)
|| VN_IS(rangep->rightp(), Unbounded))) {
arrayp = new AstQueueDType{nrangep->fileline(), VFlagChildDType(), arrayp,
arrayp = new AstQueueDType{nrangep->fileline(), VFlagChildDType{}, arrayp,
rangep->rightp()->cloneTree(true)};
} else if (rangep) {
arrayp = new AstUnpackArrayDType{rangep->fileline(), VFlagChildDType{}, arrayp,

View File

@ -137,17 +137,17 @@ private:
++m_extractedToConstPool;
} else {
// Keep as local temporary. Name based on hash of node for output stability.
varp = new AstVar(fl, VVarType::STMTTEMP, m_tempNames.get(nodep), nodep->dtypep());
varp = new AstVar{fl, VVarType::STMTTEMP, m_tempNames.get(nodep), nodep->dtypep()};
m_cfuncp->addInitsp(varp);
// Put assignment before the referencing statement
insertBeforeStmt(new AstAssign(fl, new AstVarRef(fl, varp, VAccess::WRITE), nodep));
insertBeforeStmt(new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE}, nodep});
}
// Do not remove VarRefs to this in V3Const
if (noSubst) varp->noSubst(true);
// Replace node with VarRef to new Var
relinker.relink(new AstVarRef(fl, varp, VAccess::READ));
relinker.relink(new AstVarRef{fl, varp, VAccess::READ});
}
// VISITORS
@ -243,24 +243,24 @@ private:
// Then over shifting gives the sign bit, not all zeros
// Note *NOT* clean output -- just like normal shift!
// Create equivalent of VL_SIGNONES_(node_width)
constzerop = new AstNegate(
constzerop = new AstNegate{
nodep->fileline(),
new AstShiftR(nodep->fileline(), nodep->lhsp()->cloneTree(false),
new AstConst(nodep->fileline(), m1value), nodep->width()));
new AstShiftR{nodep->fileline(), nodep->lhsp()->cloneTree(false),
new AstConst(nodep->fileline(), m1value), nodep->width()}};
} else {
constzerop = new AstConst(nodep->fileline(), AstConst::WidthedValue(),
nodep->width(), 0);
constzerop = new AstConst{nodep->fileline(), AstConst::WidthedValue{},
nodep->width(), 0};
}
constzerop->dtypeFrom(nodep); // unsigned
AstNodeExpr* const constwidthp
= new AstConst(nodep->fileline(), AstConst::WidthedValue(),
= new AstConst(nodep->fileline(), AstConst::WidthedValue{},
nodep->rhsp()->widthMin(), m1value);
constwidthp->dtypeFrom(nodep->rhsp()); // unsigned
AstCond* const newp = new AstCond(
AstCond* const newp = new AstCond{
nodep->fileline(),
new AstGte(nodep->fileline(), constwidthp, nodep->rhsp()->cloneTree(false)),
nodep, constzerop);
new AstGte{nodep->fileline(), constwidthp, nodep->rhsp()->cloneTree(false)},
nodep, constzerop};
replaceHandle.relink(newp);
}
}

View File

@ -105,14 +105,14 @@ private:
m_mgIndexHi -= m_mgOffset;
}
AstNode* const initp = new AstAssign(fl, new AstVarRef(fl, itp, VAccess::WRITE),
new AstConst(fl, m_mgIndexLo));
AstNodeExpr* const condp = new AstLte(fl, new AstVarRef(fl, itp, VAccess::READ),
new AstConst(fl, m_mgIndexHi));
AstNode* const incp = new AstAssign(
fl, new AstVarRef(fl, itp, VAccess::WRITE),
new AstAdd(fl, new AstConst(fl, 1), new AstVarRef(fl, itp, VAccess::READ)));
AstWhile* const whilep = new AstWhile(fl, condp, nullptr, incp);
AstNode* const initp = new AstAssign{fl, new AstVarRef{fl, itp, VAccess::WRITE},
new AstConst{fl, m_mgIndexLo}};
AstNodeExpr* const condp = new AstLte{fl, new AstVarRef{fl, itp, VAccess::READ},
new AstConst{fl, m_mgIndexHi}};
AstNode* const incp = new AstAssign{
fl, new AstVarRef{fl, itp, VAccess::WRITE},
new AstAdd{fl, new AstConst{fl, 1}, new AstVarRef{fl, itp, VAccess::READ}}};
AstWhile* const whilep = new AstWhile{fl, condp, nullptr, incp};
initp->addNext(whilep);
bodyp->replaceWith(initp);
whilep->addStmtsp(bodyp);
@ -121,13 +121,13 @@ private:
AstNodeExpr* const offsetp
= m_mgOffset == 0 ? nullptr : new AstConst(fl, std::abs(m_mgOffset));
AstNodeExpr* const lbitp = m_mgSelLp->bitp();
AstNodeExpr* const lvrefp = new AstVarRef(fl, itp, VAccess::READ);
lbitp->replaceWith(m_mgOffset > 0 ? new AstAdd(fl, lvrefp, offsetp) : lvrefp);
AstNodeExpr* const lvrefp = new AstVarRef{fl, itp, VAccess::READ};
lbitp->replaceWith(m_mgOffset > 0 ? new AstAdd{fl, lvrefp, offsetp} : lvrefp);
VL_DO_DANGLING(lbitp->deleteTree(), lbitp);
if (m_mgSelRp) { // else constant and no replace
AstNodeExpr* const rbitp = m_mgSelRp->bitp();
AstNodeExpr* const rvrefp = new AstVarRef(fl, itp, VAccess::READ);
rbitp->replaceWith(m_mgOffset < 0 ? new AstAdd(fl, rvrefp, offsetp) : rvrefp);
AstNodeExpr* const rvrefp = new AstVarRef{fl, itp, VAccess::READ};
rbitp->replaceWith(m_mgOffset < 0 ? new AstAdd{fl, rvrefp, offsetp} : rvrefp);
VL_DO_DANGLING(rbitp->deleteTree(), lbitp);
}
if (debug() >= 9) initp->dumpTree(cout, "-new: ");

View File

@ -1025,7 +1025,7 @@ private:
if (!m_checkOnly && optimizable()) newValue(portp, fetchValue(pinp));
}
}
SimStackNode stackNode(nodep, &tconnects);
SimStackNode stackNode{nodep, &tconnects};
// cppcheck-suppress danglingLifetime
m_callStack.push_back(&stackNode);
// Clear output variable

View File

@ -282,17 +282,17 @@ private:
// This ensures $display's and such remain in proper order
// We don't prevent splitting out other non-pli statements, however.
if (!m_pliVertexp) {
m_pliVertexp = new SplitPliVertex(&m_graph, nodep); // m_graph.clear() will delete it
m_pliVertexp = new SplitPliVertex{&m_graph, nodep}; // m_graph.clear() will delete it
}
for (const auto& vtxp : m_stmtStackps) {
// Both ways...
new SplitScorebdEdge(&m_graph, vtxp, m_pliVertexp);
new SplitScorebdEdge(&m_graph, m_pliVertexp, vtxp);
new SplitScorebdEdge{&m_graph, vtxp, m_pliVertexp};
new SplitScorebdEdge{&m_graph, m_pliVertexp, vtxp};
}
}
void scoreboardPushStmt(AstNode* nodep) {
// UINFO(9, " push " << nodep << endl);
SplitLogicVertex* const vertexp = new SplitLogicVertex(&m_graph, nodep);
SplitLogicVertex* const vertexp = new SplitLogicVertex{&m_graph, nodep};
m_stmtStackps.push_back(vertexp);
UASSERT_OBJ(!nodep->user3p(), nodep, "user3p should not be used; cleared in processBlock");
nodep->user3p(vertexp);
@ -370,7 +370,7 @@ protected:
// Create vertexes for variable
if (!vscp->user1p()) {
SplitVarStdVertex* const vstdp = new SplitVarStdVertex(&m_graph, vscp);
SplitVarStdVertex* const vstdp = new SplitVarStdVertex{&m_graph, vscp};
vscp->user1p(vstdp);
}
SplitVarStdVertex* const vstdp
@ -381,15 +381,15 @@ protected:
UINFO(4, " VARREFDLY: " << nodep << endl);
// Delayed variable is different from non-delayed variable
if (!vscp->user2p()) {
SplitVarPostVertex* const vpostp = new SplitVarPostVertex(&m_graph, vscp);
SplitVarPostVertex* const vpostp = new SplitVarPostVertex{&m_graph, vscp};
vscp->user2p(vpostp);
new SplitPostEdge(&m_graph, vstdp, vpostp);
new SplitPostEdge{&m_graph, vstdp, vpostp};
}
SplitVarPostVertex* const vpostp
= reinterpret_cast<SplitVarPostVertex*>(vscp->user2p());
// Add edges
for (SplitLogicVertex* vxp : m_stmtStackps) {
new SplitLVEdge(&m_graph, vpostp, vxp);
new SplitLVEdge{&m_graph, vpostp, vxp};
}
} else { // Nondelayed assignment
if (nodep->access().isWriteOrRW()) {
@ -397,7 +397,7 @@ protected:
// with all consumers of the signal
UINFO(4, " VARREFLV: " << nodep << endl);
for (SplitLogicVertex* ivxp : m_stmtStackps) {
new SplitLVEdge(&m_graph, vstdp, ivxp);
new SplitLVEdge{&m_graph, vstdp, ivxp};
}
} else {
UINFO(4, " VARREF: " << nodep << endl);
@ -446,7 +446,7 @@ public:
// METHODS
protected:
void makeRvalueEdges(SplitVarStdVertex* vstdp) override {
for (SplitLogicVertex* vxp : m_stmtStackps) new SplitRVEdge(&m_graph, vxp, vstdp);
for (SplitLogicVertex* vxp : m_stmtStackps) new SplitRVEdge{&m_graph, vxp, vstdp};
}
void cleanupBlockGraph(AstNode* nodep) {
@ -503,7 +503,7 @@ protected:
const uint32_t color = vvertexp->color();
UASSERT_OBJ(color, nextp, "No node color assigned");
if (lastOfColor[color]) {
new SplitStrictEdge(&m_graph, lastOfColor[color], vvertexp);
new SplitStrictEdge{&m_graph, lastOfColor[color], vvertexp};
}
lastOfColor[color] = vvertexp;
}
@ -709,7 +709,7 @@ public:
// We don't need to clone m_origAlwaysp->sensesp() here;
// V3Activate already moved it to a parent node.
AstAlways* const alwaysp
= new AstAlways(m_origAlwaysp->fileline(), VAlwaysKwd::ALWAYS, nullptr, nullptr);
= new AstAlways{m_origAlwaysp->fileline(), VAlwaysKwd::ALWAYS, nullptr, nullptr};
// Put a placeholder node into stmtp to track our position.
// We'll strip these out after the blocks are fully cloned.
AstSplitPlaceholder* const placeholderp = makePlaceholderp();
@ -725,7 +725,7 @@ public:
protected:
AstSplitPlaceholder* makePlaceholderp() {
return new AstSplitPlaceholder(m_origAlwaysp->fileline());
return new AstSplitPlaceholder{m_origAlwaysp->fileline()};
}
void visit(AstNode* nodep) override {
@ -759,8 +759,8 @@ protected:
// Clone this if into its set of split blocks
AstSplitPlaceholder* const if_placeholderp = makePlaceholderp();
AstSplitPlaceholder* const else_placeholderp = makePlaceholderp();
AstIf* const clonep = new AstIf(nodep->fileline(), nodep->condp()->cloneTree(true),
if_placeholderp, else_placeholderp);
AstIf* const clonep = new AstIf{nodep->fileline(), nodep->condp()->cloneTree(true),
if_placeholderp, else_placeholderp};
const AstIf* const origp = VN_CAST(nodep, If);
if (origp) {
// Preserve pragmas from unique if's
@ -881,7 +881,7 @@ protected:
for (auto it = m_stmtStackps.cbegin(); it != m_stmtStackps.cend(); ++it) {
const AstNodeIf* const ifNodep = VN_CAST((*it)->nodep(), NodeIf);
if (ifNodep && (m_curIfConditional != ifNodep)) continue;
new SplitRVEdge(&m_graph, *it, vstdp);
new SplitRVEdge{&m_graph, *it, vstdp};
}
}

View File

@ -328,14 +328,14 @@ public:
}
// Register the location where a variable is used.
bool tryAdd(AstNode* context, AstVarRef* refp, AstArraySel* selp, int idx, bool ftask) {
return addCore(refp, UnpackRef(context, selp, idx, refp->access(), ftask));
return addCore(refp, UnpackRef{context, selp, idx, refp->access(), ftask});
}
bool tryAdd(AstNode* context, AstVarRef* refp, AstSliceSel* selp, int msb, int lsb,
bool ftask) {
return addCore(refp, UnpackRef(context, selp, msb, lsb, refp->access(), ftask));
return addCore(refp, UnpackRef{context, selp, msb, lsb, refp->access(), ftask});
}
bool tryAdd(AstNode* context, AstVarRef* refp, bool ftask) {
return addCore(refp, UnpackRef(context, refp, ftask));
return addCore(refp, UnpackRef{context, refp, ftask});
}
// Remove a variable from the list to split
@ -943,7 +943,7 @@ public:
}
UASSERT(refcount >= 0, "refcounut must not be negative");
if (bitwidth == 0 || refcount == 0) continue; // Vacant region
plan.emplace_back(SplitNewVar(points[i].first, bitwidth));
plan.emplace_back(SplitNewVar{points[i].first, bitwidth});
}
return plan;
@ -965,7 +965,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
warnNoSplit(nodep, nodep, reason);
nodep->attrSplitVar(false);
} else { // Finally find a good candidate
const bool inserted = m_refs.insert(std::make_pair(nodep, PackedVarRef(nodep))).second;
const bool inserted = m_refs.insert(std::make_pair(nodep, PackedVarRef{nodep})).second;
if (inserted) UINFO(3, nodep->prettyNameQ() << " is added to candidate list.\n");
}
}
@ -978,7 +978,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
UASSERT_OBJ(!nodep->classOrPackagep(), nodep,
"variable in package must have been dropped beforehand.");
const AstBasicDType* const basicp = refit->second.basicp();
refit->second.append(PackedVarRefEntry(nodep, basicp->lo(), varp->width()),
refit->second.append(PackedVarRefEntry{nodep, basicp->lo(), varp->width()},
nodep->access());
UINFO(5, varp->prettyName()
<< " Entire bit of [" << basicp->lo() << "+:" << varp->width() << "] \n");
@ -1080,11 +1080,11 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
AstBasicDType* dtypep;
switch (basicp->keyword()) {
case VBasicDTypeKwd::BIT:
dtypep = new AstBasicDType{varp->subDTypep()->fileline(), VFlagBitPacked(),
dtypep = new AstBasicDType{varp->subDTypep()->fileline(), VFlagBitPacked{},
newvar.bitwidth()};
break;
case VBasicDTypeKwd::LOGIC:
dtypep = new AstBasicDType{varp->subDTypep()->fileline(), VFlagLogicPacked(),
dtypep = new AstBasicDType{varp->subDTypep()->fileline(), VFlagLogicPacked{},
newvar.bitwidth()};
break;
default: UASSERT_OBJ(false, basicp, "Only bit and logic are allowed");

View File

@ -100,8 +100,8 @@ public:
v3Global.rootp()->typeTablep()->addTypesp(tableDTypep);
// Create table initializer (with default value 0)
AstConst* const defaultp = elemDType->isString()
? new AstConst{m_fl, AstConst::String(), ""}
: new AstConst{m_fl, AstConst::WidthedValue(), width, 0};
? new AstConst{m_fl, AstConst::String{}, ""}
: new AstConst{m_fl, AstConst::WidthedValue{}, width, 0};
m_initp = new AstInitArray{m_fl, tableDTypep, defaultp};
}

View File

@ -510,7 +510,7 @@ private:
new AstConst{flp, AstConst::RealDouble{}, m_timescaleFactor}}};
} else {
valuep = new AstMul{flp, valuep,
new AstConst{flp, AstConst::Unsized64(),
new AstConst{flp, AstConst::Unsized64{},
static_cast<uint64_t>(m_timescaleFactor)}};
}
}