Internals: Fix constructor style.

This commit is contained in:
Wilson Snyder 2022-11-20 20:13:55 -05:00
parent f44cd9cd48
commit 2eed4452ad
4 changed files with 523 additions and 524 deletions

View File

@ -1050,9 +1050,9 @@ private:
<< endl);
AstNodeCond* const newp = static_cast<AstNodeCond*>(condp->cloneType(
condp->condp()->unlinkFrBack(),
new AstAnd(nodep->fileline(), maskp->cloneTree(false), condp->thenp()->unlinkFrBack()),
new AstAnd(nodep->fileline(), maskp->cloneTree(false),
condp->elsep()->unlinkFrBack())));
new AstAnd{nodep->fileline(), maskp->cloneTree(false), condp->thenp()->unlinkFrBack()},
new AstAnd{nodep->fileline(), maskp->cloneTree(false),
condp->elsep()->unlinkFrBack()}));
newp->dtypeFrom(nodep);
newp->thenp()->dtypeFrom(nodep); // As And might have been to change widths
newp->elsep()->dtypeFrom(nodep);
@ -1087,7 +1087,7 @@ private:
if (orLIsRedundant && orRIsRedundant) {
nodep->replaceWith(
new AstConst(nodep->fileline(), AstConst::DTyped{}, nodep->dtypep()));
new AstConst{nodep->fileline(), AstConst::DTyped{}, nodep->dtypep()});
VL_DO_DANGLING(nodep->deleteTree(), nodep);
return true;
} else if (orLIsRedundant) {
@ -1124,15 +1124,15 @@ private:
if (const AstShiftR* const shiftp = VN_CAST(nodep->rhsp(), ShiftR)) {
if (const AstConst* const scp = VN_CAST(shiftp->rhsp(), Const)) {
// Check if mask is full over the non-zero bits
V3Number maskLo(nodep, nodep->width());
V3Number maskLo{nodep, nodep->width()};
maskLo.setMask(nodep->width() - scp->num().toUInt());
return checkMask(maskLo);
}
} else if (const AstShiftL* const shiftp = VN_CAST(nodep->rhsp(), ShiftL)) {
if (const AstConst* const scp = VN_CAST(shiftp->rhsp(), Const)) {
// Check if mask is full over the non-zero bits
V3Number maskLo(nodep, nodep->width());
V3Number maskHi(nodep, nodep->width());
V3Number maskLo{nodep, nodep->width()};
V3Number maskHi{nodep, nodep->width()};
maskLo.setMask(nodep->width() - scp->num().toUInt());
maskHi.opShiftL(maskLo, scp->num());
return checkMask(maskHi);
@ -1280,8 +1280,8 @@ private:
if (debug() >= 9) nodep->dumpTree(cout, "SEL(BI)-in:");
AstNodeExpr* const bilhsp = bip->lhsp()->unlinkFrBack();
AstNodeExpr* const birhsp = bip->rhsp()->unlinkFrBack();
bip->lhsp(new AstSel(nodep->fileline(), bilhsp, 0, nodep->widthConst()));
bip->rhsp(new AstSel(nodep->fileline(), birhsp, 0, nodep->widthConst()));
bip->lhsp(new AstSel{nodep->fileline(), bilhsp, 0, nodep->widthConst()});
bip->rhsp(new AstSel{nodep->fileline(), birhsp, 0, nodep->widthConst()});
if (debug() >= 9) bip->dumpTree(cout, "SEL(BI)-ou:");
VL_DO_DANGLING(replaceWChild(nodep, bip), nodep);
return true;
@ -1308,7 +1308,7 @@ private:
UINFO(9, "SEL(SHIFTR(a,b),l,w) -> SEL(a,l+b,w)\n");
if (debug() >= 9) nodep->dumpTree(cout, "SEL(SH)-in:");
AstSel* const newp
= new AstSel(nodep->fileline(), ap->unlinkFrBack(), newLsb, nodep->widthConst());
= new AstSel{nodep->fileline(), ap->unlinkFrBack(), newLsb, nodep->widthConst()};
newp->dtypeFrom(nodep);
if (debug() >= 9) newp->dumpTree(cout, "SEL(SH)-ou:");
VL_DO_DANGLING(nodep->replaceWith(newp), nodep);
@ -1334,9 +1334,9 @@ private:
nodep->rhsp(smallerp);
constp->unlinkFrBack();
V3Number num(constp, subsize);
V3Number num{constp, subsize};
num.opAssign(constp->num());
nodep->lhsp(new AstConst(constp->fileline(), num));
nodep->lhsp(new AstConst{constp->fileline(), num});
VL_DO_DANGLING(constp->deleteTree(), constp);
if (debug() >= 9) nodep->dumpTree(cout, "BI(EXTEND)-ou:");
return true;
@ -1487,13 +1487,13 @@ private:
const AstSel* rselp = VN_CAST(rhsp, Sel);
// a[i:0] a
if (lselp && !rselp && rhsp->sameGateTree(lselp->fromp()))
rselp = new AstSel(rhsp->fileline(), rhsp->cloneTree(false), 0, rhsp->width());
rselp = new AstSel{rhsp->fileline(), rhsp->cloneTree(false), 0, rhsp->width()};
// a[i:j] {a[j-1:k], b}
if (lselp && !rselp && VN_IS(rhsp, Concat))
return ifMergeAdjacent(lhsp, VN_CAST(rhsp, Concat)->lhsp());
// a a[msb:j]
if (rselp && !lselp && lhsp->sameGateTree(rselp->fromp()))
lselp = new AstSel(lhsp->fileline(), lhsp->cloneTree(false), 0, lhsp->width());
lselp = new AstSel{lhsp->fileline(), lhsp->cloneTree(false), 0, lhsp->width()};
// {b, a[j:k]} a[k-1:i]
if (rselp && !lselp && VN_IS(lhsp, Concat))
return ifMergeAdjacent(VN_CAST(lhsp, Concat)->rhsp(), rhsp);
@ -1551,7 +1551,7 @@ private:
UASSERT(oldp, "Null old");
UASSERT_OBJ(!(VN_IS(oldp, Const) && !VN_AS(oldp, Const)->num().isFourState()), oldp,
"Already constant??");
AstNode* const newp = new AstConst(oldp->fileline(), num);
AstNode* const newp = new AstConst{oldp->fileline(), num};
newp->dtypeFrom(oldp);
if (debug() > 5) oldp->dumpTree(cout, " const_old: ");
if (debug() > 5) newp->dumpTree(cout, " _new: ");
@ -1559,7 +1559,7 @@ private:
VL_DO_DANGLING(oldp->deleteTree(), oldp);
}
void replaceNum(AstNode* nodep, uint32_t val) {
V3Number num(nodep, nodep->width(), val);
V3Number num{nodep, nodep->width(), val};
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
}
void replaceNumSigned(AstNodeBiop* nodep, uint32_t val) {
@ -1583,33 +1583,33 @@ private:
if (isTPure(checkp)) {
VL_DO_DANGLING(replaceNum(nodep, 0), nodep);
} else {
AstNode* const newp = new AstAnd(nodep->fileline(), new AstConst(nodep->fileline(), 0),
checkp->unlinkFrBack());
AstNode* const newp = new AstAnd{nodep->fileline(), new AstConst{nodep->fileline(), 0},
checkp->unlinkFrBack()};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
}
void replaceAllOnes(AstNode* nodep) {
V3Number ones(nodep, nodep->width(), 0);
V3Number ones{nodep, nodep->width(), 0};
ones.setMask(nodep->width());
VL_DO_DANGLING(replaceNum(nodep, ones), nodep);
}
void replaceConst(AstNodeUniop* nodep) {
V3Number num(nodep, nodep->width());
V3Number num{nodep, nodep->width()};
nodep->numberOperate(num, VN_AS(nodep->lhsp(), Const)->num());
UINFO(4, "UNICONST -> " << num << endl);
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
}
void replaceConst(AstNodeBiop* nodep) {
V3Number num(nodep, nodep->width());
V3Number num{nodep, nodep->width()};
nodep->numberOperate(num, VN_AS(nodep->lhsp(), Const)->num(),
VN_AS(nodep->rhsp(), Const)->num());
UINFO(4, "BICONST -> " << num << endl);
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
}
void replaceConst(AstNodeTriop* nodep) {
V3Number num(nodep, nodep->width());
V3Number num{nodep, nodep->width()};
nodep->numberOperate(num, VN_AS(nodep->lhsp(), Const)->num(),
VN_AS(nodep->rhsp(), Const)->num(),
VN_AS(nodep->thsp(), Const)->num());
@ -1617,7 +1617,7 @@ private:
VL_DO_DANGLING(replaceNum(nodep, num), nodep);
}
void replaceConst(AstNodeQuadop* nodep) {
V3Number num(nodep, nodep->width());
V3Number num{nodep, nodep->width()};
nodep->numberOperate(
num, VN_AS(nodep->lhsp(), Const)->num(), VN_AS(nodep->rhsp(), Const)->num(),
VN_AS(nodep->thsp(), Const)->num(), VN_AS(nodep->fhsp(), Const)->num());
@ -1628,7 +1628,7 @@ private:
void replaceConstString(AstNode* oldp, const string& num) {
// Replace oldp node with a constant set to specified value
UASSERT(oldp, "Null old");
AstNode* const newp = new AstConst(oldp->fileline(), AstConst::String(), num);
AstNode* const newp = new AstConst{oldp->fileline(), AstConst::String{}, num};
if (debug() > 5) oldp->dumpTree(cout, " const_old: ");
if (debug() > 5) newp->dumpTree(cout, " _new: ");
oldp->replaceWith(newp);
@ -1791,8 +1791,8 @@ private:
UASSERT_OBJ((rstart + rwidth) == lstart, nodep,
"tried to merge two selects which are not adjacent");
AstSel* const newselp = new AstSel(
lselp->fromp()->fileline(), rselp->fromp()->cloneTree(false), rstart, lwidth + rwidth);
AstSel* const newselp = new AstSel{
lselp->fromp()->fileline(), rselp->fromp()->cloneTree(false), rstart, lwidth + rwidth};
UINFO(5, "merged two adjacent sel " << lselp << " and " << rselp << " to one " << newselp
<< endl);
@ -1809,8 +1809,8 @@ private:
AstNodeExpr* const rlp = rp->lhsp()->cloneTree(false);
AstNodeExpr* const rrp = rp->rhsp()->cloneTree(false);
if (concatMergeable(lp, rp, 0)) {
AstConcat* const newlp = new AstConcat(rlp->fileline(), llp, rlp);
AstConcat* const newrp = new AstConcat(rrp->fileline(), lrp, rrp);
AstConcat* const newlp = new AstConcat{rlp->fileline(), llp, rlp};
AstConcat* const newrp = new AstConcat{rrp->fileline(), lrp, rrp};
// use the lhs to replace the parent concat
lp->lhsp()->replaceWith(newlp);
lp->rhsp()->replaceWith(newrp);
@ -1841,7 +1841,7 @@ private:
UINFO(5, "POW(2,b)->SHIFTL(1,b) " << nodep << endl);
AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack();
AstShiftL* const newp
= new AstShiftL(nodep->fileline(), new AstConst(nodep->fileline(), 1), rhsp);
= new AstShiftL{nodep->fileline(), new AstConst{nodep->fileline(), 1}, rhsp};
newp->dtypeFrom(nodep);
newp->lhsp()->dtypeFrom(nodep);
nodep->replaceWith(newp);
@ -1852,7 +1852,7 @@ private:
const int amount = VN_AS(nodep->lhsp(), Const)->num().mostSetBitP1() - 1; // 2^n->n+1
AstNodeExpr* const opp = nodep->rhsp()->unlinkFrBack();
AstShiftL* const newp
= new AstShiftL(nodep->fileline(), opp, new AstConst(nodep->fileline(), amount));
= new AstShiftL{nodep->fileline(), opp, new AstConst(nodep->fileline(), amount)};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -1862,7 +1862,7 @@ private:
const int amount = VN_AS(nodep->rhsp(), Const)->num().mostSetBitP1() - 1; // 2^n->n+1
AstNodeExpr* const opp = nodep->lhsp()->unlinkFrBack();
AstShiftR* const newp
= new AstShiftR(nodep->fileline(), opp, new AstConst(nodep->fileline(), amount));
= new AstShiftR{nodep->fileline(), opp, new AstConst(nodep->fileline(), amount)};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -1870,11 +1870,11 @@ private:
void replaceModAnd(AstModDiv* nodep) { // Mod, but not ModS as not simple shift
UINFO(5, "MOD(b,2^n)->AND(b,2^n-1) " << nodep << endl);
const int amount = VN_AS(nodep->rhsp(), Const)->num().mostSetBitP1() - 1; // 2^n->n+1
V3Number mask(nodep, nodep->width());
V3Number mask{nodep, nodep->width()};
mask.setMask(amount);
AstNodeExpr* const opp = nodep->lhsp()->unlinkFrBack();
AstAnd* const newp
= new AstAnd(nodep->fileline(), opp, new AstConst(nodep->fileline(), mask));
= new AstAnd{nodep->fileline(), opp, new AstConst{nodep->fileline(), mask}};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -1929,29 +1929,29 @@ private:
VL_DO_DANGLING(shift1p->deleteTree(), shift1p);
VL_DO_DANGLING(shift2p->deleteTree(), shift2p);
AstNodeExpr* newp;
V3Number mask1(nodep, nodep->width());
V3Number ones(nodep, nodep->width());
V3Number mask1{nodep, nodep->width()};
V3Number ones{nodep, nodep->width()};
ones.setMask(nodep->width());
if (shift1 < 0) {
mask1.opShiftR(ones, V3Number(nodep, VL_IDATASIZE, -shift1));
} else {
mask1.opShiftL(ones, V3Number(nodep, VL_IDATASIZE, shift1));
}
V3Number mask(nodep, nodep->width());
V3Number mask{nodep, nodep->width()};
if (shift2 < 0) {
mask.opShiftR(mask1, V3Number(nodep, VL_IDATASIZE, -shift2));
} else {
mask.opShiftL(mask1, V3Number(nodep, VL_IDATASIZE, shift2));
}
if (newshift < 0) {
newp = new AstShiftR(nodep->fileline(), ap,
new AstConst(nodep->fileline(), -newshift));
newp = new AstShiftR{nodep->fileline(), ap,
new AstConst(nodep->fileline(), -newshift)};
} else {
newp = new AstShiftL(nodep->fileline(), ap,
new AstConst(nodep->fileline(), newshift));
newp = new AstShiftL{nodep->fileline(), ap,
new AstConst(nodep->fileline(), newshift)};
}
newp->dtypeFrom(nodep);
newp = new AstAnd(nodep->fileline(), newp, new AstConst(nodep->fileline(), mask));
newp = new AstAnd{nodep->fileline(), newp, new AstConst{nodep->fileline(), mask}};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2004,13 +2004,13 @@ private:
AstNodeExpr* const rhs2p = nextp->rhsp()->unlinkFrBack();
AstNodeAssign* newp;
if (lsbFirstAssign) {
newp = nodep->cloneType(new AstSel(sel1p->fileline(), varref1p->unlinkFrBack(),
sel1p->lsbConst(), sel1p->width() + sel2p->width()),
new AstConcat(rhs1p->fileline(), rhs2p, rhs1p));
newp = nodep->cloneType(new AstSel{sel1p->fileline(), varref1p->unlinkFrBack(),
sel1p->lsbConst(), sel1p->width() + sel2p->width()},
new AstConcat{rhs1p->fileline(), rhs2p, rhs1p});
} else {
newp = nodep->cloneType(new AstSel(sel1p->fileline(), varref1p->unlinkFrBack(),
sel2p->lsbConst(), sel1p->width() + sel2p->width()),
new AstConcat(rhs1p->fileline(), rhs1p, rhs2p));
newp = nodep->cloneType(new AstSel{sel1p->fileline(), varref1p->unlinkFrBack(),
sel2p->lsbConst(), sel1p->width() + sel2p->width()},
new AstConcat{rhs1p->fileline(), rhs1p, rhs2p});
}
// pnewp->dumpTree(cout, "conew: ");
nodep->replaceWith(newp);
@ -2085,8 +2085,8 @@ private:
const int msb1 = lsb1 + lc1p->width() - 1;
UASSERT_OBJ(msb1 == (conp->width() - 1), nodep, "Width calc mismatch");
// Form ranges
AstSel* const sel1p = new AstSel(conp->fileline(), rhsp, lsb1, msb1 - lsb1 + 1);
AstSel* const sel2p = new AstSel(conp->fileline(), rhs2p, lsb2, msb2 - lsb2 + 1);
AstSel* const sel1p = new AstSel{conp->fileline(), rhsp, lsb1, msb1 - lsb1 + 1};
AstSel* const sel2p = new AstSel{conp->fileline(), rhs2p, lsb2, msb2 - lsb2 + 1};
// Make new assigns of same flavor as old one
//*** Not cloneTree; just one node.
AstNodeAssign* newp = nullptr;
@ -2105,10 +2105,10 @@ private:
// if we make one per term.
AstVar* const temp1p
= new AstVar{sel1p->fileline(), VVarType::BLOCKTEMP,
m_concswapNames.get(sel1p), VFlagLogicPacked(), msb1 - lsb1 + 1};
m_concswapNames.get(sel1p), VFlagLogicPacked{}, msb1 - lsb1 + 1};
AstVar* const temp2p
= new AstVar{sel2p->fileline(), VVarType::BLOCKTEMP,
m_concswapNames.get(sel2p), VFlagLogicPacked(), msb2 - lsb2 + 1};
m_concswapNames.get(sel2p), VFlagLogicPacked{}, msb2 - lsb2 + 1};
m_modp->addStmtsp(temp1p);
m_modp->addStmtsp(temp2p);
AstNodeAssign* const asn1ap = nodep->cloneType(
@ -2162,7 +2162,7 @@ private:
streamp->dtypeSetLogicUnsized(srcp->width(), srcp->widthMin(), VSigning::UNSIGNED);
// Shrink the RHS if necessary
if (sWidth > dWidth) {
streamp = new AstSel(streamp->fileline(), streamp, sWidth - dWidth, dWidth);
streamp = new AstSel{streamp->fileline(), streamp, sWidth - dWidth, dWidth};
}
// Link the nodes back in
nodep->lhsp(dstp);
@ -2180,7 +2180,7 @@ private:
AstNodeExpr* const streamp = VN_AS(nodep->lhsp(), StreamR)->unlinkFrBack();
AstNodeExpr* srcp = nodep->rhsp()->unlinkFrBack();
if (sWidth > dWidth) {
srcp = new AstSel(streamp->fileline(), srcp, sWidth - dWidth, dWidth);
srcp = new AstSel{streamp->fileline(), srcp, sWidth - dWidth, dWidth};
}
nodep->lhsp(dstp);
nodep->rhsp(srcp);
@ -2215,10 +2215,10 @@ private:
= VN_AS(VN_AS(nodep, And)->rhsp(), ShiftR)->lhsp()->unlinkFrBack();
AstConst* const shiftConstp
= VN_AS(VN_AS(VN_AS(nodep, And)->rhsp(), ShiftR)->rhsp(), Const);
V3Number val(andConstp, andConstp->width());
V3Number val{andConstp, andConstp->width()};
val.opShiftL(andConstp->num(), shiftConstp->num());
AstAnd* const newp
= new AstAnd(nodep->fileline(), new AstConst(nodep->fileline(), val), fromp);
= new AstAnd{nodep->fileline(), new AstConst{nodep->fileline(), val}, fromp};
// widthMin no longer applicable if different C-expanded width
newp->dtypeSetLogicSized(nodep->width(), VSigning::UNSIGNED);
nodep->replaceWith(newp);
@ -2351,7 +2351,7 @@ private:
bcConcp->unlinkFrBack();
AstNodeExpr* const bp = bcConcp->lhsp()->unlinkFrBack();
AstNodeExpr* const cp = bcConcp->rhsp()->unlinkFrBack();
AstConcat* const abConcp = new AstConcat(bcConcp->fileline(), ap, bp);
AstConcat* const abConcp = new AstConcat{bcConcp->fileline(), ap, bp};
nodep->lhsp(abConcp);
nodep->rhsp(cp);
// If bp was a concat, then we have this exact same form again!
@ -2364,7 +2364,7 @@ private:
AstNodeExpr* const ap = abConcp->lhsp()->unlinkFrBack();
AstNodeExpr* const bp = abConcp->rhsp()->unlinkFrBack();
AstNodeExpr* const cp = nodep->rhsp()->unlinkFrBack();
AstConcat* const bcConcp = new AstConcat(abConcp->fileline(), bp, cp);
AstConcat* const bcConcp = new AstConcat{abConcp->fileline(), bp, cp};
nodep->lhsp(ap);
nodep->rhsp(bcConcp);
if (operandConcatMove(bcConcp)) moveConcat(bcConcp);
@ -2390,12 +2390,12 @@ private:
AstNodeExpr* const lhsp = nodep->lhsp()->unlinkFrBack();
AstNodeExpr* const rhsp = nodep->rhsp()->unlinkFrBack();
// Do exactly as IEEE says, might result in extra terms, so in future may do differently
AstLogAnd* const newp = new AstLogAnd(
AstLogAnd* const newp = new AstLogAnd{
nodep->fileline(),
new AstLogOr(nodep->fileline(), new AstLogNot(nodep->fileline(), lhsp), rhsp),
new AstLogOr(nodep->fileline(),
new AstLogNot(nodep->fileline(), rhsp->cloneTree(false)),
lhsp->cloneTree(false)));
new AstLogOr{nodep->fileline(), new AstLogNot{nodep->fileline(), lhsp}, rhsp},
new AstLogOr{nodep->fileline(),
new AstLogNot{nodep->fileline(), rhsp->cloneTree(false)},
lhsp->cloneTree(false)}};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2412,8 +2412,8 @@ private:
UINFO(4, "Elim Lower range: " << nodep << endl);
AstNodeExpr* newlsbp;
if (VN_IS(lsb1p, Const) && VN_IS(lsb2p, Const)) {
newlsbp = new AstConst(lsb1p->fileline(),
VN_AS(lsb1p, Const)->toUInt() + VN_AS(lsb2p, Const)->toUInt());
newlsbp = new AstConst{lsb1p->fileline(),
VN_AS(lsb1p, Const)->toUInt() + VN_AS(lsb2p, Const)->toUInt()};
VL_DO_DANGLING(lsb1p->deleteTree(), lsb1p);
VL_DO_DANGLING(lsb2p->deleteTree(), lsb2p);
} else {
@ -2433,7 +2433,7 @@ private:
newlsbp = new AstAdd{lsb1p->fileline(), lhsp, rhsp};
newlsbp->dtypeFrom(widep);
}
AstSel* const newp = new AstSel(nodep->fileline(), fromp, newlsbp, widthp);
AstSel* const newp = new AstSel{nodep->fileline(), fromp, newlsbp, widthp};
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
@ -2446,24 +2446,24 @@ private:
if (static_cast<int>(nodep->lsbConst()) >= conRhsp->width()) {
conLhsp->unlinkFrBack();
AstSel* const newp
= new AstSel(nodep->fileline(), conLhsp, nodep->lsbConst() - conRhsp->width(),
nodep->widthConst());
= new AstSel{nodep->fileline(), conLhsp, nodep->lsbConst() - conRhsp->width(),
nodep->widthConst()};
nodep->replaceWith(newp);
} else if (static_cast<int>(nodep->msbConst()) < conRhsp->width()) {
conRhsp->unlinkFrBack();
AstSel* const newp
= new AstSel(nodep->fileline(), conRhsp, nodep->lsbConst(), nodep->widthConst());
= new AstSel{nodep->fileline(), conRhsp, nodep->lsbConst(), nodep->widthConst()};
nodep->replaceWith(newp);
} else {
// Yuk, split between the two
conRhsp->unlinkFrBack();
conLhsp->unlinkFrBack();
AstConcat* const newp
= new AstConcat(nodep->fileline(),
new AstSel(nodep->fileline(), conLhsp, 0,
nodep->msbConst() - conRhsp->width() + 1),
new AstSel(nodep->fileline(), conRhsp, nodep->lsbConst(),
conRhsp->width() - nodep->lsbConst()));
= new AstConcat{nodep->fileline(),
new AstSel{nodep->fileline(), conLhsp, 0,
nodep->msbConst() - conRhsp->width() + 1},
new AstSel{nodep->fileline(), conRhsp, nodep->lsbConst(),
conRhsp->width() - nodep->lsbConst()}};
nodep->replaceWith(newp);
}
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2486,8 +2486,8 @@ private:
fromp->unlinkFrBack();
widthp->unlinkFrBack();
AstSel* const newp
= new AstSel(nodep->fileline(), fromp,
new AstConst(lsbp->fileline(), lsbp->toUInt() % fromp->width()), widthp);
= new AstSel{nodep->fileline(), fromp,
new AstConst{lsbp->fileline(), lsbp->toUInt() % fromp->width()}, widthp};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2506,7 +2506,7 @@ private:
cnt1p->unlinkFrBack();
cnt2p->unlinkFrBack();
AstReplicate* const newp
= new AstReplicate(nodep->fileline(), from2p, cnt1p->toUInt() * cnt2p->toUInt());
= new AstReplicate{nodep->fileline(), from2p, cnt1p->toUInt() * cnt2p->toUInt()};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2536,7 +2536,7 @@ private:
if (!operandsSame(from1p, from2p)) return false;
//
from1p->unlinkFrBack();
AstReplicate* const newp = new AstReplicate(nodep->fileline(), from1p, cnt1 + cnt2);
AstReplicate* const newp = new AstReplicate{nodep->fileline(), from1p, cnt1 + cnt2};
newp->dtypeFrom(nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2553,8 +2553,8 @@ private:
AstNodeExpr* const birhsp = fromp->rhsp()->unlinkFrBack();
//
fromp->lhsp(
new AstSel(nodep->fileline(), bilhsp, lsbp->cloneTree(true), widthp->cloneTree(true)));
fromp->rhsp(new AstSel(nodep->fileline(), birhsp, lsbp, widthp));
new AstSel{nodep->fileline(), bilhsp, lsbp->cloneTree(true), widthp->cloneTree(true)});
fromp->rhsp(new AstSel{nodep->fileline(), birhsp, lsbp, widthp});
fromp->dtypeFrom(nodep);
nodep->replaceWith(fromp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2568,7 +2568,7 @@ private:
//
AstNodeExpr* const bilhsp = fromp->lhsp()->unlinkFrBack();
//
fromp->lhsp(new AstSel(nodep->fileline(), bilhsp, lsbp, widthp));
fromp->lhsp(new AstSel{nodep->fileline(), bilhsp, lsbp, widthp});
fromp->dtypeFrom(nodep);
nodep->replaceWith(fromp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2720,7 +2720,7 @@ private:
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
}
} else { // Otherwise it may compute a result that needs to settle out
nodep->replaceWith(new AstSenItem(nodep->fileline(), AstSenItem::Combo()));
nodep->replaceWith(new AstSenItem{nodep->fileline(), AstSenItem::Combo{}});
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
} else if (m_doNConst && VN_IS(nodep->sensp(), Not)) {
@ -2897,8 +2897,8 @@ private:
// Make a initial assignment
AstNodeExpr* const exprp = nodep->rhsp()->unlinkFrBack();
varrefp->unlinkFrBack();
AstInitial* const newinitp = new AstInitial(
nodep->fileline(), new AstAssign(nodep->fileline(), varrefp, exprp));
AstInitial* const newinitp = new AstInitial{
nodep->fileline(), new AstAssign{nodep->fileline(), varrefp, exprp}};
m_modp->addStmtsp(newinitp);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
// Set the initial value right in the variable so we can constant propagate
@ -2958,8 +2958,8 @@ private:
if (nodep->thensp()) { // Must have been comment
nodep->thensp()->unlinkFrBackWithNext()->deleteTree();
}
nodep->condp(new AstLogNot(condp->fileline(),
condp)); // LogNot, as C++ optimization also possible
nodep->condp(new AstLogNot{condp->fileline(),
condp}); // LogNot, as C++ optimization also possible
nodep->addThensp(elsesp);
} else if (((VN_IS(nodep->condp(), Not) && nodep->condp()->width() == 1)
|| VN_IS(nodep->condp(), LogNot))
@ -2969,7 +2969,7 @@ private:
= VN_AS(nodep->condp(), NodeUniop)->lhsp()->unlinkFrBackWithNext();
AstNode* const thensp = nodep->thensp()->unlinkFrBackWithNext();
AstNode* const elsesp = nodep->elsesp()->unlinkFrBackWithNext();
AstIf* const ifp = new AstIf(nodep->fileline(), condp, elsesp, thensp);
AstIf* const ifp = new AstIf{nodep->fileline(), condp, elsesp, thensp};
ifp->branchPred(nodep->branchPred().invert());
nodep->replaceWith(ifp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
@ -2983,7 +2983,7 @@ private:
AstNodeExpr* const condp = nodep->condp()->unlinkFrBack();
AstNodeExpr* const truep = thensp->rhsp()->unlinkFrBack();
AstNodeExpr* const falsep = elsesp->rhsp()->unlinkFrBack();
thensp->rhsp(new AstCond(truep->fileline(), condp, truep, falsep));
thensp->rhsp(new AstCond{truep->fileline(), condp, truep, falsep});
nodep->replaceWith(thensp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
} else if (false // Disabled, as vpm assertions are faster
@ -2994,7 +2994,7 @@ private:
AstNodeExpr* const condp = nodep->condp()->unlinkFrBack();
AstNode* const lowerThensp = lowerIfp->thensp()->unlinkFrBackWithNext();
AstNodeExpr* const lowerCondp = lowerIfp->condp()->unlinkFrBackWithNext();
nodep->condp(new AstLogAnd(lowerIfp->fileline(), condp, lowerCondp));
nodep->condp(new AstLogAnd{lowerIfp->fileline(), condp, lowerCondp});
lowerIfp->replaceWith(lowerThensp);
VL_DO_DANGLING(lowerIfp->deleteTree(), lowerIfp);
} else if (operandBoolShift(nodep->condp())) {

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ private:
// Note can't call V3Const::constifyParam(nodep) here, as constify may change nodep on us!
if (!VN_IS(nodep, Const)) {
nodep->v3error(message);
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
nodep->replaceWith(new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1});
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
}
@ -126,18 +126,18 @@ private:
V3Number num(lhsp, lhsp->width());
num.opSub(VN_AS(lhsp, Const)->num(), V3Number(lhsp, 32, rhs));
num.isSigned(lhsp->isSigned());
return new AstConst(lhsp->fileline(), num);
return new AstConst{lhsp->fileline(), num};
} else if (rhs > 0) {
AstNodeExpr* const newp
= new AstSub(lhsp->fileline(), lhsp,
new AstConst(lhsp->fileline(), AstConst::Unsized32(), rhs));
= new AstSub{lhsp->fileline(), lhsp,
new AstConst(lhsp->fileline(), AstConst::Unsized32{}, rhs)};
// We must make sure sub gets sign of original value, not from the constant
newp->dtypeFrom(lhsp);
return newp;
} else { // rhs < 0;
AstNodeExpr* const newp
= new AstAdd(lhsp->fileline(), lhsp,
new AstConst(lhsp->fileline(), AstConst::Unsized32(), -rhs));
= new AstAdd{lhsp->fileline(), lhsp,
new AstConst(lhsp->fileline(), AstConst::Unsized32{}, -rhs)};
// We must make sure sub gets sign of original value, not from the constant
newp->dtypeFrom(lhsp);
return newp;
@ -146,8 +146,8 @@ private:
AstNodeExpr* newSubNeg(int32_t lhs, AstNodeExpr* rhsp) {
// Return lhs-rhs
// We must make sure sub gets sign of original value
AstNodeExpr* const newp = new AstSub(
rhsp->fileline(), new AstConst(rhsp->fileline(), AstConst::Unsized32(), lhs), rhsp);
AstNodeExpr* const newp = new AstSub{
rhsp->fileline(), new AstConst(rhsp->fileline(), AstConst::Unsized32{}, lhs), rhsp};
newp->dtypeFrom(rhsp); // Important as AstSub default is lhs's sign
return newp;
}
@ -180,11 +180,11 @@ private:
} else {
// Need a slice data type, which is an array of the extracted
// type, but with (presumably) different size
const VNumRange newRange(msb, lsb, nodep->declRange().littleEndian());
const VNumRange newRange{msb, lsb, nodep->declRange().littleEndian()};
AstNodeDType* const vardtypep
= new AstPackArrayDType(nodep->fileline(),
= new AstPackArrayDType{nodep->fileline(),
nodep->subDTypep(), // Need to strip off array reference
new AstRange(nodep->fileline(), newRange));
new AstRange{nodep->fileline(), newRange}};
v3Global.rootp()->typeTablep()->addTypesp(vardtypep);
return vardtypep;
}
@ -219,7 +219,7 @@ private:
if (fromRange.lo() != 0 || fromRange.hi() < 0) {
subp = newSubNeg(subp, fromRange.lo());
}
AstArraySel* const newp = new AstArraySel(nodep->fileline(), fromp, subp);
AstArraySel* const newp = new AstArraySel{nodep->fileline(), fromp, subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: ");
nodep->replaceWith(newp);
@ -237,11 +237,11 @@ private:
"Array extraction with width miscomputed " << adtypep->width() << "/"
<< fromRange.elements());
const int elwidth = adtypep->width() / fromRange.elements();
AstSel* const newp = new AstSel(
AstSel* const newp = new AstSel{
nodep->fileline(), fromp,
new AstMul(nodep->fileline(),
new AstConst(nodep->fileline(), AstConst::Unsized32(), elwidth), subp),
new AstConst(nodep->fileline(), AstConst::Unsized32(), elwidth));
new AstMul{nodep->fileline(),
new AstConst(nodep->fileline(), AstConst::Unsized32{}, elwidth), subp},
new AstConst(nodep->fileline(), AstConst::Unsized32{}, elwidth)};
newp->declRange(fromRange);
newp->declElWidth(elwidth);
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
@ -251,7 +251,7 @@ private:
} else if (const AstAssocArrayDType* const adtypep = VN_CAST(ddtypep, AssocArrayDType)) {
// SELBIT(array, index) -> ASSOCSEL(array, index)
AstNodeExpr* const subp = rhsp;
AstAssocSel* const newp = new AstAssocSel(nodep->fileline(), fromp, subp);
AstAssocSel* const newp = new AstAssocSel{nodep->fileline(), fromp, subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off array reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: ");
nodep->replaceWith(newp);
@ -268,7 +268,7 @@ private:
} else if (const AstDynArrayDType* const adtypep = VN_CAST(ddtypep, DynArrayDType)) {
// SELBIT(array, index) -> CMETHODCALL(queue, "at", index)
AstNodeExpr* const subp = rhsp;
AstCMethodHard* const newp = new AstCMethodHard(nodep->fileline(), fromp, "at", subp);
AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, "at", subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTq: ");
nodep->replaceWith(newp);
@ -276,7 +276,7 @@ private:
} else if (const AstQueueDType* const adtypep = VN_CAST(ddtypep, QueueDType)) {
// SELBIT(array, index) -> CMETHODCALL(queue, "at", index)
AstNodeExpr* const subp = rhsp;
AstCMethodHard* const newp = new AstCMethodHard(nodep->fileline(), fromp, "at", subp);
AstCMethodHard* const newp = new AstCMethodHard{nodep->fileline(), fromp, "at", subp};
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference
if (debug() >= 9) newp->dumpTree(cout, "--SELBTq: ");
nodep->replaceWith(newp);
@ -290,9 +290,9 @@ private:
}
AstNodeExpr* newp;
if (varrefp && varrefp->access().isReadOnly()) {
newp = new AstGetcN(nodep->fileline(), fromp, rhsp);
newp = new AstGetcN{nodep->fileline(), fromp, rhsp};
} else {
newp = new AstGetcRefN(nodep->fileline(), fromp, rhsp);
newp = new AstGetcRefN{nodep->fileline(), fromp, rhsp};
}
UINFO(6, " new " << newp << endl);
nodep->replaceWith(newp);
@ -300,9 +300,9 @@ private:
} else if (VN_IS(ddtypep, BasicDType)) {
// SELBIT(range, index) -> SEL(array, index, 1)
AstSel* const newp
= new AstSel(nodep->fileline(), fromp, newSubLsbOf(rhsp, fromRange),
= new AstSel{nodep->fileline(), fromp, newSubLsbOf(rhsp, fromRange),
// Unsized so width from user
new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1}};
newp->declRange(fromRange);
UINFO(6, " new " << newp << endl);
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: ");
@ -311,9 +311,9 @@ private:
} else if (VN_IS(ddtypep, NodeUOrStructDType)) { // A bit from the packed struct
// SELBIT(range, index) -> SEL(array, index, 1)
AstSel* const newp
= new AstSel(nodep->fileline(), fromp, newSubLsbOf(rhsp, fromRange),
= new AstSel{nodep->fileline(), fromp, newSubLsbOf(rhsp, fromRange),
// Unsized so width from user
new AstConst(nodep->fileline(), AstConst::Unsized32(), 1));
new AstConst{nodep->fileline(), AstConst::Unsized32{}, 1}};
newp->declRange(fromRange);
UINFO(6, " new " << newp << endl);
if (debug() >= 9) newp->dumpTree(cout, "--SELBTn: ");
@ -358,7 +358,7 @@ private:
nodep->replaceWith(fromp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (fromRange.elements() == 1) { // Extracting single element
AstArraySel* const newp = new AstArraySel(nodep->fileline(), fromp, lsbp);
AstArraySel* const newp = new AstArraySel{nodep->fileline(), fromp, lsbp};
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { // Slice
@ -392,11 +392,11 @@ private:
lsb = x;
}
const int elwidth = adtypep->width() / fromRange.elements();
AstSel* const newp = new AstSel(
AstSel* const newp = new AstSel{
nodep->fileline(), fromp,
new AstMul(nodep->fileline(), newSubLsbOf(lsbp, fromRange),
new AstConst(nodep->fileline(), AstConst::Unsized32(), elwidth)),
new AstConst(nodep->fileline(), AstConst::Unsized32(), (msb - lsb + 1) * elwidth));
new AstMul{nodep->fileline(), newSubLsbOf(lsbp, fromRange),
new AstConst(nodep->fileline(), AstConst::Unsized32{}, elwidth)},
new AstConst(nodep->fileline(), AstConst::Unsized32{}, (msb - lsb + 1) * elwidth)};
newp->declRange(fromRange);
newp->declElWidth(elwidth);
newp->dtypeFrom(sliceDType(adtypep, msb, lsb));
@ -421,12 +421,11 @@ private:
msb = lsb;
lsb = x;
}
AstNodeExpr* const widthp
= new AstConst(msbp->fileline(),
AstConst::Unsized32(), // Unsized so width from user
msb + 1 - lsb);
AstNodeExpr* const widthp = new AstConst(
msbp->fileline(), AstConst::Unsized32{}, // Unsized so width from user
msb + 1 - lsb);
AstSel* const newp
= new AstSel(nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp);
= new AstSel{nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp};
newp->declRange(fromRange);
UINFO(6, " new " << newp << endl);
// if (debug() >= 9) newp->dumpTree(cout, "--SELEXnew: ");
@ -444,19 +443,18 @@ private:
msb = lsb;
lsb = x;
}
AstNodeExpr* const widthp
= new AstConst(msbp->fileline(),
AstConst::Unsized32(), // Unsized so width from user
msb + 1 - lsb);
AstNodeExpr* const widthp = new AstConst(
msbp->fileline(), AstConst::Unsized32{}, // Unsized so width from user
msb + 1 - lsb);
AstSel* const newp
= new AstSel(nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp);
= new AstSel{nodep->fileline(), fromp, newSubLsbOf(lsbp, fromRange), widthp};
newp->declRange(fromRange);
UINFO(6, " new " << newp << endl);
// if (debug() >= 9) newp->dumpTree(cout, "--SELEXnew: ");
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(ddtypep, QueueDType)) {
auto* const newp = new AstCMethodHard(nodep->fileline(), fromp, "slice", msbp);
auto* const newp = new AstCMethodHard{nodep->fileline(), fromp, "slice", msbp};
msbp->addNext(lsbp);
newp->dtypep(ddtypep);
newp->didWidth(true);
@ -511,7 +509,7 @@ private:
nodep->replaceWith(fromp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (fromRange.elements() == 1) { // Extracting single element
AstArraySel* const newp = new AstArraySel(nodep->fileline(), fromp, rhsp);
AstArraySel* const newp = new AstArraySel{nodep->fileline(), fromp, rhsp};
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(rhsp, Const)) { // Slice
@ -537,7 +535,7 @@ private:
if (const AstPackArrayDType* const adtypep = VN_CAST(ddtypep, PackArrayDType)) {
elwidth = adtypep->width() / fromRange.elements();
newwidthp
= new AstConst(nodep->fileline(), AstConst::Unsized32(), width * elwidth);
= new AstConst(nodep->fileline(), AstConst::Unsized32{}, width * elwidth);
}
AstNodeExpr* newlsbp = nullptr;
if (VN_IS(nodep, SelPlus)) {
@ -560,10 +558,10 @@ private:
nodep->v3fatalSrc("Bad Case");
}
if (elwidth != 1) {
newlsbp = new AstMul(nodep->fileline(), newlsbp,
new AstConst(nodep->fileline(), elwidth));
newlsbp = new AstMul{nodep->fileline(), newlsbp,
new AstConst(nodep->fileline(), elwidth)};
}
AstSel* const newp = new AstSel(nodep->fileline(), fromp, newlsbp, newwidthp);
AstSel* const newp = new AstSel{nodep->fileline(), fromp, newlsbp, newwidthp};
newp->declRange(fromRange);
newp->declElWidth(elwidth);
UINFO(6, " new " << newp << endl);

View File

@ -123,7 +123,7 @@ public:
AstNode* createSupplyExpr(FileLine* fileline, const string& name, int value);
AstText* createTextQuoted(FileLine* fileline, const string& text) {
string newtext = deQuote(fileline, text);
return new AstText(fileline, newtext);
return new AstText{fileline, newtext};
}
AstNode* createCellOrIfaceRef(FileLine* fileline, const string& name, AstPin* pinlistp,
AstNodeRange* rangelistp) {
@ -151,8 +151,8 @@ public:
return nodep;
}
AstDisplay* createDisplayError(FileLine* fileline) {
AstDisplay* nodep = new AstDisplay(fileline, VDisplayType::DT_ERROR, "", nullptr, nullptr);
AstNode::addNext<AstNode, AstNode>(nodep, new AstStop(fileline, true));
AstDisplay* nodep = new AstDisplay{fileline, VDisplayType::DT_ERROR, "", nullptr, nullptr};
AstNode::addNext<AstNode, AstNode>(nodep, new AstStop{fileline, true});
return nodep;
}
AstNodeExpr* createGatePin(AstNodeExpr* exprp) {
@ -160,7 +160,7 @@ public:
if (!rangep) {
return exprp;
} else {
return new AstGatePin(rangep->fileline(), exprp, rangep->cloneTree(true));
return new AstGatePin{rangep->fileline(), exprp, rangep->cloneTree(true)};
}
}
AstNode* createTypedef(FileLine* fl, const string& name, AstNode* attrsp, AstNodeDType* basep,
@ -1159,7 +1159,7 @@ package_declaration: // ==IEEE: package_declaration
packageFront<nodeModulep>:
yPACKAGE lifetimeE idAny ';'
{ $$ = new AstPackage($<fl>3, *$3);
{ $$ = new AstPackage{$<fl>3, *$3};
$$->inLibrary(true); // packages are always libraries; don't want to make them a "top"
$$->lifetime($2);
$$->modTrace(GRAMMARP->allTracingOn($$->fileline()));
@ -1224,7 +1224,7 @@ package_import_item<nodep>: // ==IEEE: package_import_item
$$ = nullptr;
$<fl>1->v3error("Importing from missing package '" << *$<strp>1 << "'");
} else {
$$ = new AstPackageImport($<fl>2, VN_CAST($<scp>1, Package), *$3);
$$ = new AstPackageImport{$<fl>2, VN_CAST($<scp>1, Package), *$3};
SYMP->importItem($<scp>1,*$3);
} }
;
@ -1285,7 +1285,7 @@ modFront<nodeModulep>:
// // General note: all *Front functions must call symPushNew before
// // any formal arguments, as the arguments must land in the new scope.
yMODULE lifetimeE idAny
{ $$ = new AstModule($<fl>3,*$3);
{ $$ = new AstModule{$<fl>3, *$3};
$$->lifetime($2);
$$->inLibrary(PARSEP->inLibrary() || $$->fileline()->celldefineOn());
$$->modTrace(GRAMMARP->allTracingOn($$->fileline()));
@ -1304,10 +1304,11 @@ importsAndParametersE<nodep>: // IEEE: common part of module_declaration, inte
udpFront<nodeModulep>:
yPRIMITIVE lifetimeE idAny
{ $$ = new AstPrimitive($<fl>3, *$3); $$->inLibrary(true);
{ $$ = new AstPrimitive{$<fl>3, *$3};
$$->inLibrary(true);
$$->lifetime($2);
$$->modTrace(false);
$$->addStmtsp(new AstPragma($<fl>3, VPragmaType::INLINE_MODULE));
$$->addStmtsp(new AstPragma{$<fl>3, VPragmaType::INLINE_MODULE});
GRAMMARP->m_tracingParse = false;
PARSEP->rootp()->addModulesp($$);
SYMP->pushNew($$); }
@ -1531,7 +1532,7 @@ interface_declaration: // IEEE: interface_declaration + interface_nonan
intFront<nodeModulep>:
yINTERFACE lifetimeE idAny/*new_interface*/
{ $$ = new AstIface($<fl>3, *$3);
{ $$ = new AstIface{$<fl>3, *$3};
$$->inLibrary(true);
$$->lifetime($2);
PARSEP->rootp()->addModulesp($$);
@ -1623,7 +1624,7 @@ program_declaration: // IEEE: program_declaration + program_nonansi_h
pgmFront<nodeModulep>:
yPROGRAM lifetimeE idAny/*new_program*/
{ $$ = new AstModule($<fl>3, *$3, true);
{ $$ = new AstModule{$<fl>3, *$3, true};
$$->lifetime($2);
$$->inLibrary(PARSEP->inLibrary() || $$->fileline()->celldefineOn());
$$->modTrace(GRAMMARP->allTracingOn($$->fileline()));
@ -4360,10 +4361,10 @@ dpi_import_export<nodep>: // ==IEEE: dpi_import_export
if ($$->prettyName()[0]=='$') SYMP->reinsert($$,nullptr,$$->prettyName()); // For $SysTF overriding
SYMP->reinsert($$); }
| yEXPORT yaSTRING dpi_importLabelE yFUNCTION idAny ';'
{ $$ = new AstDpiExport($<fl>5, *$5, *$3);
{ $$ = new AstDpiExport{$<fl>5, *$5, *$3};
GRAMMARP->checkDpiVer($1, *$2); v3Global.dpi(true); }
| yEXPORT yaSTRING dpi_importLabelE yTASK idAny ';'
{ $$ = new AstDpiExport($<fl>5, *$5, *$3);
{ $$ = new AstDpiExport{$<fl>5, *$5, *$3};
GRAMMARP->checkDpiVer($1, *$2); v3Global.dpi(true); }
;
@ -4831,11 +4832,11 @@ streaming_concatenation<nodeStreamp>: // ==IEEE: streaming_concatenation
| '{' yP_SLEFT stream_expressionOrDataType stream_concatenation '}'
{ AstNodeExpr* const bitsp = VN_IS($3, NodeExpr) ? VN_AS($3, NodeExpr)
: new AstAttrOf{$1, VAttrType::DIM_BITS, $3};
$$ = new AstStreamL($2, $4, bitsp); }
$$ = new AstStreamL{$2, $4, bitsp}; }
| '{' yP_SRIGHT stream_expressionOrDataType stream_concatenation '}'
{ AstNodeExpr* const bitsp = VN_IS($3, NodeExpr) ? VN_AS($3, NodeExpr)
: new AstAttrOf{$1, VAttrType::DIM_BITS, $3};
$$ = new AstStreamR($2, $4, bitsp); }
$$ = new AstStreamR{$2, $4, bitsp}; }
;
stream_concatenation<nodeExprp>: // ==IEEE: stream_concatenation
@ -4960,7 +4961,7 @@ gateRangeE<nodep>:
gateBuf<nodep>:
gateFront variable_lvalue ',' gatePinExpr ')'
{ $$ = new AstAssignW($<fl>1, $2, $4); DEL($1); }
{ $$ = new AstAssignW{$<fl>1, $2, $4}; DEL($1); }
// UNSUP // IEEE: Multiple output variable_lvalues
// UNSUP // Causes conflict - need to take in variable_lvalue or a gatePinExpr
;
@ -5089,7 +5090,7 @@ tableEntryList<udpTableLinep>: // IEEE: { combinational_entry | sequential_entr
;
tableEntry<udpTableLinep>: // IEEE: combinational_entry + sequential_entry
yaTABLELINE { $$ = new AstUdpTableLine($<fl>1,*$1); }
yaTABLELINE { $$ = new AstUdpTableLine{$<fl>1, *$1}; }
| error { $$ = nullptr; }
;
@ -5313,7 +5314,7 @@ endLabelE<strp>:
clocking_declaration<nodep>: // IEEE: clocking_declaration (INCOMPLETE)
//UNSUP: vvv remove this -- vastly simplified grammar:
yDEFAULT yCLOCKING '@' '(' senitemEdge ')' ';' yENDCLOCKING
{ $$ = new AstClocking($2, $5, nullptr); }
{ $$ = new AstClocking{$2, $5, nullptr}; }
//UNSUP: ^^^ remove this -- vastly simplified grammar:
//UNSUP clockingFront clocking_event ';'
//UNSUP clocking_itemListE yENDCLOCKING endLabelE { SYMP->popScope($$); }
@ -5410,7 +5411,7 @@ assertion_item<nodep>: // ==IEEE: assertion_item
deferred_immediate_assertion_item<nodep>: // ==IEEE: deferred_immediate_assertion_item
deferred_immediate_assertion_statement { $$ = $1; }
| id/*block_identifier*/ ':' deferred_immediate_assertion_statement
{ $$ = new AstBegin($<fl>1, *$1, $3, false, true); }
{ $$ = new AstBegin{$<fl>1, *$1, $3, false, true}; }
;
procedural_assertion_statement<nodep>: // ==IEEE: procedural_assertion_statement
@ -5466,7 +5467,7 @@ deferred_immediate_assertion_statement<nodep>: // ==IEEE: deferred_immediate_as
concurrent_assertion_item<nodep>: // IEEE: concurrent_assertion_item
concurrent_assertion_statement { $$ = $1; }
| id/*block_identifier*/ ':' concurrent_assertion_statement
{ $$ = new AstBegin($<fl>1, *$1, $3, false, true); }
{ $$ = new AstBegin{$<fl>1, *$1, $3, false, true}; }
// // IEEE: checker_instantiation
// // identical to module_instantiation; see etcInst
;
@ -6312,14 +6313,14 @@ class_declaration<nodep>: // ==IEEE: part of class_declaration
classFront<classp>: // IEEE: part of class_declaration
classVirtualE yCLASS lifetimeE idAny/*class_identifier*/
{ $$ = new AstClass($2, *$4);
{ $$ = new AstClass{$2, *$4};
$$->isVirtual($1);
$$->lifetime($3);
SYMP->pushNew($<classp>$);
v3Global.setHasClasses(); }
// // IEEE: part of interface_class_declaration
| yINTERFACE yCLASS lifetimeE idAny/*class_identifier*/
{ $$ = new AstClass($2, *$4);
{ $$ = new AstClass{$2, *$4};
$$->lifetime($3);
SYMP->pushNew($<classp>$);
BBUNSUP($2, "Unsupported: interface classes"); }
@ -6347,11 +6348,11 @@ classExtendsList<classExtendsp>: // IEEE: part of class_declaration
classExtendsOne<classExtendsp>: // IEEE: part of class_declaration
class_typeExtImpList
{ $$ = new AstClassExtends($1->fileline(), $1);
{ $$ = new AstClassExtends{$1->fileline(), $1};
$<scp>$ = $<scp>1; }
//
| class_typeExtImpList '(' list_of_argumentsE ')'
{ $$ = new AstClassExtends($1->fileline(), $1);
{ $$ = new AstClassExtends{$1->fileline(), $1};
$<scp>$ = $<scp>1;
if ($3) BBUNSUP($3, "Unsupported: extends with parameters"); }
;
@ -6388,17 +6389,17 @@ class_typeExtImpOne<nodep>: // part of IEEE: class_type, where we either get
idAny
/*mid*/ { /* no nextId as not refing it above this*/ }
/*cont*/ parameter_value_assignmentE
{ $$ = new AstClassOrPackageRef($<fl>1, *$1, $<scp>1, $3);
{ $$ = new AstClassOrPackageRef{$<fl>1, *$1, $<scp>1, $3};
$<scp>$ = $<scp>1; }
//
// // package_sopeIdFollows expanded
| yD_UNIT yP_COLONCOLON
{ $$ = new AstClassOrPackageRef($<fl>1, "$unit", nullptr, nullptr);
{ $$ = new AstClassOrPackageRef{$<fl>1, "$unit", nullptr, nullptr};
$<scp>$ = nullptr; // No purpose otherwise, every symtab can see root
SYMP->nextId(PARSEP->rootp()); }
//
| yLOCAL__COLONCOLON yP_COLONCOLON
{ $$ = new AstClassOrPackageRef($<fl>1, "local::", nullptr, nullptr);
{ $$ = new AstClassOrPackageRef{$<fl>1, "local::", nullptr, nullptr};
$<scp>$ = nullptr; // UNSUP
SYMP->nextId(PARSEP->rootp());
BBUNSUP($1, "Unsupported: Randomize 'local::'"); }
@ -6434,7 +6435,7 @@ packageClassScope<nodeExprp>: // IEEE: class_scope
| localNextId yP_COLONCOLON { $$ = $1; $<scp>$ = $<scp>1; }
| dollarUnitNextId yP_COLONCOLON { $$ = $1; $<scp>$ = $<scp>1; }
| dollarUnitNextId yP_COLONCOLON packageClassScopeList
{ $$ = new AstDot($2, true, $1, $3); $<scp>$ = $<scp>3; }
{ $$ = new AstDot{$2, true, $1, $3}; $<scp>$ = $<scp>3; }
;
packageClassScopeList<nodeExprp>: // IEEE: class_type: "id [ parameter_value_assignment ]" but allow yaID__aTYPE
@ -6445,7 +6446,7 @@ packageClassScopeList<nodeExprp>: // IEEE: class_type: "id [ parameter_value_a
// // If you follow the rules down, class_type is really a list via ps_class_identifier
packageClassScopeItem { $$ = $1; $<scp>$ = $<scp>1; }
| packageClassScopeList packageClassScopeItem
{ $$ = new AstDot($<fl>2, true, $1, $2); $<scp>$ = $<scp>2; }
{ $$ = new AstDot{$<fl>2, true, $1, $2}; $<scp>$ = $<scp>2; }
;
packageClassScopeItem<nodeExprp>: // IEEE: package_scope or [package_scope]::[class_scope]
@ -6456,12 +6457,12 @@ packageClassScopeItem<nodeExprp>: // IEEE: package_scope or [package_scope]::[
idCC
/*mid*/ { SYMP->nextId($<scp>1); }
/*cont*/ yP_COLONCOLON
{ $$ = new AstClassOrPackageRef($<fl>1, *$1, $<scp>1, nullptr); $<scp>$ = $<scp>1; }
{ $$ = new AstClassOrPackageRef{$<fl>1, *$1, $<scp>1, nullptr}; $<scp>$ = $<scp>1; }
//
| idCC parameter_value_assignment
/*mid*/ { SYMP->nextId($<scp>1); } // Change next *after* we handle parameters, not before
/*cont*/ yP_COLONCOLON
{ $$ = new AstClassOrPackageRef($<fl>1, *$1, $<scp>1, $2); $<scp>$ = $<scp>1; }
{ $$ = new AstClassOrPackageRef{$<fl>1, *$1, $<scp>1, $2}; $<scp>$ = $<scp>1; }
;
dollarUnitNextId<nodeExprp>: // $unit
@ -6650,7 +6651,7 @@ constraintStaticE<cbool>: // IEEE: part of extern_constraint_declaration
timeNumAdjusted<nodeExprp>: // Time constant, adjusted to module's time units/precision
yaTIMENUM
{ $$ = new AstTimeImport($<fl>1, new AstConst($<fl>1, AstConst::RealDouble(), $1)); }
{ $$ = new AstTimeImport{$<fl>1, new AstConst{$<fl>1, AstConst::RealDouble{}, $1}}; }
;
//**********************************************************************