Internals: Clean up AstArg usage in AstNodeFTaskRef (#7121)

- Strengthen type of AstNodeFTaskRef::pinsp to be List[AstArg]
- Rename 'pinsp' to 'argsp'
- Add default constructor arguments
This commit is contained in:
Geza Lore 2026-02-22 10:38:37 +00:00 committed by GitHub
parent e023113b79
commit 78ee787bb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 238 additions and 270 deletions

View File

@ -80,8 +80,8 @@ int AstNodeArrayDType::lo() const VL_MT_STABLE { return rangep()->loConst(); }
int AstNodeArrayDType::elementsConst() const VL_MT_STABLE { return rangep()->elementsConst(); }
VNumRange AstNodeArrayDType::declRange() const VL_MT_STABLE { return VNumRange{left(), right()}; }
AstFuncRef::AstFuncRef(FileLine* fl, AstFunc* taskp, AstNodeExpr* pinsp)
: ASTGEN_SUPER_FuncRef(fl, taskp->name(), pinsp) {
AstFuncRef::AstFuncRef(FileLine* fl, AstFunc* taskp, AstArg* argsp)
: ASTGEN_SUPER_FuncRef(fl, taskp->name(), argsp) {
this->taskp(taskp);
dtypeFrom(taskp);
}
@ -129,8 +129,8 @@ int AstQueueDType::boundConst() const VL_MT_STABLE {
return (constp ? constp->toSInt() : 0);
}
AstTaskRef::AstTaskRef(FileLine* fl, AstTask* taskp, AstNodeExpr* pinsp)
: ASTGEN_SUPER_TaskRef(fl, taskp->name(), pinsp) {
AstTaskRef::AstTaskRef(FileLine* fl, AstTask* taskp, AstArg* argsp)
: ASTGEN_SUPER_TaskRef(fl, taskp->name(), argsp) {
this->taskp(taskp);
dtypeSetVoid();
}

View File

@ -220,7 +220,7 @@ public:
class AstNodeFTaskRef VL_NOT_FINAL : public AstNodeExpr {
// A reference to a task (or function)
// op1 used by some sub-types only
// @astgen op2 := pinsp : List[AstNodeExpr]
// @astgen op2 := argsp : List[AstArg]
// @astgen op3 := withp : Optional[AstWith]
// @astgen op4 := scopeNamep : Optional[AstScopeName]
//
@ -235,10 +235,10 @@ private:
VIsCached m_purity; // Pure state
protected:
AstNodeFTaskRef(VNType t, FileLine* fl, const string& name, AstNodeExpr* pinsp)
AstNodeFTaskRef(VNType t, FileLine* fl, const string& name, AstArg* argsp)
: AstNodeExpr{t, fl}
, m_name{name} {
addPinsp(pinsp);
addArgsp(argsp);
}
public:
@ -4494,9 +4494,9 @@ class AstFuncRef final : public AstNodeFTaskRef {
// A reference to a function
bool m_superReference = false; // Called with super reference
public:
inline AstFuncRef(FileLine* fl, AstFunc* taskp, AstNodeExpr* pinsp);
AstFuncRef(FileLine* fl, const string& name, AstNodeExpr* pinsp)
: ASTGEN_SUPER_FuncRef(fl, name, pinsp) {}
inline AstFuncRef(FileLine* fl, AstFunc* taskp, AstArg* argsp = nullptr);
AstFuncRef(FileLine* fl, const string& name, AstArg* argsp = nullptr)
: ASTGEN_SUPER_FuncRef(fl, name, argsp) {}
ASTGEN_MEMBERS_AstFuncRef;
bool superReference() const { return m_superReference; }
void superReference(bool flag) { m_superReference = flag; }
@ -4508,13 +4508,13 @@ class AstMethodCall final : public AstNodeFTaskRef {
//
public:
AstMethodCall(FileLine* fl, AstNodeExpr* fromp, VFlagChildDType, const string& name,
AstNodeExpr* pinsp)
: ASTGEN_SUPER_MethodCall(fl, name, pinsp) {
AstArg* argsp = nullptr)
: ASTGEN_SUPER_MethodCall(fl, name, argsp) {
this->fromp(fromp);
dtypep(nullptr); // V3Width will resolve
}
AstMethodCall(FileLine* fl, AstNodeExpr* fromp, const string& name, AstNodeExpr* pinsp)
: ASTGEN_SUPER_MethodCall(fl, name, pinsp) {
AstMethodCall(FileLine* fl, AstNodeExpr* fromp, const string& name, AstArg* argsp = nullptr)
: ASTGEN_SUPER_MethodCall(fl, name, argsp) {
this->fromp(fromp);
}
ASTGEN_MEMBERS_AstMethodCall;
@ -4525,8 +4525,8 @@ class AstNew final : public AstNodeFTaskRef {
bool m_isImplicit = false; // Implicitly generated from extends args
bool m_isScoped = false; // Had :: scope when parsed
public:
AstNew(FileLine* fl, AstNodeExpr* pinsp, bool isScoped = false)
: ASTGEN_SUPER_New(fl, "new", pinsp)
AstNew(FileLine* fl, AstArg* argsp = nullptr, bool isScoped = false)
: ASTGEN_SUPER_New(fl, "new", argsp)
, m_isScoped{isScoped} {}
ASTGEN_MEMBERS_AstNew;
void dump(std::ostream& str = std::cout) const override;
@ -4543,9 +4543,9 @@ class AstTaskRef final : public AstNodeFTaskRef {
// A reference to a task
bool m_superReference = false; // Called with super reference
public:
inline AstTaskRef(FileLine* fl, AstTask* taskp, AstNodeExpr* pinsp);
AstTaskRef(FileLine* fl, const string& name, AstNodeExpr* pinsp)
: ASTGEN_SUPER_TaskRef(fl, name, pinsp) {
inline AstTaskRef(FileLine* fl, AstTask* taskp, AstArg* argsp = nullptr);
AstTaskRef(FileLine* fl, const string& name, AstArg* argsp = nullptr)
: ASTGEN_SUPER_TaskRef(fl, name, argsp) {
dtypeSetVoid();
}
ASTGEN_MEMBERS_AstTaskRef;

View File

@ -768,7 +768,7 @@ class AstClassExtends final : public AstNode {
// during early parse, then moves to dtype
// @astgen op1 := childDTypep : Optional[AstNodeDType]
// @astgen op2 := classOrPkgsp : Optional[AstNode]
// @astgen op3 := argsp : List[AstNodeExpr]
// @astgen op3 := argsp : List[AstArg]
const bool m_isImplements; // class implements
bool m_parameterized = false; // has parameters in its statement

View File

@ -920,11 +920,11 @@ public:
};
class AstRSProdItem final : public AstNodeStmt {
// randomsquence production item
// @astgen op1 := argsp : List[AstNodeExpr]
// @astgen op1 := argsp : List[AstArg]
// @astgen ptr := m_prodp : Optional[AstRSProd] // Pointer to production
string m_name; // Name of block, or "" to use first production
public:
AstRSProdItem(FileLine* fl, const string& name, AstNodeExpr* argsp)
AstRSProdItem(FileLine* fl, const string& name, AstArg* argsp)
: ASTGEN_SUPER_RSProdItem(fl)
, m_name{name} {
addArgsp(argsp);

View File

@ -95,8 +95,8 @@ bool AstNodeFTaskRef::getPurityRecurse() const {
// Unlinked yet, so treat as impure
if (!taskp) return false;
// First compute the purity of arguments
for (AstNode* pinp = this->pinsp(); pinp; pinp = pinp->nextp()) {
if (!pinp->isPure()) return false;
for (AstArg* argp = this->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
if (!argp->isPure()) return false;
}
return taskp->isPure();
}

View File

@ -1012,7 +1012,7 @@ class EmitVBaseVisitorConst VL_NOT_FINAL : public VNVisitorConst {
}
if (!VN_IS(nodep->taskp(), Property)) {
puts("(");
iterateAndNextConstNull(nodep->pinsp());
iterateAndNextConstNull(nodep->argsp());
puts(")");
iterateConstNull(nodep->withp());
}

View File

@ -154,7 +154,7 @@ public:
UASSERT(stmtp, "Procedure lacks body");
UASSERT(initp, "Procedure lacks statements besides declarations");
AstNew* const newp = new AstNew{m_procp->fileline(), nullptr};
AstNew* const newp = new AstNew{m_procp->fileline()};
newp->taskp(VN_AS(memberMap.findMember(m_instance.m_classp, "new"), NodeFTask));
newp->dtypep(m_instance.m_refDTypep);
newp->classOrPackagep(m_instance.m_classp);
@ -212,7 +212,7 @@ public:
private:
AstAssign* instantiateDynScope(VMemberMap& memberMap) {
AstNew* const newp = new AstNew{m_procp->fileline(), nullptr};
AstNew* const newp = new AstNew{m_procp->fileline()};
newp->taskp(VN_AS(memberMap.findMember(m_instance.m_classp, "new"), NodeFTask));
newp->dtypep(m_instance.m_refDTypep);
newp->classOrPackagep(m_instance.m_classp);

View File

@ -1984,18 +1984,21 @@ class LinkDotFindVisitor final : public VNVisitor {
UASSERT_OBJ(funcrefp, nodep, "'with' only can operate on a function/task");
string name = "item";
FileLine* argFl = nodep->fileline();
AstArg* argp = VN_CAST(funcrefp->pinsp(), Arg);
if (argp) argp->unlinkFrBackWithNext();
if (argp && funcrefp->name() != "randomize") {
if (const auto parserefp = VN_CAST(argp->exprp(), ParseRef)) {
name = parserefp->name();
argFl = parserefp->fileline();
} else {
argp->v3error("'with' function expects simple variable name");
AstArg* const argsp = funcrefp->argsp();
if (argsp) {
argsp->unlinkFrBackWithNext();
if (funcrefp->name() != "randomize") {
if (const auto parserefp = VN_CAST(argsp->exprp(), ParseRef)) {
name = parserefp->name();
argFl = parserefp->fileline();
} else {
argsp->v3error("'with' function expects simple variable name");
}
if (argsp->nextp()) {
argsp->nextp()->v3error("'with' function expects only up to one argument");
}
VL_DO_DANGLING(argsp->deleteTree(), argsp);
}
if (argp->nextp())
argp->nextp()->v3error("'with' function expects only up to one argument");
VL_DO_DANGLING(argp->deleteTree(), argp);
}
// Type depends on the method used, let V3Width figure it out later
if (nodep->exprsp()
@ -2018,7 +2021,7 @@ class LinkDotFindVisitor final : public VNVisitor {
= new AstWith{nodep->fileline(), indexArgRefp, valueArgRefp, exprOrConstraintsp};
funcrefp->withp(newp);
}
funcrefp->addPinsp(argp);
funcrefp->addArgsp(argsp);
nodep->replaceWith(nodep->funcrefp()->unlinkFrBack());
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
@ -3060,9 +3063,9 @@ class LinkDotResolveVisitor final : public VNVisitor {
const AstClassExtends* const classExtendsp) {
// Returns the added node
FileLine* const fl = nodep->fileline();
AstNodeExpr* pinsp = nullptr;
if (classExtendsp->argsp()) pinsp = classExtendsp->argsp()->cloneTree(true);
AstNew* const newExprp = new AstNew{fl, pinsp};
AstArg* argsp = nullptr;
if (classExtendsp->argsp()) argsp = classExtendsp->argsp()->cloneTree(true);
AstNew* const newExprp = new AstNew{fl, argsp};
newExprp->isImplicit(true);
AstDot* const superNewp = new AstDot{fl, false, new AstParseRef{fl, "super"}, newExprp};
AstNodeStmt* const superNewStmtp = superNewp->makeStmt();
@ -3751,7 +3754,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
m_ds = lastStates;
// Resolve function args before bailing
if (AstNodeFTaskRef* const ftaskrefp = VN_CAST(nodep->rhsp(), NodeFTaskRef)) {
iterateAndNextNull(ftaskrefp->pinsp());
iterateAndNextNull(ftaskrefp->argsp());
}
return;
}
@ -3779,7 +3782,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
// Resolve function args before bailing
if (AstNodeFTaskRef* const ftaskrefp
= VN_CAST(nodep->rhsp(), NodeFTaskRef)) {
iterateAndNextNull(ftaskrefp->pinsp());
iterateAndNextNull(ftaskrefp->argsp());
}
return;
}
@ -3789,7 +3792,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
m_ds = lastStates;
// Resolve function args before bailing
if (AstNodeFTaskRef* const ftaskrefp = VN_CAST(nodep->rhsp(), NodeFTaskRef)) {
iterateAndNextNull(ftaskrefp->pinsp());
iterateAndNextNull(ftaskrefp->argsp());
}
return;
}
@ -4150,9 +4153,9 @@ class LinkDotResolveVisitor final : public VNVisitor {
} else if (allowFTask && VN_IS(foundp->nodep(), NodeFTask)) {
AstNodeFTaskRef* taskrefp;
if (VN_IS(foundp->nodep(), Task)) {
taskrefp = new AstTaskRef{nodep->fileline(), nodep->name(), nullptr};
taskrefp = new AstTaskRef{nodep->fileline(), nodep->name()};
} else {
taskrefp = new AstFuncRef{nodep->fileline(), nodep->name(), nullptr};
taskrefp = new AstFuncRef{nodep->fileline(), nodep->name()};
}
nodep->replaceWith(taskrefp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -4340,7 +4343,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
// In these cases, the parentheses may be skipped.
// Also SV class methods can be called without parens
AstFuncRef* const funcRefp
= new AstFuncRef{nodep->fileline(), nodep->name(), nullptr};
= new AstFuncRef{nodep->fileline(), nodep->name()};
nodep->replaceWith(funcRefp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}
@ -4765,7 +4768,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
VL_RESTORER(m_randMethodCallp);
{
m_ds.init(m_curSymp);
if (nodep->name() == "randomize" && (nodep->pinsp() || nodep->withp())) {
if (nodep->name() == "randomize" && (nodep->argsp() || nodep->withp())) {
m_randMethodCallp = nodep;
const AstNodeDType* fromDtp = nodep->fromp()->dtypep();
if (!fromDtp) {
@ -4889,7 +4892,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
// Found a Var, everything following is method call.
// {scope}.{var}.HERE {method} ( ARGS )
AstNodeExpr* const varEtcp = VN_AS(m_ds.m_dotp->lhsp()->unlinkFrBack(), NodeExpr);
AstNodeExpr* const argsp = nodep->pinsp();
AstArg* const argsp = nodep->argsp();
if (argsp) argsp->unlinkFrBackWithNext();
AstMethodCall* const newp = new AstMethodCall{nodep->fileline(), varEtcp,
VFlagChildDType{}, nodep->name(), argsp};
@ -4941,10 +4944,10 @@ class LinkDotResolveVisitor final : public VNVisitor {
VSymEnt* const foundp = m_randSymp->findIdFlat(nodep->name());
if (foundp && m_inWith) {
UINFO(9, indent() << "randomize-with fromSym " << foundp->nodep());
AstNodeExpr* argsp = nullptr;
if (nodep->pinsp()) {
iterateAndNextNull(nodep->pinsp());
argsp = nodep->pinsp()->unlinkFrBackWithNext();
AstArg* argsp = nullptr;
if (nodep->argsp()) {
iterateAndNextNull(nodep->argsp());
argsp = nodep->argsp()->unlinkFrBackWithNext();
}
if (m_ds.m_dotPos != DP_NONE) m_ds.m_dotPos = DP_MEMBER;
AstNode* const newp = new AstMethodCall{
@ -5045,15 +5048,10 @@ class LinkDotResolveVisitor final : public VNVisitor {
if (VN_IS(nodep, FuncRef)) {
newp = new AstConst{nodep->fileline(), AstConst::All0{}};
} else {
AstNode* outp = nullptr;
while (nodep->pinsp()) {
AstNode* const pinp = nodep->pinsp()->unlinkFrBack();
AstNode* addp = pinp;
if (AstArg* const argp = VN_CAST(pinp, Arg)) {
addp = argp->exprp()->unlinkFrBack();
VL_DO_DANGLING2(pushDeletep(pinp), pinp, argp);
}
outp = AstNode::addNext(outp, addp);
AstNodeExpr* outp = nullptr;
while (AstArg* const argp = nodep->argsp()) {
outp = AstNode::addNext(outp, argp->exprp()->unlinkFrBack());
VL_DO_DANGLING(pushDeletep(argp->unlinkFrBack()), argp);
}
newp = new AstSysIgnore{nodep->fileline(), outp};
newp->dtypep(nodep->dtypep());

View File

@ -172,7 +172,7 @@ class LinkJumpVisitor final : public VNVisitor {
AstClass* const processClassp
= VN_AS(getMemberp(v3Global.rootp()->stdPackagep(), "process"), Class);
AstFunc* const selfMethodp = VN_AS(getMemberp(processClassp, "self"), Func);
AstFuncRef* const processSelfp = new AstFuncRef{fl, selfMethodp, nullptr};
AstFuncRef* const processSelfp = new AstFuncRef{fl, selfMethodp};
processSelfp->classOrPackagep(processClassp);
return new AstStmtExpr{
fl, new AstMethodCall{fl, queueRefp, "push_back", new AstArg{fl, "", processSelfp}}};

View File

@ -166,9 +166,7 @@ class RandomizeMarkVisitor final : public VNVisitor {
bool isVarInStdRandomizeArgs(const AstVar* varp) const {
if (!m_inStdWith || !m_stdRandCallp) return false;
for (AstNode* pinp = m_stdRandCallp->pinsp(); pinp; pinp = pinp->nextp()) {
const AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
for (AstArg* argp = m_stdRandCallp->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
const AstNodeExpr* exprp = argp->exprp();
// Traverse through expression to find the base variable
while (exprp) {
@ -438,7 +436,7 @@ class RandomizeMarkVisitor final : public VNVisitor {
methodHardp->v3fatalSrc("Unknown rand_mode() receiver");
}
}
if (!nodep->pinsp() && VN_IS(nodep->backp(), StmtExpr)
if (!nodep->argsp() && VN_IS(nodep->backp(), StmtExpr)
&& !nodep->backp()->fileline()->warnIsOff(V3ErrorCode::IGNOREDRETURN)) {
nodep->v3warn(
IGNOREDRETURN,
@ -448,14 +446,14 @@ class RandomizeMarkVisitor final : public VNVisitor {
if (valid) {
const RandModeTarget randModeTarget = RandModeTarget::get(fromp, m_classp);
if ((!randModeTarget.receiverp || !randModeTarget.receiverp->isRand())
&& !nodep->pinsp()) {
&& !nodep->argsp()) {
nodep->v3error(
"Cannot call 'rand_mode()' as a function on non-random variable");
valid = false;
} else if (!randModeTarget.classp) {
nodep->v3error("Cannot call 'rand_mode()' on non-random, non-class variable");
valid = false;
} else if (nodep->pinsp() && !VN_IS(nodep->backp(), StmtExpr)) {
} else if (nodep->argsp() && !VN_IS(nodep->backp(), StmtExpr)) {
nodep->v3error("'rand_mode()' with arguments cannot be called as a function");
valid = false;
} else if (randModeTarget.receiverp
@ -484,7 +482,7 @@ class RandomizeMarkVisitor final : public VNVisitor {
}
}
if (!valid) {
if (!nodep->pinsp() && !VN_IS(nodep->backp(), StmtExpr)) {
if (!nodep->argsp() && !VN_IS(nodep->backp(), StmtExpr)) {
nodep->replaceWith(new AstConst{nodep->fileline(), 0});
VL_DO_DANGLING(nodep->deleteTree(), nodep);
} else {
@ -496,11 +494,11 @@ class RandomizeMarkVisitor final : public VNVisitor {
if (nodep->name() == "constraint_mode") {
bool valid = true;
if (nodep->pinsp() && !VN_IS(nodep->backp(), StmtExpr)) {
if (nodep->argsp() && !VN_IS(nodep->backp(), StmtExpr)) {
nodep->v3error(
"'constraint_mode()' with arguments cannot be called as a function");
valid = false;
} else if (!nodep->pinsp() && VN_IS(nodep->backp(), StmtExpr)
} else if (!nodep->argsp() && VN_IS(nodep->backp(), StmtExpr)
&& !nodep->backp()->fileline()->warnIsOff(V3ErrorCode::IGNOREDRETURN)) {
nodep->v3warn(
IGNOREDRETURN,
@ -522,7 +520,7 @@ class RandomizeMarkVisitor final : public VNVisitor {
valid = false;
}
}
if (!nodep->pinsp() && !constrp) {
if (!nodep->argsp() && !constrp) {
nodep->v3error("Cannot call 'constraint_mode()' as a function on a variable");
valid = false;
}
@ -537,7 +535,7 @@ class RandomizeMarkVisitor final : public VNVisitor {
});
}
} else {
if (!nodep->pinsp() && !VN_IS(nodep->backp(), StmtExpr)) {
if (!nodep->argsp() && !VN_IS(nodep->backp(), StmtExpr)) {
nodep->replaceWith(new AstConst{nodep->fileline(), 0});
VL_DO_DANGLING(nodep->deleteTree(), nodep);
} else {
@ -590,16 +588,12 @@ class RandomizeMarkVisitor final : public VNVisitor {
}
if (nodep->classOrPackagep()->name() == "std") {
m_stdRandCallp = nullptr;
for (AstNode* pinp = nodep->pinsp(); pinp; pinp = pinp->nextp()) {
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
handleRandomizeArgument(argp->exprp(), nullptr, true);
}
return;
}
for (AstNode* pinp = nodep->pinsp(); pinp; pinp = pinp->nextp()) {
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
classp->user1(IS_RANDOMIZED_INLINE);
AstVar* fromVarp = nullptr; // If nodep is a method call, this is its receiver
if (AstMethodCall* methodCallp = VN_CAST(nodep, MethodCall)) {
@ -2181,14 +2175,14 @@ class CaptureVisitor final : public VNVisitor {
}
AstClass* classp = VN_CAST(nodep->taskp()->user2p(), Class);
if ((classp == m_callerp) && VN_IS(m_callerp, Class)) {
AstNodeExpr* const pinsp = nodep->pinsp();
if (pinsp) pinsp->unlinkFrBack();
AstArg* const argsp = nodep->argsp();
if (argsp) argsp->unlinkFrBack(); // TODO: should this be unlinkFrBackWithNext?
AstVar* const thisp = importThisp(nodep->fileline());
AstVarRef* const thisRefp = new AstVarRef{
nodep->fileline(), thisp, nodep->isPure() ? VAccess::READ : VAccess::READWRITE};
m_ignore.emplace(thisRefp);
AstMethodCall* const methodCallp
= new AstMethodCall{nodep->fileline(), thisRefp, thisp->name(), pinsp};
= new AstMethodCall{nodep->fileline(), thisRefp, thisp->name(), argsp};
methodCallp->taskp(nodep->taskp());
methodCallp->dtypep(nodep->dtypep());
nodep->replaceWith(methodCallp);
@ -2214,14 +2208,16 @@ class CaptureVisitor final : public VNVisitor {
iterateChildren(nodep);
return;
}
AstNodeExpr* const pinsp
= nodep->pinsp() ? nodep->pinsp()->unlinkFrBackWithNext() : nullptr;
AstArg* const argsp = nodep->argsp();
if (argsp) argsp->unlinkFrBackWithNext();
AstNodeFTaskRef* taskRefp = nullptr;
if (AstTask* const taskp = VN_CAST(nodep->taskp(), Task))
taskRefp = new AstTaskRef{nodep->fileline(), taskp, pinsp};
else if (AstFunc* const taskp = VN_CAST(nodep->taskp(), Func))
taskRefp = new AstFuncRef{nodep->fileline(), taskp, pinsp};
UASSERT_OBJ(taskRefp, nodep, "Node needs to point to regular method");
if (AstTask* const taskp = VN_CAST(nodep->taskp(), Task)) {
taskRefp = new AstTaskRef{nodep->fileline(), taskp, argsp};
} else if (AstFunc* const taskp = VN_CAST(nodep->taskp(), Func)) {
taskRefp = new AstFuncRef{nodep->fileline(), taskp, argsp};
} else {
nodep->v3fatalSrc("Node needs to point to regular method");
}
fixupClassOrPackage(nodep->taskp(), taskRefp);
taskRefp->user1(nodep->user1());
nodep->replaceWith(taskRefp);
@ -2841,7 +2837,7 @@ class RandomizeVisitor final : public VNVisitor {
} else if (const AstClassRefDType* const classRefDtp = VN_CAST(memberDtp, ClassRefDType)) {
AstFunc* const memberFuncp
= V3Randomize::newRandomizeFunc(m_memberMap, classRefDtp->classp());
AstMethodCall* const callp = new AstMethodCall{fl, exprp, "randomize", nullptr};
AstMethodCall* const callp = new AstMethodCall{fl, exprp, "randomize"};
callp->taskp(memberFuncp);
callp->dtypeFrom(memberFuncp);
AstAssign* const assignp = new AstAssign{
@ -2913,7 +2909,7 @@ class RandomizeVisitor final : public VNVisitor {
}
void addPrePostCall(AstClass* const classp, AstFunc* const funcp, const string& name) {
if (AstTask* const userFuncp = findPrePostTask(classp, name)) {
AstTaskRef* const callp = new AstTaskRef{userFuncp->fileline(), userFuncp, nullptr};
AstTaskRef* const callp = new AstTaskRef{userFuncp->fileline(), userFuncp};
funcp->addStmtsp(callp->makeStmt());
}
}
@ -2959,8 +2955,7 @@ class RandomizeVisitor final : public VNVisitor {
// 1. Call member.pre/post_randomize() if exists in hierarchy
if (AstTask* const userFuncp = findPrePostTask(memberClassp, cbName)) {
AstMethodCall* const callp = new AstMethodCall{
fl, new AstVarRef{fl, ownerClassp, memberVarp, VAccess::WRITE}, cbName,
nullptr};
fl, new AstVarRef{fl, ownerClassp, memberVarp, VAccess::WRITE}, cbName};
callp->taskp(userFuncp);
callp->dtypeSetVoid();
stmtsp = AstNode::addNext(stmtsp, callp->makeStmt());
@ -2972,7 +2967,7 @@ class RandomizeVisitor final : public VNVisitor {
AstTask* const nestedTaskp = getCreateNestedCallbackTask(memberClassp, suffix);
AstMethodCall* const recurseCallp = new AstMethodCall{
fl, new AstVarRef{fl, ownerClassp, memberVarp, VAccess::WRITE},
nestedTaskp->name(), nullptr};
nestedTaskp->name()};
recurseCallp->taskp(nestedTaskp);
recurseCallp->dtypeSetVoid();
stmtsp = AstNode::addNext(stmtsp, recurseCallp->makeStmt());
@ -3155,10 +3150,10 @@ class RandomizeVisitor final : public VNVisitor {
? new AstMethodCall{fl,
new AstVarRef{fl, classp, memberVarp,
VAccess::WRITE},
BASIC_RANDOMIZE_FUNC_NAME, nullptr}
BASIC_RANDOMIZE_FUNC_NAME}
: new AstMethodCall{
fl, new AstVarRef{fl, classp, memberVarp, VAccess::WRITE},
"randomize", nullptr};
"randomize"};
callp->taskp(memberFuncp);
callp->dtypeFrom(memberFuncp);
AstVarRef* const basicFvarRefReadp = basicFvarRefp->cloneTree(false);
@ -3206,9 +3201,9 @@ class RandomizeVisitor final : public VNVisitor {
void replaceWithModeAssign(AstNodeFTaskRef* const ftaskRefp, AstNode* const receiverp,
AstNodeExpr* const lhsp) {
FileLine* const fl = ftaskRefp->fileline();
if (ftaskRefp->pinsp()) {
if (ftaskRefp->argsp()) {
UASSERT_OBJ(VN_IS(ftaskRefp->backp(), StmtExpr), ftaskRefp, "Should be a statement");
AstNodeExpr* const rhsp = VN_AS(ftaskRefp->pinsp(), Arg)->exprp()->unlinkFrBack();
AstNodeExpr* const rhsp = ftaskRefp->argsp()->exprp()->unlinkFrBack();
if (receiverp) {
// Called on a rand member variable/constraint. Set the variable/constraint's
// mode
@ -3257,33 +3252,29 @@ class RandomizeVisitor final : public VNVisitor {
// Handle inline random variable control. After this, the randomize() call has no args
void handleRandomizeArgs(AstNodeFTaskRef* const nodep) {
if (!nodep->pinsp()) return;
if (!nodep->argsp()) return;
// This assumes arguments to always be a member sel from nodep->fromp(), if applicable
// e.g. LinkDot transformed a.randomize(b, a.c) -> a.randomize(a.b, a.c)
// Merge pins with common prefixes so that setting their rand mode doesn't interfere
// with each other.
// e.g. a.randomize(a.b, a.c, a.b.d) -> a.randomize(a.b, a.c)
for (AstNode *pinp = nodep->pinsp(), *nextp = nullptr; pinp; pinp = nextp) {
nextp = pinp->nextp();
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
AstNode* otherNextp = nullptr;
for (AstNode* otherPinp = nextp; otherPinp; otherPinp = otherNextp) {
otherNextp = otherPinp->nextp();
AstArg* const otherArgp = VN_CAST(otherPinp, Arg);
if (!otherArgp) continue;
for (AstArg *argp = nodep->argsp(), *nextp = nullptr; argp; argp = nextp) {
nextp = VN_AS(argp->nextp(), Arg);
for (AstArg *otherArgp = nextp, *otherNextp = nullptr; otherArgp;
otherArgp = otherNextp) {
otherNextp = VN_AS(otherArgp->nextp(), Arg);
if (AstNodeExpr* const prefixp
= sliceToCommonPrefix(argp->exprp(), otherArgp->exprp())) {
if (prefixp == argp->exprp()) {
if (nextp == otherPinp) nextp = nextp->nextp();
VL_DO_DANGLING(otherPinp->unlinkFrBack()->deleteTree(), otherPinp);
if (nextp == otherArgp) nextp = VN_AS(nextp->nextp(), Arg);
VL_DO_DANGLING(otherArgp->unlinkFrBack()->deleteTree(), otherArgp);
continue;
}
}
if (AstNodeExpr* const prefixp
= sliceToCommonPrefix(otherArgp->exprp(), argp->exprp())) {
if (prefixp == otherArgp->exprp()) {
VL_DO_DANGLING(pinp->unlinkFrBack()->deleteTree(), pinp);
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
break;
}
}
@ -3295,11 +3286,9 @@ class RandomizeVisitor final : public VNVisitor {
AstNode* storeStmtsp = nullptr;
AstNode* setStmtsp = nullptr;
AstNodeStmt* restoreStmtsp = nullptr;
for (AstNode *pinp = nodep->pinsp(), *nextp = nullptr; pinp; pinp = nextp) {
nextp = pinp->nextp();
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
AstNodeExpr* exprp = VN_AS(pinp, Arg)->exprp();
for (AstArg *argp = nodep->argsp(), *nextp = nullptr; argp; argp = nextp) {
nextp = VN_AS(argp->nextp(), Arg);
AstNodeExpr* exprp = argp->exprp();
AstNodeExpr* const commonPrefixp = sliceToCommonPrefix(exprp, nodep);
UASSERT_OBJ(commonPrefixp != exprp, nodep,
"Common prefix should be different than pin");
@ -3324,7 +3313,7 @@ class RandomizeVisitor final : public VNVisitor {
= AstNode::addNext(setStmtsp, new AstAssign{fl, setp, new AstConst{fl, 1}});
exprp = getFromp(exprp);
}
pinp->unlinkFrBack()->deleteTree();
argp->unlinkFrBack()->deleteTree();
}
if (tmpVarps) {
UASSERT_OBJ(storeStmtsp && setStmtsp && restoreStmtsp, nodep, "Should have stmts");
@ -3374,7 +3363,7 @@ class RandomizeVisitor final : public VNVisitor {
if (classHasRandClassMembers(nodep)) {
AstTask* const preTaskp = getCreateNestedCallbackTask(nodep, "pre");
populateNestedCallbackTask(preTaskp, nodep, "pre_randomize");
randomizep->addStmtsp((new AstTaskRef{fl, preTaskp, nullptr})->makeStmt());
randomizep->addStmtsp((new AstTaskRef{fl, preTaskp})->makeStmt());
}
// Both IS_RANDOMIZED and IS_RANDOMIZED_GLOBAL classes need full constraint support
@ -3388,8 +3377,7 @@ class RandomizeVisitor final : public VNVisitor {
taskp = newSetupConstraintTask(classp, constrp->name());
constrp->user2p(taskp);
}
AstTaskRef* const setupTaskRefp
= new AstTaskRef{constrp->fileline(), taskp, nullptr};
AstTaskRef* const setupTaskRefp = new AstTaskRef{constrp->fileline(), taskp};
setupTaskRefp->classOrPackagep(classp);
AstTask* const setupAllTaskp = getCreateConstraintSetupFunc(nodep);
@ -3399,7 +3387,7 @@ class RandomizeVisitor final : public VNVisitor {
if (AstTask* const resizeTaskp = VN_CAST(constrp->user3p(), Task)) {
AstTask* const resizeAllTaskp = getCreateAggrResizeTask(nodep);
AstTaskRef* const resizeTaskRefp
= new AstTaskRef{constrp->fileline(), resizeTaskp, nullptr};
= new AstTaskRef{constrp->fileline(), resizeTaskp};
resizeTaskRefp->classOrPackagep(classp);
resizeAllTaskp->addStmtsp(resizeTaskRefp->makeStmt());
}
@ -3469,7 +3457,7 @@ class RandomizeVisitor final : public VNVisitor {
}
AstTask* setupAllTaskp = getCreateConstraintSetupFunc(nodep);
AstTaskRef* const setupTaskRefp = new AstTaskRef{fl, setupAllTaskp, nullptr};
AstTaskRef* const setupTaskRefp = new AstTaskRef{fl, setupAllTaskp};
randomizep->addStmtsp(setupTaskRefp->makeStmt());
AstNodeModule* const genModp = VN_AS(genp->user2p(), NodeModule);
@ -3495,7 +3483,7 @@ class RandomizeVisitor final : public VNVisitor {
if (AstTask* const resizeAllTaskp
= VN_AS(m_memberMap.findMember(nodep, "__Vresize_constrained_arrays"), Task)) {
AstTaskRef* const resizeTaskRefp = new AstTaskRef{fl, resizeAllTaskp, nullptr};
AstTaskRef* const resizeTaskRefp = new AstTaskRef{fl, resizeAllTaskp};
randomizep->addStmtsp(resizeTaskRefp->makeStmt());
}
@ -3505,7 +3493,7 @@ class RandomizeVisitor final : public VNVisitor {
AstFunc* const basicRandomizep
= V3Randomize::newRandomizeFunc(m_memberMap, nodep, BASIC_RANDOMIZE_FUNC_NAME);
addBasicRandomizeBody(basicRandomizep, nodep, randModeVarp);
AstFuncRef* const basicRandomizeCallp = new AstFuncRef{fl, basicRandomizep, nullptr};
AstFuncRef* const basicRandomizeCallp = new AstFuncRef{fl, basicRandomizep};
randomizep->addStmtsp(new AstAssign{fl, fvarRefp->cloneTree(false),
new AstAnd{fl, fvarRefReadp, basicRandomizeCallp}});
@ -3513,7 +3501,7 @@ class RandomizeVisitor final : public VNVisitor {
if (classHasRandClassMembers(nodep)) {
AstTask* const postTaskp = getCreateNestedCallbackTask(nodep, "post");
populateNestedCallbackTask(postTaskp, nodep, "post_randomize");
randomizep->addStmtsp((new AstTaskRef{fl, postTaskp, nullptr})->makeStmt());
randomizep->addStmtsp((new AstTaskRef{fl, postTaskp})->makeStmt());
}
addPrePostCall(nodep, randomizep, "post_randomize");
@ -3642,10 +3630,8 @@ class RandomizeVisitor final : public VNVisitor {
std::unique_ptr<CaptureVisitor> withCapturep;
int argn = 0;
AstWith* const withp = nodep->withp();
for (const AstNode* pinp = nodep->pinsp(); pinp; pinp = pinp->nextp()) {
const AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
AstNodeExpr* exprp = argp->exprp();
for (const AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
AstNodeExpr* const exprp = argp->exprp();
AstCMethodHard* const basicMethodp = new AstCMethodHard{
nodep->fileline(),
new AstVarRef{nodep->fileline(), stdrand, VAccess::READWRITE},
@ -3722,7 +3708,7 @@ class RandomizeVisitor final : public VNVisitor {
nodep->taskp(randomizeFuncp);
nodep->dtypeFrom(randomizeFuncp->dtypep());
if (VN_IS(m_modp, Class)) nodep->classOrPackagep(m_modp);
if (withCapturep) nodep->addPinsp(withCapturep->getArgs());
if (withCapturep) nodep->addArgsp(withCapturep->getArgs());
UINFOTREE(9, nodep, "", "std::rnd-call");
UINFOTREE(9, randomizeFuncp, "", "std::rnd-func");
return;
@ -3778,8 +3764,7 @@ class RandomizeVisitor final : public VNVisitor {
if (!preTaskp->stmtsp()) {
populateNestedCallbackTask(preTaskp, classp, "pre_randomize");
}
randomizeFuncp->addStmtsp(
(new AstTaskRef{nodep->fileline(), preTaskp, nullptr})->makeStmt());
randomizeFuncp->addStmtsp((new AstTaskRef{nodep->fileline(), preTaskp})->makeStmt());
}
// Detach the expression and prepare variable copies
@ -3815,12 +3800,12 @@ class RandomizeVisitor final : public VNVisitor {
AstFunc* const basicRandomizeFuncp
= V3Randomize::newRandomizeFunc(m_memberMap, classp, BASIC_RANDOMIZE_FUNC_NAME);
AstFuncRef* const basicRandomizeFuncCallp
= new AstFuncRef{nodep->fileline(), basicRandomizeFuncp, nullptr};
= new AstFuncRef{nodep->fileline(), basicRandomizeFuncp};
// Copy (derive) class constraints if present
if (classGenp) {
AstTask* const constrSetupFuncp = getCreateConstraintSetupFunc(classp);
AstTaskRef* const callp = new AstTaskRef{nodep->fileline(), constrSetupFuncp, nullptr};
AstTaskRef* const callp = new AstTaskRef{nodep->fileline(), constrSetupFuncp};
randomizeFuncp->addStmtsp(callp->makeStmt());
randomizeFuncp->addStmtsp(new AstAssign{
nodep->fileline(), new AstVarRef{nodep->fileline(), localGenp, VAccess::WRITE},
@ -3857,15 +3842,14 @@ class RandomizeVisitor final : public VNVisitor {
if (!postTaskp->stmtsp()) {
populateNestedCallbackTask(postTaskp, classp, "post_randomize");
}
randomizeFuncp->addStmtsp(
(new AstTaskRef{nodep->fileline(), postTaskp, nullptr})->makeStmt());
randomizeFuncp->addStmtsp((new AstTaskRef{nodep->fileline(), postTaskp})->makeStmt());
}
addPrePostCall(classp, randomizeFuncp, "post_randomize");
// Replace the node with a call to that function
nodep->name(randomizeFuncp->name());
nodep->addPinsp(captured.getArgs());
nodep->addArgsp(captured.getArgs());
nodep->taskp(randomizeFuncp);
nodep->dtypeFrom(randomizeFuncp->dtypep());
nodep->classOrPackagep(classp);

View File

@ -479,7 +479,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
const AstNodeFTask* const ftaskp = nodep->taskp();
UASSERT_OBJ(ftaskp, nodep, "Unlinked");
// Iterate arguments of a function/task.
for (AstNode *argp = nodep->pinsp(), *paramp = ftaskp->stmtsp(); argp;
for (AstNode *argp = nodep->argsp(), *paramp = ftaskp->stmtsp(); argp;
argp = argp->nextp(), paramp = paramp ? paramp->nextp() : nullptr) {
const char* reason = nullptr;
const AstVar* vparamp = nullptr;

View File

@ -657,7 +657,7 @@ class TaskVisitor final : public VNVisitor {
connectPort(portp, argp, namePrefix, beginp, true);
}
}
UASSERT_OBJ(!refp->pinsp(), refp, "Pin wasn't removed by above loop");
UASSERT_OBJ(!refp->argsp(), refp, "Arg wasn't removed by above loop");
{
AstNode* nextstmtp;
for (AstNode* stmtp = beginp; stmtp; stmtp = nextstmtp) {
@ -755,14 +755,10 @@ class TaskVisitor final : public VNVisitor {
ccallp->addArgsp(new AstConst(flp, flp->lineno()));
}
// Create connections
AstNode* nextpinp;
for (AstNode* pinp = refp->pinsp(); pinp; pinp = nextpinp) {
nextpinp = pinp->nextp();
// Move pin to the CCall, removing all Arg's
AstNodeExpr* const exprp = VN_AS(pinp, Arg)->exprp();
exprp->unlinkFrBack();
ccallp->addArgsp(exprp);
// Move artument expression to the CCall, without AstArg
for (AstArg *argp = refp->argsp(), *nextp; argp; argp = nextp) {
nextp = VN_AS(argp->nextp(), Arg);
ccallp->addArgsp(argp->exprp()->unlinkFrBack());
}
if (outvscp) ccallp->addArgsp(new AstVarRef{refp->fileline(), outvscp, VAccess::WRITE});
@ -1471,10 +1467,9 @@ class TaskVisitor final : public VNVisitor {
UINFOTREE(9, newp, "", "newfunc");
m_insStmtp->addHereThisAsNext(newp);
}
void processPins(AstNodeFTaskRef* nodep) {
void processArgs(AstNodeFTaskRef* nodep) {
// Create a fresh variable for each concat array present in pins list
for (AstNode* pinp = nodep->pinsp(); pinp; pinp = pinp->nextp()) {
AstArg* const argp = VN_AS(pinp, Arg);
for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
AstInitArray* const arrayp = VN_CAST(argp->exprp(), InitArray);
if (!arrayp) continue;
@ -1550,7 +1545,7 @@ class TaskVisitor final : public VNVisitor {
AstNode* beginp;
AstCNew* cnewp = nullptr;
if (m_statep->ftaskNoInline(nodep->taskp())) {
processPins(nodep);
processArgs(nodep);
// This may share VarScope's with a public task, if any. Yuk.
beginp = createNonInlinedFTask(nodep, namePrefix, outvscp, cnewp /*ref*/);
} else {
@ -1775,24 +1770,22 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
// Find pins
int ppinnum = 0;
bool reorganize = false;
for (AstNode *nextp, *pinp = nodep->pinsp(); pinp; pinp = nextp) {
nextp = pinp->nextp();
AstArg* const argp = VN_AS(pinp, Arg);
UASSERT_OBJ(argp, pinp, "Non-arg under ftask reference");
if (argp->name() != "") {
for (AstArg *argp = nodep->argsp(), *nextp; argp; argp = nextp) {
nextp = VN_AS(argp->nextp(), Arg);
if (!argp->name().empty()) {
// By name
const auto it = nameToIndex.find(argp->name());
if (it == nameToIndex.end()) {
if (makeChanges) {
pinp->v3error("No such argument " << argp->prettyNameQ()
argp->v3error("No such argument " << argp->prettyNameQ()
<< " in function call to "
<< nodep->taskp()->prettyTypeName());
// We'll just delete it; seems less error prone than making a false argument
VL_DO_DANGLING(pinp->unlinkFrBack()->deleteTree(), pinp);
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
}
} else {
if (tconnects[it->second].second && makeChanges) {
pinp->v3error("Duplicate argument " << argp->prettyNameQ()
argp->v3error("Duplicate argument " << argp->prettyNameQ()
<< " in function call to "
<< nodep->taskp()->prettyTypeName());
tconnects[it->second].second->unlinkFrBack()->deleteTree();
@ -1809,10 +1802,10 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
tconnects[ppinnum].second = argp;
++tpinnum;
} else if (makeChanges) {
pinp->v3error("Too many arguments in function call to "
argp->v3error("Too many arguments in function call to "
<< nodep->taskp()->prettyTypeName());
// We'll just delete it; seems less error prone than making a false argument
VL_DO_DANGLING(pinp->unlinkFrBack()->deleteTree(), pinp);
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp);
}
} else {
tconnects[ppinnum].second = argp;
@ -1891,14 +1884,14 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp,
if (reorganize) {
// To simplify downstream, put argument list back into pure pinnumber ordering
while (nodep->pinsp()) {
while (nodep->argsp()) {
// Must unlink each pin, not all pins linked together as one list
nodep->pinsp()->unlinkFrBack();
nodep->argsp()->unlinkFrBack();
}
for (int i = 0; i < tpinnum; ++i) {
AstArg* const argp = tconnects[i].second;
UASSERT_OBJ(argp, nodep, "Lost argument in func conversion");
nodep->addPinsp(argp);
nodep->addArgsp(argp);
}
}
@ -1970,13 +1963,13 @@ AstNodeFTask* V3Task::taskConnectWrapNew(AstNodeFTask* taskp, const string& newn
newFVarp->name(newTaskp->name());
newTaskp->fvarp(newFVarp);
newTaskp->dtypeFrom(newFVarp);
newCallp = new AstFuncRef{taskp->fileline(), VN_AS(taskp, Func), nullptr};
newCallp = new AstFuncRef{taskp->fileline(), VN_AS(taskp, Func)};
newCallInsertp
= new AstAssign{taskp->fileline(),
new AstVarRef{fvarp->fileline(), newFVarp, VAccess::WRITE}, newCallp};
newCallInsertp->dtypeFrom(newFVarp);
} else if (VN_IS(taskp, Task)) {
newCallp = new AstTaskRef{taskp->fileline(), VN_AS(taskp, Task), nullptr};
newCallp = new AstTaskRef{taskp->fileline(), VN_AS(taskp, Task)};
newCallInsertp = new AstStmtExpr{taskp->fileline(), newCallp};
} else {
taskp->v3fatalSrc("Unsupported: Non-constant default value in missing argument in a "
@ -2014,7 +2007,7 @@ AstNodeFTask* V3Task::taskConnectWrapNew(AstNodeFTask* taskp, const string& newn
const VAccess pinAccess = portp->isWritable() ? VAccess::WRITE : VAccess::READ;
AstArg* const newArgp = new AstArg{portp->fileline(), portp->name(),
new AstVarRef{portp->fileline(), newPortp, pinAccess}};
newCallp->addPinsp(newArgp);
newCallp->addArgsp(newArgp);
}
// Create wrapper call to original, passing arguments, adding setting of return value
newTaskp->addStmtsp(newCallInsertp);

View File

@ -3422,8 +3422,8 @@ class WidthVisitor final : public VNVisitor {
|| VN_IS(fromDtp, BasicDType)) {
// Method call on enum without following parenthesis, e.g. "ENUM.next"
// Convert this into a method call, and let that visitor figure out what to do next
AstNode* const newp = new AstMethodCall{
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name(), nullptr};
AstNode* const newp = new AstMethodCall{nodep->fileline(),
nodep->fromp()->unlinkFrBack(), nodep->name()};
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
userIterate(newp, m_vup);
@ -3440,7 +3440,7 @@ class WidthVisitor final : public VNVisitor {
bool memberSelClass(AstMemberSel* nodep, AstClassRefDType* adtypep) {
if (nodep->name() == "rand_mode" || nodep->name() == "randomize") {
AstMethodCall* const newp = new AstMethodCall{
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name(), nullptr};
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name()};
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
visit(newp);
@ -3484,7 +3484,7 @@ class WidthVisitor final : public VNVisitor {
}
if (AstNodeFTask* ftaskp = VN_CAST(foundp, NodeFTask)) {
AstMethodCall* newp = new AstMethodCall{
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name(), nullptr};
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name()};
newp->taskp(ftaskp);
newp->dtypep(ftaskp->dtypep());
newp->classOrPackagep(classp);
@ -3675,10 +3675,7 @@ class WidthVisitor final : public VNVisitor {
withp->v3error("'with' not legal on this method");
VL_DO_DANGLING(pushDeletep(withp->unlinkFrBack()), withp);
}
for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) {
++narg;
UASSERT_OBJ(VN_IS(argp, Arg), nodep, "Method arg without Arg type");
}
for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) ++narg;
const bool ok = (narg >= minArg) && (narg <= maxArg);
if (!ok) {
nodep->v3error("The " << narg << " arguments passed to ." << nodep->prettyName()
@ -3687,12 +3684,12 @@ class WidthVisitor final : public VNVisitor {
<< " arguments");
// Adjust to required argument counts, very bogus, but avoids core dump
for (; narg < minArg; ++narg) {
nodep->addPinsp(
nodep->addArgsp(
new AstArg{nodep->fileline(), "", new AstConst(nodep->fileline(), 0)});
}
for (; narg > maxArg; --narg) {
AstNode* argp = nodep->pinsp();
while (argp->nextp()) argp = argp->nextp();
AstArg* argp = nodep->argsp();
while (argp->nextp()) argp = VN_AS(argp->nextp(), Arg);
argp->unlinkFrBack();
VL_DO_DANGLING(argp->deleteTree(), argp);
}
@ -3700,10 +3697,10 @@ class WidthVisitor final : public VNVisitor {
}
AstNodeExpr* methodArg(AstMethodCall* nodep, int arg) {
AstNode* argp = nodep->pinsp();
for (int narg = 0; narg < arg; ++narg) argp = argp->nextp();
AstArg* argp = nodep->argsp();
for (int narg = 0; narg < arg; ++narg) argp = VN_AS(argp->nextp(), Arg);
UASSERT_OBJ(argp, nodep, "methodOkArguments() should have detected arg count error");
return VN_AS(argp, Arg)->exprp();
return argp->exprp();
}
void methodCallEnum(AstMethodCall* nodep, AstEnumDType* adtypep) {
@ -3759,7 +3756,7 @@ class WidthVisitor final : public VNVisitor {
nodep->v3fatalSrc("Bad case");
}
if (nodep->name() != "name" && nodep->pinsp()) {
if (nodep->name() != "name" && nodep->argsp()) {
AstNodeExpr* stepp = methodArg(nodep, 0);
VL_DO_DANGLING(V3Const::constifyParamsNoWarnEdit(stepp), stepp);
stepp = methodArg(nodep, 0);
@ -3779,15 +3776,15 @@ class WidthVisitor final : public VNVisitor {
AstMethodCall* const newp = new AstMethodCall{
nodep->fileline(),
new AstMethodCall{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
"next", nullptr},
"prev", nullptr};
"next"},
"prev"};
// No dtype assigned, we will recurse the new method and replace
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
return;
} else if (stepWidth != 1) {
// Unroll of enumVar.next(k) to enumVar.next(1).next(k - 1)
pushDeletep(nodep->pinsp()->unlinkFrBack());
pushDeletep(nodep->argsp()->unlinkFrBack());
AstMethodCall* const clonep = nodep->cloneTree(false);
VN_AS(stepp, Const)->num().setLong(1);
AstConst* const constp = new AstConst(nodep->fileline(), stepWidth - 1);
@ -3836,7 +3833,7 @@ class WidthVisitor final : public VNVisitor {
} else if (nodep->name() == "delete") { // function void delete([input integer index])
methodOkArguments(nodep, 0, 1);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
if (!nodep->pinsp()) {
if (!nodep->argsp()) {
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::ASSOC_CLEAR};
newp->dtypeSetVoid();
@ -3929,7 +3926,7 @@ class WidthVisitor final : public VNVisitor {
} else if (nodep->name() == "delete") { // function void delete([input integer index])
methodOkArguments(nodep, 0, 1);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
if (!nodep->pinsp()) {
if (!nodep->argsp()) {
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::ASSOC_CLEAR};
newp->dtypeSetVoid();
@ -4006,19 +4003,19 @@ class WidthVisitor final : public VNVisitor {
}
}
AstNodeExpr* methodCallAssocIndexExpr(AstMethodCall* nodep, AstAssocArrayDType* adtypep) {
AstNode* const index_exprp = VN_CAST(nodep->pinsp(), Arg)->exprp();
AstNode* const index_exprp = nodep->argsp()->exprp();
iterateCheck(nodep, "index", index_exprp, CONTEXT_DET, FINAL, adtypep->keyDTypep(),
EXTEND_EXP);
VL_DANGLING(index_exprp); // May have been edited
return VN_AS(nodep->pinsp(), Arg)->exprp();
return nodep->argsp()->exprp();
}
AstNodeExpr* methodCallWildcardIndexExpr(AstMethodCall* nodep,
AstWildcardArrayDType* adtypep) {
AstNode* const index_exprp = VN_CAST(nodep->pinsp(), Arg)->exprp();
AstNode* const index_exprp = nodep->argsp()->exprp();
iterateCheck(nodep, "index", index_exprp, CONTEXT_DET, FINAL, adtypep->findStringDType(),
EXTEND_EXP);
VL_DANGLING(index_exprp); // May have been edited
return VN_AS(nodep->pinsp(), Arg)->exprp();
return nodep->argsp()->exprp();
}
void methodCallLValueRecurse(AstMethodCall* nodep, AstNode* childp, const VAccess& access) {
if (AstCMethodHard* const ichildp = VN_CAST(childp, CMethodHard)) {
@ -4203,7 +4200,7 @@ class WidthVisitor final : public VNVisitor {
} else if (nodep->name() == "delete") { // function void delete([input integer index])
methodOkArguments(nodep, 0, 1);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
if (!nodep->pinsp()) {
if (!nodep->argsp()) {
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::DYN_CLEAR};
newp->dtypeSetVoid();
@ -4226,7 +4223,7 @@ class WidthVisitor final : public VNVisitor {
iterateCheckSigned32(nodep, "index", methodArg(nodep, 0), BOTH);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
AstNodeExpr* const index_exprp = methodCallQueueIndexExpr(nodep);
AstArg* const argp = VN_AS(nodep->pinsp()->nextp(), Arg);
AstArg* const argp = VN_AS(nodep->argsp()->nextp(), Arg);
iterateCheckTyped(nodep, "insert value", argp->exprp(), adtypep->subDTypep(), BOTH);
if (index_exprp->isZero()) { // insert(0, ...) is a push_front
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
@ -4249,7 +4246,7 @@ class WidthVisitor final : public VNVisitor {
methodOkArguments(nodep, 1, 1);
iterateCheckTyped(nodep, "argument", methodArg(nodep, 0), adtypep->subDTypep(), BOTH);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
AstArg* const argp = VN_AS(nodep->pinsp(), Arg);
AstArg* const argp = nodep->argsp();
iterateCheckTyped(nodep, "push value", argp->exprp(), adtypep->subDTypep(), BOTH);
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::arrayMethod(nodep->name()),
@ -4280,10 +4277,10 @@ class WidthVisitor final : public VNVisitor {
}
}
AstNodeExpr* methodCallQueueIndexExpr(AstMethodCall* nodep) {
AstNode* const index_exprp = VN_AS(nodep->pinsp(), Arg)->exprp();
AstNode* const index_exprp = nodep->argsp()->exprp();
iterateCheckSigned32(nodep, "index", index_exprp, BOTH);
VL_DANGLING(index_exprp); // May have been edited
return VN_AS(nodep->pinsp(), Arg)->exprp();
return nodep->argsp()->exprp();
}
void methodCallWarnTiming(AstNodeFTaskRef* const nodep, const std::string& className) {
if (v3Global.opt.timing().isSetFalse()) {
@ -4303,8 +4300,8 @@ class WidthVisitor final : public VNVisitor {
UINFO(5, __FUNCTION__ << "AstNodeFTask" << nodep);
userIterate(ftaskp, nullptr);
if (ftaskp->isStatic()) {
AstNodeExpr* argsp = nullptr;
if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext();
AstArg* const argsp = nodep->argsp();
if (argsp) argsp->unlinkFrBackWithNext();
AstNodeFTaskRef* newp = nullptr;
if (VN_IS(ftaskp, Task)) {
newp = new AstTaskRef{nodep->fileline(), VN_AS(ftaskp, Task), argsp};
@ -4329,10 +4326,8 @@ class WidthVisitor final : public VNVisitor {
void handleRandomizeArgs(AstNodeFTaskRef* const nodep, AstClass* const classp) {
bool hasNonNullArgs = false;
AstConst* nullp = nullptr;
for (AstNode *pinp = nodep->pinsp(), *nextp = nullptr; pinp; pinp = nextp) {
nextp = pinp->nextp();
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
for (AstArg *argp = nodep->argsp(), *nextp; argp; argp = nextp) {
nextp = VN_AS(argp->nextp(), Arg);
AstVar* randVarp = nullptr;
AstNodeExpr* exprp = argp->exprp();
if (AstConst* const constp = VN_CAST(exprp, Const)) {
@ -4408,10 +4403,8 @@ class WidthVisitor final : public VNVisitor {
m_randomizeFromp = nodep->fromp();
withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(),
adtypep->findBitDType(), adtypep);
for (AstNode* pinp = nodep->pinsp(); pinp; pinp = pinp->nextp()) {
if (AstArg* const argp = VN_CAST(pinp, Arg)) {
if (argp->exprp()) userIterate(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
if (argp->exprp()) userIterate(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
V3Randomize::newRandomizeFunc(m_memberMap, first_classp);
@ -4446,8 +4439,8 @@ class WidthVisitor final : public VNVisitor {
= VN_CAST(m_memberMap.findMember(classp, nodep->name()), NodeFTask)) {
userIterate(ftaskp, nullptr);
if (ftaskp->isStatic()) {
AstNodeExpr* argsp = nullptr;
if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext();
AstArg* const argsp = nodep->argsp();
if (argsp) argsp->unlinkFrBackWithNext();
AstNodeFTaskRef* newp = nullptr;
// We use m_vup to determine task or function, so that later error checks
// for funcref->task and taskref->func will pick up properly
@ -4490,9 +4483,9 @@ class WidthVisitor final : public VNVisitor {
return;
} else if (nodep->name() == "set_randstate") {
methodOkArguments(nodep, 1, 1);
AstNodeExpr* const expr1p = VN_AS(nodep->pinsp(), Arg)->exprp(); // May edit
AstNodeExpr* const expr1p = nodep->argsp()->exprp(); // May edit
iterateCheckString(nodep, "LHS", expr1p, BOTH);
AstNodeExpr* const exprp = VN_AS(nodep->pinsp(), Arg)->exprp();
AstNodeExpr* const exprp = nodep->argsp()->exprp();
first_classp->baseMostClassp()->needRNG(true);
v3Global.useRandomizeMethods(true);
AstCMethodHard* const newp
@ -4530,7 +4523,7 @@ class WidthVisitor final : public VNVisitor {
if (nodep->name() == "constraint_mode") {
// IEEE 1800-2023 18.9
methodOkArguments(nodep, 0, 1);
if (nodep->pinsp()) {
if (nodep->argsp()) {
iterateCheckBool(nodep, "argument", methodArg(nodep, 0), BOTH);
nodep->dtypep(nodep->findBasicDType(VBasicDTypeKwd::INT));
} else {
@ -4546,7 +4539,7 @@ class WidthVisitor final : public VNVisitor {
void methodCallRandMode(AstMethodCall* nodep) {
methodOkArguments(nodep, 0, 1);
// IEEE 1800-2023 18.8
if (nodep->pinsp()) {
if (nodep->argsp()) {
iterateCheckBool(nodep, "argument", methodArg(nodep, 0), BOTH);
nodep->dtypeSetVoid();
} else {
@ -4685,7 +4678,7 @@ class WidthVisitor final : public VNVisitor {
const bool ignoreCase = nodep->name()[0] == 'i';
methodOkArguments(nodep, 1, 1);
iterateCheckString(nodep, "argument", methodArg(nodep, 0), BOTH);
AstArg* const argp = VN_AS(nodep->pinsp(), Arg);
AstArg* const argp = nodep->argsp();
AstNodeExpr* const lhs = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhs = argp->exprp()->unlinkFrBack();
AstNode* const newp = new AstCompareNN{nodep->fileline(), lhs, rhs, ignoreCase};
@ -4695,7 +4688,7 @@ class WidthVisitor final : public VNVisitor {
methodOkArguments(nodep, 2, 2);
iterateCheckSigned32(nodep, "argument 0", methodArg(nodep, 0), BOTH);
iterateCheckSigned8(nodep, "argument 1", methodArg(nodep, 1), BOTH);
AstArg* const arg0p = VN_AS(nodep->pinsp(), Arg);
AstArg* const arg0p = nodep->argsp();
AstArg* const arg1p = VN_AS(arg0p->nextp(), Arg);
AstNodeVarRef* const fromp = VN_AS(nodep->fromp()->unlinkFrBack(), VarRef);
AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack();
@ -4710,7 +4703,7 @@ class WidthVisitor final : public VNVisitor {
} else if (nodep->name() == "getc") {
methodOkArguments(nodep, 1, 1);
iterateCheckSigned32(nodep, "argument", methodArg(nodep, 0), BOTH);
AstArg* const arg0p = VN_AS(nodep->pinsp(), Arg);
AstArg* const arg0p = nodep->argsp();
AstNodeExpr* const lhsp = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack();
AstNodeExpr* const newp = new AstGetcN{nodep->fileline(), lhsp, rhsp};
@ -4720,7 +4713,7 @@ class WidthVisitor final : public VNVisitor {
methodOkArguments(nodep, 2, 2);
iterateCheckSigned32(nodep, "argument 0", methodArg(nodep, 0), BOTH);
iterateCheckSigned32(nodep, "argument 1", methodArg(nodep, 1), BOTH);
AstArg* const arg0p = VN_AS(nodep->pinsp(), Arg);
AstArg* const arg0p = nodep->argsp();
AstArg* const arg1p = VN_AS(arg0p->nextp(), Arg);
AstNodeExpr* const lhsp = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack();
@ -5840,8 +5833,8 @@ class WidthVisitor final : public VNVisitor {
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
return;
}
AstMethodCall* const newp = new AstMethodCall{
nodep->fileline(), nodep->lhsp()->unlinkFrBack(), "delete", nullptr};
AstMethodCall* const newp
= new AstMethodCall{nodep->fileline(), nodep->lhsp()->unlinkFrBack(), "delete"};
newp->dtypeSetVoid();
nodep->replaceWith(newp->makeStmt());
VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -6883,10 +6876,8 @@ class WidthVisitor final : public VNVisitor {
void handleStdRandomizeArgs(AstNodeFTaskRef* const nodep) {
AstConst* nullp = nullptr;
for (AstNode *pinp = nodep->pinsp(), *nextp = nullptr; pinp; pinp = nextp) {
nextp = pinp->nextp();
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
for (AstArg *argp = nodep->argsp(), *nextp; argp; argp = nextp) {
nextp = VN_AS(argp->nextp(), Arg);
AstNodeExpr* const exprp = argp->exprp();
if (AstConst* const constp = VN_CAST(exprp, Const)) {
if (constp->num().isNull()) {
@ -6935,8 +6926,9 @@ class WidthVisitor final : public VNVisitor {
AstNodeDType* const adtypep = nodep->findBitDType();
withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(),
adtypep->findBitDType(), adtypep);
for (const AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp())
userIterateAndNext(VN_AS(argp, Arg)->exprp(), WidthVP{SELF, BOTH}.p());
for (const AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
userIterateAndNext(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
handleStdRandomizeArgs(nodep); // Provided args should be in current scope
processFTaskRefArgs(nodep);
if (withp) nodep->withp(withp);
@ -6950,8 +6942,9 @@ class WidthVisitor final : public VNVisitor {
v3Global.rootp()->typeTablep()->addTypesp(adtypep);
withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(),
adtypep->findBitDType(), adtypep);
for (const AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp())
userIterateAndNext(VN_AS(argp, Arg)->exprp(), WidthVP{SELF, BOTH}.p());
for (const AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
userIterateAndNext(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
handleRandomizeArgs(nodep, classp);
} else if (nodep->name() == "srandom") {
nodep->taskp(V3Randomize::newSRandomFunc(m_memberMap, classp));
@ -6968,9 +6961,9 @@ class WidthVisitor final : public VNVisitor {
return;
} else if (nodep->name() == "set_randstate") {
methodOkArguments(nodep, 1, 1);
AstNodeExpr* const expr1p = VN_AS(nodep->pinsp(), Arg)->exprp(); // May edit
AstNodeExpr* const expr1p = nodep->argsp()->exprp(); // May edit
iterateCheckString(nodep, "LHS", expr1p, BOTH);
AstNodeExpr* const exprp = VN_AS(nodep->pinsp(), Arg)->exprp();
AstNodeExpr* const exprp = nodep->argsp()->exprp();
classp->baseMostClassp()->needRNG(true);
v3Global.useRandomizeMethods(true);
AstCExpr* const newp
@ -8724,7 +8717,7 @@ class WidthVisitor final : public VNVisitor {
void replaceWithSFormat(AstMethodCall* nodep, const string& format) {
// For string.itoa and similar, replace with SFormatF
const AstArg* argp = VN_CAST(nodep->pinsp(), Arg);
AstArg* const argp = nodep->argsp();
UASSERT_OBJ(argp, nodep,
"Argument needed for string method, call methodOkArguments before here");
AstNodeVarRef* const fromp = VN_AS(nodep->fromp()->unlinkFrBack(), VarRef);

View File

@ -3840,7 +3840,7 @@ class_new<nodeExprp>: // IEEE: class_new
class_newNoScope<nodeExprp>: // IEEE: class_new but no packageClassScope
// // Special precedence so (...) doesn't match expr
yNEW__ETC { $$ = new AstNew{$1, nullptr}; }
yNEW__ETC { $$ = new AstNew{$1}; }
| yNEW__ETC expr { $$ = new AstNewCopy{$1, $2}; }
| yNEW__PAREN '(' list_of_argumentsE ')' { $$ = new AstNew{$1, $3}; }
;
@ -4114,7 +4114,7 @@ loop_variableE<nodep>: // IEEE: part of loop_variables
// Functions/tasks
taskRef<nodeExprp>: // IEEE: part of tf_call
id { $$ = new AstTaskRef{$<fl>1, *$1, nullptr}; }
id { $$ = new AstTaskRef{$<fl>1, *$1}; }
| id '(' list_of_argumentsE ')' { $$ = new AstTaskRef{$<fl>1, *$1, $3}; }
| packageClassScope id '(' list_of_argumentsE ')'
{ $$ = AstDot::newIfPkg($<fl>2, $1, new AstTaskRef{$<fl>2, *$2, $4}); }
@ -4159,7 +4159,7 @@ task_subroutine_callNoMethod<nodeExprp>: // function_subroutine_callNoMethod
// // funcref below not task ref to avoid conflict, must later handle either
| funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; }
// // can call as method and yWITH without parenthesis
| id yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, new AstFuncRef{$<fl>1, *$1, nullptr}, $4}; }
| id yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, new AstFuncRef{$<fl>1, *$1}, $4}; }
// // IEEE: method_call requires a "." so is in expr
// // IEEE: ['std::'] not needed, as normal std package resolution will find it
// // IEEE: randomize_call
@ -4174,7 +4174,7 @@ function_subroutine_callNoMethod<nodeExprp>: // IEEE: function_subroutine
funcRef { $$ = $1; }
| funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; }
// // can call as method and yWITH without parenthesis
| id yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, new AstFuncRef{$<fl>1, *$1, nullptr}, $4}; }
| id yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, new AstFuncRef{$<fl>1, *$1}, $4}; }
| system_f_only_expr_call { $$ = $1; }
| system_f_or_t_expr_call { $$ = $1; }
// // IEEE: method_call requires a "." so is in expr
@ -4601,10 +4601,10 @@ exprOrDataType<nodep>: // expr | data_type: combined to prevent conflic
//UNSUP | exprOrDataTypeList ',' exprOrDataType { $$ = addNextNull($1, $3); }
//UNSUP ;
list_of_argumentsE<nodeExprp>: // IEEE: [list_of_arguments]
list_of_argumentsE<argp>: // IEEE: [list_of_arguments]
argsDottedList { $$ = $1; }
| argsExprListE
{ if (VN_IS($1, Arg) && VN_CAST($1, Arg)->emptyConnectNoNext()) {
{ if ($1->emptyConnectNoNext()) {
$1->deleteTree(); $$ = nullptr; // Mis-created when have 'func()'
} else { $$ = $1; } }
| argsExprListE ',' argsDottedList { $$ = addNextNull($1, $3); }
@ -4876,10 +4876,10 @@ parenE:
// // method_call_root not needed, part of expr resolution
// // What's left is below array_methodNoRoot
array_methodNoRoot<nodeFTaskRefp>:
yOR { $$ = new AstFuncRef{$1, "or", nullptr}; }
| yAND { $$ = new AstFuncRef{$1, "and", nullptr}; }
| yXOR { $$ = new AstFuncRef{$1, "xor", nullptr}; }
| yUNIQUE { $$ = new AstFuncRef{$1, "unique", nullptr}; }
yOR { $$ = new AstFuncRef{$1, "or"}; }
| yAND { $$ = new AstFuncRef{$1, "and"}; }
| yXOR { $$ = new AstFuncRef{$1, "xor"}; }
| yUNIQUE { $$ = new AstFuncRef{$1, "unique"}; }
;
array_methodWith<nodeExprp>:
@ -4887,7 +4887,7 @@ array_methodWith<nodeExprp>:
| array_methodNoRoot parenE yWITH__PAREN '(' expr ')'
{ $$ = new AstWithParse{$3, $1, $5}; }
| array_methodNoRoot '(' expr ')' yWITH__PAREN '(' expr ')'
{ $$ = new AstWithParse{$5, $1, $7}; $1->addPinsp(new AstArg{$<fl>3, "", $3}); }
{ $$ = new AstWithParse{$5, $1, $7}; $1->addArgsp(new AstArg{$<fl>3, "", $3}); }
;
dpi_import_export<nodep>: // ==IEEE: dpi_import_export
@ -5406,7 +5406,7 @@ argsExprList<nodeExprp>: // IEEE: part of list_of_arguments (used where ,
| argsExprList ',' expr { $$ = $1->addNext($3); }
;
argsExprListE<nodeExprp>: // IEEE: part of list_of_arguments
argsExprListE<argp>: // IEEE: part of list_of_arguments
argsExprOneE { $$ = $1; }
| argsExprListE ',' argsExprOneE { $$ = $1->addNext($3); }
;
@ -5416,7 +5416,7 @@ argsExprListE<nodeExprp>: // IEEE: part of list_of_arguments
//UNSUP | pev_argsExprListE ',' pev_argsExprOneE { $$ = addNextNull($1, $3); }
//UNSUP ;
argsExprOneE<nodeExprp>: // IEEE: part of list_of_arguments
argsExprOneE<argp>: // IEEE: part of list_of_arguments
/*empty*/ { $$ = new AstArg{CRELINE(), "", nullptr}; }
| expr { $$ = new AstArg{$1->fileline(), "", $1}; }
;
@ -5426,7 +5426,7 @@ argsExprOneE<nodeExprp>: // IEEE: part of list_of_arguments
//UNSUP | pev_expr { $$ = $1; }
//UNSUP ;
argsDottedList<nodeExprp>: // IEEE: part of list_of_arguments
argsDottedList<argp>: // IEEE: part of list_of_arguments
argsDotted { $$ = $1; }
| argsDottedList ',' argsDotted { $$ = addNextNull($1, $3); }
;
@ -5436,12 +5436,12 @@ argsDottedList<nodeExprp>: // IEEE: part of list_of_arguments
//UNSUP | pev_argsDottedList ',' pev_argsDotted { $$ = addNextNull($1, $3); }
//UNSUP ;
argsDotted<nodeExprp>: // IEEE: part of list_of_arguments
argsDotted<argp>: // IEEE: part of list_of_arguments
'.' idAny '(' ')' { $$ = new AstArg{$<fl>2, *$2, nullptr}; }
| '.' idAny '(' expr ')' { $$ = new AstArg{$<fl>2, *$2, $4}; }
;
//UNSUPpev_argsDotted<nodeExprp>: // IEEE: part of list_of_arguments - pev_expr at bottom
//UNSUPpev_argsDotted<argp>: // IEEE: part of list_of_arguments - pev_expr at bottom
//UNSUP '.' idAny '(' ')' { $$ = new AstArg{$<fl>2, *$2, nullptr}; }
//UNSUP | '.' idAny '(' pev_expr ')' { $$ = new AstArg{$<fl>2, *$2, $4}; }
//UNSUP ;

View File

@ -1316,7 +1316,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(WT)","loc":"d,45:14,45:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(XT)","loc":"d,45:22,45:26","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(XT)","loc":"d,45:22,45:26","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
]}
],"scopeNamep": []},
@ -1348,7 +1348,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(JU)","loc":"d,50:30,50:37","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(KU)","loc":"d,50:38,50:42","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(KU)","loc":"d,50:38,50:42","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -1365,7 +1365,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(PU)","loc":"d,51:15,51:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(QU)","loc":"d,51:23,51:27","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(QU)","loc":"d,51:23,51:27","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -1381,7 +1381,7 @@
],
"rhsp": [
{"type":"TASKREF","name":"push_back","addr":"(VU)","loc":"d,52:15,52:24","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED",
"pinsp": [
"argsp": [
{"type":"ARG","name":"","addr":"(XU)","loc":"d,52:25,52:32",
"exprp": [
{"type":"PARSEREF","name":"message","addr":"(YU)","loc":"d,52:25,52:32","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1414,7 +1414,7 @@
"rhsp": [
{"type":"LT","name":"","addr":"(IV)","loc":"d,57:33,57:34","dtypep":"(YE)",
"lhsp": [
{"type":"FUNCREF","name":"num","addr":"(JV)","loc":"d,57:27,57:30","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"num","addr":"(JV)","loc":"d,57:27,57:30","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
],
"rhsp": [
{"type":"PARSEREF","name":"m_bound","addr":"(KV)","loc":"d,57:35,57:42","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1432,7 +1432,7 @@
],
"rhsp": [
{"type":"TASKREF","name":"push_back","addr":"(PV)","loc":"d,58:17,58:26","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED",
"pinsp": [
"argsp": [
{"type":"ARG","name":"","addr":"(QV)","loc":"d,58:27,58:34",
"exprp": [
{"type":"PARSEREF","name":"message","addr":"(RV)","loc":"d,58:27,58:34","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1468,7 +1468,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(DW)","loc":"d,66:14,66:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(EW)","loc":"d,66:22,66:26","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(EW)","loc":"d,66:22,66:26","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -1486,7 +1486,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(KW)","loc":"d,67:15,67:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(LW)","loc":"d,67:23,67:27","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(LW)","loc":"d,67:23,67:27","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -1502,7 +1502,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(PW)","loc":"d,69:17,69:24","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"pop_front","addr":"(QW)","loc":"d,69:25,69:34","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"pop_front","addr":"(QW)","loc":"d,69:25,69:34","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"lhsp": [
@ -1522,7 +1522,7 @@
"condp": [
{"type":"GT","name":"","addr":"(XW)","loc":"d,74:17,74:18","dtypep":"(YE)",
"lhsp": [
{"type":"FUNCREF","name":"num","addr":"(YW)","loc":"d,74:11,74:14","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"num","addr":"(YW)","loc":"d,74:11,74:14","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
],
"rhsp": [
{"type":"CONST","name":"?32?sh0","addr":"(ZW)","loc":"d,74:19,74:20","dtypep":"(N)"}
@ -1538,7 +1538,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(DX)","loc":"d,75:19,75:26","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"pop_front","addr":"(EX)","loc":"d,75:27,75:36","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"pop_front","addr":"(EX)","loc":"d,75:27,75:36","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"lhsp": [
@ -1572,7 +1572,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(RX)","loc":"d,83:14,83:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(SX)","loc":"d,83:22,83:26","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(SX)","loc":"d,83:22,83:26","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -1590,7 +1590,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(YX)","loc":"d,84:15,84:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(ZX)","loc":"d,84:23,84:27","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(ZX)","loc":"d,84:23,84:27","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -1626,7 +1626,7 @@
"condp": [
{"type":"GT","name":"","addr":"(LY)","loc":"d,91:17,91:18","dtypep":"(YE)",
"lhsp": [
{"type":"FUNCREF","name":"num","addr":"(MY)","loc":"d,91:11,91:14","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"num","addr":"(MY)","loc":"d,91:11,91:14","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
],
"rhsp": [
{"type":"CONST","name":"?32?sh0","addr":"(NY)","loc":"d,91:19,91:20","dtypep":"(N)"}
@ -1853,7 +1853,7 @@
{"type":"REFDTYPE","name":"process","addr":"(YBB)","loc":"d,143:7,143:14","dtypep":"UNLINKED","typedefp":"UNLINKED","refDTypep":"UNLINKED","classOrPackagep":"UNLINKED","typeofp": [],"classOrPackageOpp": [],"paramsp": []}
],"delayp": [],
"valuep": [
{"type":"NEW","name":"new","addr":"(ZBB)","loc":"d,143:19,143:22","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"NEW","name":"new","addr":"(ZBB)","loc":"d,143:19,143:22","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
],"attrsp": []},
{"type":"CSTMTUSER","name":"","addr":"(ACB)","loc":"d,145:7,145:9",
"nodesp": [
@ -1910,7 +1910,7 @@
{"type":"STMTEXPR","name":"","addr":"(YCB)","loc":"d,165:7,165:17",
"exprp": [
{"type":"TASKREF","name":"set_status","addr":"(ZCB)","loc":"d,165:7,165:17","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED",
"pinsp": [
"argsp": [
{"type":"ARG","name":"","addr":"(ADB)","loc":"d,165:18,165:24",
"exprp": [
{"type":"PARSEREF","name":"KILLED","addr":"(BDB)","loc":"d,165:18,165:24","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1934,7 +1934,7 @@
{"type":"STMTEXPR","name":"","addr":"(JDB)","loc":"d,173:7,173:17",
"exprp": [
{"type":"TASKREF","name":"set_status","addr":"(KDB)","loc":"d,173:7,173:17","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED",
"pinsp": [
"argsp": [
{"type":"ARG","name":"","addr":"(LDB)","loc":"d,173:18,173:25",
"exprp": [
{"type":"PARSEREF","name":"RUNNING","addr":"(MDB)","loc":"d,173:18,173:25","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1950,7 +1950,7 @@
"lhsp": [
{"type":"EQ","name":"","addr":"(QDB)","loc":"d,178:22,178:24","dtypep":"(YE)",
"lhsp": [
{"type":"FUNCREF","name":"status","addr":"(RDB)","loc":"d,178:13,178:19","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"status","addr":"(RDB)","loc":"d,178:13,178:19","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
],
"rhsp": [
{"type":"PARSEREF","name":"FINISHED","addr":"(SDB)","loc":"d,178:25,178:33","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1959,7 +1959,7 @@
"rhsp": [
{"type":"EQ","name":"","addr":"(TDB)","loc":"d,178:46,178:48","dtypep":"(YE)",
"lhsp": [
{"type":"FUNCREF","name":"status","addr":"(UDB)","loc":"d,178:37,178:43","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"status","addr":"(UDB)","loc":"d,178:37,178:43","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
],
"rhsp": [
{"type":"PARSEREF","name":"KILLED","addr":"(VDB)","loc":"d,178:49,178:55","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1990,7 +1990,7 @@
{"type":"PARSEREF","name":"processQueue","addr":"(FEB)","loc":"d,184:14,184:26","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"size","addr":"(GEB)","loc":"d,184:27,184:31","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"size","addr":"(GEB)","loc":"d,184:27,184:31","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
@ -2008,11 +2008,11 @@
{"type":"PARSEREF","name":"processQueue","addr":"(MEB)","loc":"d,185:9,185:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
],
"rhsp": [
{"type":"FUNCREF","name":"pop_back","addr":"(NEB)","loc":"d,185:22,185:30","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"FUNCREF","name":"pop_back","addr":"(NEB)","loc":"d,185:22,185:30","dtypep":"UNLINKED","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
],
"rhsp": [
{"type":"TASKREF","name":"kill","addr":"(OEB)","loc":"d,185:33,185:37","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","pinsp": [],"withp": [],"scopeNamep": []}
{"type":"TASKREF","name":"kill","addr":"(OEB)","loc":"d,185:33,185:37","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED","argsp": [],"withp": [],"scopeNamep": []}
]}
]}
]}

View File

@ -38,7 +38,7 @@
{"type":"STMTEXPR","name":"","addr":"(HB)","loc":"d,41:7,41:8",
"exprp": [
{"type":"TASKREF","name":"f","addr":"(IB)","loc":"d,41:7,41:8","dtypep":"(JB)","dotted":"","taskp":"(Z)","classOrPackagep":"UNLINKED",
"pinsp": [
"argsp": [
{"type":"ARG","name":"","addr":"(KB)","loc":"d,41:9,41:736",
"exprp": [
{"type":"CONST","name":"\\\"\\001\\002\\003\\004\\005\\006\\007\\010\\t\\n\\013\\014\\r\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037 !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\177\\200\\201\\202\\203\\204\\205\\206\\207\\210\\211\\212\\213\\214\\215\\216\\217\\220\\221\\222\\223\\224\\225\\226\\227\\230\\231\\232\\233\\234\\235\\236\\237\\240\\241\\242\\243\\244\\245\\246\\247\\250\\251\\252\\253\\254\\255\\256\\257\\260\\261\\262\\263\\264\\265\\266\\267\\270\\271\\272\\273\\274\\275\\276\\277\\300\\301\\302\\303\\304\\305\\306\\307\\310\\311\\312\\313\\314\\315\\316\\317\\320\\321\\322\\323\\324\\325\\326\\327\\330\\331\\332\\333\\334\\335\\336\\337\\340\\341\\342\\343\\344\\345\\346\\347\\350\\351\\352\\353\\354\\355\\356\\357\\360\\361\\362\\363\\364\\365\\366\\367\\370\\371\\372\\373\\374\\375\\376\\377\\\"","addr":"(LB)","loc":"d,41:9,41:736","dtypep":"(BB)"}