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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3422,8 +3422,8 @@ class WidthVisitor final : public VNVisitor {
|| VN_IS(fromDtp, BasicDType)) { || VN_IS(fromDtp, BasicDType)) {
// Method call on enum without following parenthesis, e.g. "ENUM.next" // 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 // Convert this into a method call, and let that visitor figure out what to do next
AstNode* const newp = new AstMethodCall{ AstNode* const newp = new AstMethodCall{nodep->fileline(),
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name(), nullptr}; nodep->fromp()->unlinkFrBack(), nodep->name()};
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
userIterate(newp, m_vup); userIterate(newp, m_vup);
@ -3440,7 +3440,7 @@ class WidthVisitor final : public VNVisitor {
bool memberSelClass(AstMemberSel* nodep, AstClassRefDType* adtypep) { bool memberSelClass(AstMemberSel* nodep, AstClassRefDType* adtypep) {
if (nodep->name() == "rand_mode" || nodep->name() == "randomize") { if (nodep->name() == "rand_mode" || nodep->name() == "randomize") {
AstMethodCall* const newp = new AstMethodCall{ AstMethodCall* const newp = new AstMethodCall{
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name(), nullptr}; nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name()};
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
visit(newp); visit(newp);
@ -3484,7 +3484,7 @@ class WidthVisitor final : public VNVisitor {
} }
if (AstNodeFTask* ftaskp = VN_CAST(foundp, NodeFTask)) { if (AstNodeFTask* ftaskp = VN_CAST(foundp, NodeFTask)) {
AstMethodCall* newp = new AstMethodCall{ AstMethodCall* newp = new AstMethodCall{
nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name(), nullptr}; nodep->fileline(), nodep->fromp()->unlinkFrBack(), nodep->name()};
newp->taskp(ftaskp); newp->taskp(ftaskp);
newp->dtypep(ftaskp->dtypep()); newp->dtypep(ftaskp->dtypep());
newp->classOrPackagep(classp); newp->classOrPackagep(classp);
@ -3675,10 +3675,7 @@ class WidthVisitor final : public VNVisitor {
withp->v3error("'with' not legal on this method"); withp->v3error("'with' not legal on this method");
VL_DO_DANGLING(pushDeletep(withp->unlinkFrBack()), withp); VL_DO_DANGLING(pushDeletep(withp->unlinkFrBack()), withp);
} }
for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) { for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) ++narg;
++narg;
UASSERT_OBJ(VN_IS(argp, Arg), nodep, "Method arg without Arg type");
}
const bool ok = (narg >= minArg) && (narg <= maxArg); const bool ok = (narg >= minArg) && (narg <= maxArg);
if (!ok) { if (!ok) {
nodep->v3error("The " << narg << " arguments passed to ." << nodep->prettyName() nodep->v3error("The " << narg << " arguments passed to ." << nodep->prettyName()
@ -3687,12 +3684,12 @@ class WidthVisitor final : public VNVisitor {
<< " arguments"); << " arguments");
// Adjust to required argument counts, very bogus, but avoids core dump // Adjust to required argument counts, very bogus, but avoids core dump
for (; narg < minArg; ++narg) { for (; narg < minArg; ++narg) {
nodep->addPinsp( nodep->addArgsp(
new AstArg{nodep->fileline(), "", new AstConst(nodep->fileline(), 0)}); new AstArg{nodep->fileline(), "", new AstConst(nodep->fileline(), 0)});
} }
for (; narg > maxArg; --narg) { for (; narg > maxArg; --narg) {
AstNode* argp = nodep->pinsp(); AstArg* argp = nodep->argsp();
while (argp->nextp()) argp = argp->nextp(); while (argp->nextp()) argp = VN_AS(argp->nextp(), Arg);
argp->unlinkFrBack(); argp->unlinkFrBack();
VL_DO_DANGLING(argp->deleteTree(), argp); VL_DO_DANGLING(argp->deleteTree(), argp);
} }
@ -3700,10 +3697,10 @@ class WidthVisitor final : public VNVisitor {
} }
AstNodeExpr* methodArg(AstMethodCall* nodep, int arg) { AstNodeExpr* methodArg(AstMethodCall* nodep, int arg) {
AstNode* argp = nodep->pinsp(); AstArg* argp = nodep->argsp();
for (int narg = 0; narg < arg; ++narg) argp = argp->nextp(); for (int narg = 0; narg < arg; ++narg) argp = VN_AS(argp->nextp(), Arg);
UASSERT_OBJ(argp, nodep, "methodOkArguments() should have detected arg count error"); 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) { void methodCallEnum(AstMethodCall* nodep, AstEnumDType* adtypep) {
@ -3759,7 +3756,7 @@ class WidthVisitor final : public VNVisitor {
nodep->v3fatalSrc("Bad case"); nodep->v3fatalSrc("Bad case");
} }
if (nodep->name() != "name" && nodep->pinsp()) { if (nodep->name() != "name" && nodep->argsp()) {
AstNodeExpr* stepp = methodArg(nodep, 0); AstNodeExpr* stepp = methodArg(nodep, 0);
VL_DO_DANGLING(V3Const::constifyParamsNoWarnEdit(stepp), stepp); VL_DO_DANGLING(V3Const::constifyParamsNoWarnEdit(stepp), stepp);
stepp = methodArg(nodep, 0); stepp = methodArg(nodep, 0);
@ -3779,15 +3776,15 @@ class WidthVisitor final : public VNVisitor {
AstMethodCall* const newp = new AstMethodCall{ AstMethodCall* const newp = new AstMethodCall{
nodep->fileline(), nodep->fileline(),
new AstMethodCall{nodep->fileline(), nodep->fromp()->unlinkFrBack(), new AstMethodCall{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
"next", nullptr}, "next"},
"prev", nullptr}; "prev"};
// No dtype assigned, we will recurse the new method and replace // No dtype assigned, we will recurse the new method and replace
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep); VL_DO_DANGLING(nodep->deleteTree(), nodep);
return; return;
} else if (stepWidth != 1) { } else if (stepWidth != 1) {
// Unroll of enumVar.next(k) to enumVar.next(1).next(k - 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); AstMethodCall* const clonep = nodep->cloneTree(false);
VN_AS(stepp, Const)->num().setLong(1); VN_AS(stepp, Const)->num().setLong(1);
AstConst* const constp = new AstConst(nodep->fileline(), stepWidth - 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]) } else if (nodep->name() == "delete") { // function void delete([input integer index])
methodOkArguments(nodep, 0, 1); methodOkArguments(nodep, 0, 1);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE); methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
if (!nodep->pinsp()) { if (!nodep->argsp()) {
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(), newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::ASSOC_CLEAR}; VCMethod::ASSOC_CLEAR};
newp->dtypeSetVoid(); newp->dtypeSetVoid();
@ -3929,7 +3926,7 @@ class WidthVisitor final : public VNVisitor {
} else if (nodep->name() == "delete") { // function void delete([input integer index]) } else if (nodep->name() == "delete") { // function void delete([input integer index])
methodOkArguments(nodep, 0, 1); methodOkArguments(nodep, 0, 1);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE); methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
if (!nodep->pinsp()) { if (!nodep->argsp()) {
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(), newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::ASSOC_CLEAR}; VCMethod::ASSOC_CLEAR};
newp->dtypeSetVoid(); newp->dtypeSetVoid();
@ -4006,19 +4003,19 @@ class WidthVisitor final : public VNVisitor {
} }
} }
AstNodeExpr* methodCallAssocIndexExpr(AstMethodCall* nodep, AstAssocArrayDType* adtypep) { 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(), iterateCheck(nodep, "index", index_exprp, CONTEXT_DET, FINAL, adtypep->keyDTypep(),
EXTEND_EXP); EXTEND_EXP);
VL_DANGLING(index_exprp); // May have been edited VL_DANGLING(index_exprp); // May have been edited
return VN_AS(nodep->pinsp(), Arg)->exprp(); return nodep->argsp()->exprp();
} }
AstNodeExpr* methodCallWildcardIndexExpr(AstMethodCall* nodep, AstNodeExpr* methodCallWildcardIndexExpr(AstMethodCall* nodep,
AstWildcardArrayDType* adtypep) { 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(), iterateCheck(nodep, "index", index_exprp, CONTEXT_DET, FINAL, adtypep->findStringDType(),
EXTEND_EXP); EXTEND_EXP);
VL_DANGLING(index_exprp); // May have been edited 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) { void methodCallLValueRecurse(AstMethodCall* nodep, AstNode* childp, const VAccess& access) {
if (AstCMethodHard* const ichildp = VN_CAST(childp, CMethodHard)) { 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]) } else if (nodep->name() == "delete") { // function void delete([input integer index])
methodOkArguments(nodep, 0, 1); methodOkArguments(nodep, 0, 1);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE); methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
if (!nodep->pinsp()) { if (!nodep->argsp()) {
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(), newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::DYN_CLEAR}; VCMethod::DYN_CLEAR};
newp->dtypeSetVoid(); newp->dtypeSetVoid();
@ -4226,7 +4223,7 @@ class WidthVisitor final : public VNVisitor {
iterateCheckSigned32(nodep, "index", methodArg(nodep, 0), BOTH); iterateCheckSigned32(nodep, "index", methodArg(nodep, 0), BOTH);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE); methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
AstNodeExpr* const index_exprp = methodCallQueueIndexExpr(nodep); 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); iterateCheckTyped(nodep, "insert value", argp->exprp(), adtypep->subDTypep(), BOTH);
if (index_exprp->isZero()) { // insert(0, ...) is a push_front if (index_exprp->isZero()) { // insert(0, ...) is a push_front
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(), newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
@ -4249,7 +4246,7 @@ class WidthVisitor final : public VNVisitor {
methodOkArguments(nodep, 1, 1); methodOkArguments(nodep, 1, 1);
iterateCheckTyped(nodep, "argument", methodArg(nodep, 0), adtypep->subDTypep(), BOTH); iterateCheckTyped(nodep, "argument", methodArg(nodep, 0), adtypep->subDTypep(), BOTH);
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE); 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); iterateCheckTyped(nodep, "push value", argp->exprp(), adtypep->subDTypep(), BOTH);
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(), newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
VCMethod::arrayMethod(nodep->name()), VCMethod::arrayMethod(nodep->name()),
@ -4280,10 +4277,10 @@ class WidthVisitor final : public VNVisitor {
} }
} }
AstNodeExpr* methodCallQueueIndexExpr(AstMethodCall* nodep) { 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); iterateCheckSigned32(nodep, "index", index_exprp, BOTH);
VL_DANGLING(index_exprp); // May have been edited 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) { void methodCallWarnTiming(AstNodeFTaskRef* const nodep, const std::string& className) {
if (v3Global.opt.timing().isSetFalse()) { if (v3Global.opt.timing().isSetFalse()) {
@ -4303,8 +4300,8 @@ class WidthVisitor final : public VNVisitor {
UINFO(5, __FUNCTION__ << "AstNodeFTask" << nodep); UINFO(5, __FUNCTION__ << "AstNodeFTask" << nodep);
userIterate(ftaskp, nullptr); userIterate(ftaskp, nullptr);
if (ftaskp->isStatic()) { if (ftaskp->isStatic()) {
AstNodeExpr* argsp = nullptr; AstArg* const argsp = nodep->argsp();
if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext(); if (argsp) argsp->unlinkFrBackWithNext();
AstNodeFTaskRef* newp = nullptr; AstNodeFTaskRef* newp = nullptr;
if (VN_IS(ftaskp, Task)) { if (VN_IS(ftaskp, Task)) {
newp = new AstTaskRef{nodep->fileline(), VN_AS(ftaskp, Task), argsp}; 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) { void handleRandomizeArgs(AstNodeFTaskRef* const nodep, AstClass* const classp) {
bool hasNonNullArgs = false; bool hasNonNullArgs = false;
AstConst* nullp = nullptr; AstConst* nullp = nullptr;
for (AstNode *pinp = nodep->pinsp(), *nextp = nullptr; pinp; pinp = nextp) { for (AstArg *argp = nodep->argsp(), *nextp; argp; argp = nextp) {
nextp = pinp->nextp(); nextp = VN_AS(argp->nextp(), Arg);
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
AstVar* randVarp = nullptr; AstVar* randVarp = nullptr;
AstNodeExpr* exprp = argp->exprp(); AstNodeExpr* exprp = argp->exprp();
if (AstConst* const constp = VN_CAST(exprp, Const)) { if (AstConst* const constp = VN_CAST(exprp, Const)) {
@ -4408,10 +4403,8 @@ class WidthVisitor final : public VNVisitor {
m_randomizeFromp = nodep->fromp(); m_randomizeFromp = nodep->fromp();
withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(), withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(),
adtypep->findBitDType(), adtypep); adtypep->findBitDType(), adtypep);
for (AstNode* pinp = nodep->pinsp(); pinp; pinp = pinp->nextp()) { for (AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
if (AstArg* const argp = VN_CAST(pinp, Arg)) { if (argp->exprp()) userIterate(argp->exprp(), WidthVP{SELF, BOTH}.p());
if (argp->exprp()) userIterate(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
} }
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ); methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::READ);
V3Randomize::newRandomizeFunc(m_memberMap, first_classp); V3Randomize::newRandomizeFunc(m_memberMap, first_classp);
@ -4446,8 +4439,8 @@ class WidthVisitor final : public VNVisitor {
= VN_CAST(m_memberMap.findMember(classp, nodep->name()), NodeFTask)) { = VN_CAST(m_memberMap.findMember(classp, nodep->name()), NodeFTask)) {
userIterate(ftaskp, nullptr); userIterate(ftaskp, nullptr);
if (ftaskp->isStatic()) { if (ftaskp->isStatic()) {
AstNodeExpr* argsp = nullptr; AstArg* const argsp = nodep->argsp();
if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext(); if (argsp) argsp->unlinkFrBackWithNext();
AstNodeFTaskRef* newp = nullptr; AstNodeFTaskRef* newp = nullptr;
// We use m_vup to determine task or function, so that later error checks // We use m_vup to determine task or function, so that later error checks
// for funcref->task and taskref->func will pick up properly // for funcref->task and taskref->func will pick up properly
@ -4490,9 +4483,9 @@ class WidthVisitor final : public VNVisitor {
return; return;
} else if (nodep->name() == "set_randstate") { } else if (nodep->name() == "set_randstate") {
methodOkArguments(nodep, 1, 1); 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); 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); first_classp->baseMostClassp()->needRNG(true);
v3Global.useRandomizeMethods(true); v3Global.useRandomizeMethods(true);
AstCMethodHard* const newp AstCMethodHard* const newp
@ -4530,7 +4523,7 @@ class WidthVisitor final : public VNVisitor {
if (nodep->name() == "constraint_mode") { if (nodep->name() == "constraint_mode") {
// IEEE 1800-2023 18.9 // IEEE 1800-2023 18.9
methodOkArguments(nodep, 0, 1); methodOkArguments(nodep, 0, 1);
if (nodep->pinsp()) { if (nodep->argsp()) {
iterateCheckBool(nodep, "argument", methodArg(nodep, 0), BOTH); iterateCheckBool(nodep, "argument", methodArg(nodep, 0), BOTH);
nodep->dtypep(nodep->findBasicDType(VBasicDTypeKwd::INT)); nodep->dtypep(nodep->findBasicDType(VBasicDTypeKwd::INT));
} else { } else {
@ -4546,7 +4539,7 @@ class WidthVisitor final : public VNVisitor {
void methodCallRandMode(AstMethodCall* nodep) { void methodCallRandMode(AstMethodCall* nodep) {
methodOkArguments(nodep, 0, 1); methodOkArguments(nodep, 0, 1);
// IEEE 1800-2023 18.8 // IEEE 1800-2023 18.8
if (nodep->pinsp()) { if (nodep->argsp()) {
iterateCheckBool(nodep, "argument", methodArg(nodep, 0), BOTH); iterateCheckBool(nodep, "argument", methodArg(nodep, 0), BOTH);
nodep->dtypeSetVoid(); nodep->dtypeSetVoid();
} else { } else {
@ -4685,7 +4678,7 @@ class WidthVisitor final : public VNVisitor {
const bool ignoreCase = nodep->name()[0] == 'i'; const bool ignoreCase = nodep->name()[0] == 'i';
methodOkArguments(nodep, 1, 1); methodOkArguments(nodep, 1, 1);
iterateCheckString(nodep, "argument", methodArg(nodep, 0), BOTH); 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 lhs = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhs = argp->exprp()->unlinkFrBack(); AstNodeExpr* const rhs = argp->exprp()->unlinkFrBack();
AstNode* const newp = new AstCompareNN{nodep->fileline(), lhs, rhs, ignoreCase}; AstNode* const newp = new AstCompareNN{nodep->fileline(), lhs, rhs, ignoreCase};
@ -4695,7 +4688,7 @@ class WidthVisitor final : public VNVisitor {
methodOkArguments(nodep, 2, 2); methodOkArguments(nodep, 2, 2);
iterateCheckSigned32(nodep, "argument 0", methodArg(nodep, 0), BOTH); iterateCheckSigned32(nodep, "argument 0", methodArg(nodep, 0), BOTH);
iterateCheckSigned8(nodep, "argument 1", methodArg(nodep, 1), 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); AstArg* const arg1p = VN_AS(arg0p->nextp(), Arg);
AstNodeVarRef* const fromp = VN_AS(nodep->fromp()->unlinkFrBack(), VarRef); AstNodeVarRef* const fromp = VN_AS(nodep->fromp()->unlinkFrBack(), VarRef);
AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack(); AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack();
@ -4710,7 +4703,7 @@ class WidthVisitor final : public VNVisitor {
} else if (nodep->name() == "getc") { } else if (nodep->name() == "getc") {
methodOkArguments(nodep, 1, 1); methodOkArguments(nodep, 1, 1);
iterateCheckSigned32(nodep, "argument", methodArg(nodep, 0), BOTH); 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 lhsp = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack(); AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack();
AstNodeExpr* const newp = new AstGetcN{nodep->fileline(), lhsp, rhsp}; AstNodeExpr* const newp = new AstGetcN{nodep->fileline(), lhsp, rhsp};
@ -4720,7 +4713,7 @@ class WidthVisitor final : public VNVisitor {
methodOkArguments(nodep, 2, 2); methodOkArguments(nodep, 2, 2);
iterateCheckSigned32(nodep, "argument 0", methodArg(nodep, 0), BOTH); iterateCheckSigned32(nodep, "argument 0", methodArg(nodep, 0), BOTH);
iterateCheckSigned32(nodep, "argument 1", methodArg(nodep, 1), 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); AstArg* const arg1p = VN_AS(arg0p->nextp(), Arg);
AstNodeExpr* const lhsp = nodep->fromp()->unlinkFrBack(); AstNodeExpr* const lhsp = nodep->fromp()->unlinkFrBack();
AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack(); AstNodeExpr* const rhsp = arg0p->exprp()->unlinkFrBack();
@ -5840,8 +5833,8 @@ class WidthVisitor final : public VNVisitor {
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
return; return;
} }
AstMethodCall* const newp = new AstMethodCall{ AstMethodCall* const newp
nodep->fileline(), nodep->lhsp()->unlinkFrBack(), "delete", nullptr}; = new AstMethodCall{nodep->fileline(), nodep->lhsp()->unlinkFrBack(), "delete"};
newp->dtypeSetVoid(); newp->dtypeSetVoid();
nodep->replaceWith(newp->makeStmt()); nodep->replaceWith(newp->makeStmt());
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -6883,10 +6876,8 @@ class WidthVisitor final : public VNVisitor {
void handleStdRandomizeArgs(AstNodeFTaskRef* const nodep) { void handleStdRandomizeArgs(AstNodeFTaskRef* const nodep) {
AstConst* nullp = nullptr; AstConst* nullp = nullptr;
for (AstNode *pinp = nodep->pinsp(), *nextp = nullptr; pinp; pinp = nextp) { for (AstArg *argp = nodep->argsp(), *nextp; argp; argp = nextp) {
nextp = pinp->nextp(); nextp = VN_AS(argp->nextp(), Arg);
AstArg* const argp = VN_CAST(pinp, Arg);
if (!argp) continue;
AstNodeExpr* const exprp = argp->exprp(); AstNodeExpr* const exprp = argp->exprp();
if (AstConst* const constp = VN_CAST(exprp, Const)) { if (AstConst* const constp = VN_CAST(exprp, Const)) {
if (constp->num().isNull()) { if (constp->num().isNull()) {
@ -6935,8 +6926,9 @@ class WidthVisitor final : public VNVisitor {
AstNodeDType* const adtypep = nodep->findBitDType(); AstNodeDType* const adtypep = nodep->findBitDType();
withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(), withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(),
adtypep->findBitDType(), adtypep); adtypep->findBitDType(), adtypep);
for (const AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) for (const AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
userIterateAndNext(VN_AS(argp, Arg)->exprp(), WidthVP{SELF, BOTH}.p()); userIterateAndNext(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
handleStdRandomizeArgs(nodep); // Provided args should be in current scope handleStdRandomizeArgs(nodep); // Provided args should be in current scope
processFTaskRefArgs(nodep); processFTaskRefArgs(nodep);
if (withp) nodep->withp(withp); if (withp) nodep->withp(withp);
@ -6950,8 +6942,9 @@ class WidthVisitor final : public VNVisitor {
v3Global.rootp()->typeTablep()->addTypesp(adtypep); v3Global.rootp()->typeTablep()->addTypesp(adtypep);
withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(), withp = methodWithClause(nodep, false, false, adtypep->findVoidDType(),
adtypep->findBitDType(), adtypep); adtypep->findBitDType(), adtypep);
for (const AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) for (const AstArg* argp = nodep->argsp(); argp; argp = VN_AS(argp->nextp(), Arg)) {
userIterateAndNext(VN_AS(argp, Arg)->exprp(), WidthVP{SELF, BOTH}.p()); userIterateAndNext(argp->exprp(), WidthVP{SELF, BOTH}.p());
}
handleRandomizeArgs(nodep, classp); handleRandomizeArgs(nodep, classp);
} else if (nodep->name() == "srandom") { } else if (nodep->name() == "srandom") {
nodep->taskp(V3Randomize::newSRandomFunc(m_memberMap, classp)); nodep->taskp(V3Randomize::newSRandomFunc(m_memberMap, classp));
@ -6968,9 +6961,9 @@ class WidthVisitor final : public VNVisitor {
return; return;
} else if (nodep->name() == "set_randstate") { } else if (nodep->name() == "set_randstate") {
methodOkArguments(nodep, 1, 1); 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); iterateCheckString(nodep, "LHS", expr1p, BOTH);
AstNodeExpr* const exprp = VN_AS(nodep->pinsp(), Arg)->exprp(); AstNodeExpr* const exprp = nodep->argsp()->exprp();
classp->baseMostClassp()->needRNG(true); classp->baseMostClassp()->needRNG(true);
v3Global.useRandomizeMethods(true); v3Global.useRandomizeMethods(true);
AstCExpr* const newp AstCExpr* const newp
@ -8724,7 +8717,7 @@ class WidthVisitor final : public VNVisitor {
void replaceWithSFormat(AstMethodCall* nodep, const string& format) { void replaceWithSFormat(AstMethodCall* nodep, const string& format) {
// For string.itoa and similar, replace with SFormatF // 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, UASSERT_OBJ(argp, nodep,
"Argument needed for string method, call methodOkArguments before here"); "Argument needed for string method, call methodOkArguments before here");
AstNodeVarRef* const fromp = VN_AS(nodep->fromp()->unlinkFrBack(), VarRef); 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 class_newNoScope<nodeExprp>: // IEEE: class_new but no packageClassScope
// // Special precedence so (...) doesn't match expr // // 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__ETC expr { $$ = new AstNewCopy{$1, $2}; }
| yNEW__PAREN '(' list_of_argumentsE ')' { $$ = new AstNew{$1, $3}; } | yNEW__PAREN '(' list_of_argumentsE ')' { $$ = new AstNew{$1, $3}; }
; ;
@ -4114,7 +4114,7 @@ loop_variableE<nodep>: // IEEE: part of loop_variables
// Functions/tasks // Functions/tasks
taskRef<nodeExprp>: // IEEE: part of tf_call 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}; } | id '(' list_of_argumentsE ')' { $$ = new AstTaskRef{$<fl>1, *$1, $3}; }
| packageClassScope id '(' list_of_argumentsE ')' | packageClassScope id '(' list_of_argumentsE ')'
{ $$ = AstDot::newIfPkg($<fl>2, $1, new AstTaskRef{$<fl>2, *$2, $4}); } { $$ = 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 below not task ref to avoid conflict, must later handle either
| funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; } | funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; }
// // can call as method and yWITH without parenthesis // // 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: method_call requires a "." so is in expr
// // IEEE: ['std::'] not needed, as normal std package resolution will find it // // IEEE: ['std::'] not needed, as normal std package resolution will find it
// // IEEE: randomize_call // // IEEE: randomize_call
@ -4174,7 +4174,7 @@ function_subroutine_callNoMethod<nodeExprp>: // IEEE: function_subroutine
funcRef { $$ = $1; } funcRef { $$ = $1; }
| funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; } | funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; }
// // can call as method and yWITH without parenthesis // // 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_only_expr_call { $$ = $1; }
| system_f_or_t_expr_call { $$ = $1; } | system_f_or_t_expr_call { $$ = $1; }
// // IEEE: method_call requires a "." so is in expr // // 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 | exprOrDataTypeList ',' exprOrDataType { $$ = addNextNull($1, $3); }
//UNSUP ; //UNSUP ;
list_of_argumentsE<nodeExprp>: // IEEE: [list_of_arguments] list_of_argumentsE<argp>: // IEEE: [list_of_arguments]
argsDottedList { $$ = $1; } argsDottedList { $$ = $1; }
| argsExprListE | argsExprListE
{ if (VN_IS($1, Arg) && VN_CAST($1, Arg)->emptyConnectNoNext()) { { if ($1->emptyConnectNoNext()) {
$1->deleteTree(); $$ = nullptr; // Mis-created when have 'func()' $1->deleteTree(); $$ = nullptr; // Mis-created when have 'func()'
} else { $$ = $1; } } } else { $$ = $1; } }
| argsExprListE ',' argsDottedList { $$ = addNextNull($1, $3); } | argsExprListE ',' argsDottedList { $$ = addNextNull($1, $3); }
@ -4876,10 +4876,10 @@ parenE:
// // method_call_root not needed, part of expr resolution // // method_call_root not needed, part of expr resolution
// // What's left is below array_methodNoRoot // // What's left is below array_methodNoRoot
array_methodNoRoot<nodeFTaskRefp>: array_methodNoRoot<nodeFTaskRefp>:
yOR { $$ = new AstFuncRef{$1, "or", nullptr}; } yOR { $$ = new AstFuncRef{$1, "or"}; }
| yAND { $$ = new AstFuncRef{$1, "and", nullptr}; } | yAND { $$ = new AstFuncRef{$1, "and"}; }
| yXOR { $$ = new AstFuncRef{$1, "xor", nullptr}; } | yXOR { $$ = new AstFuncRef{$1, "xor"}; }
| yUNIQUE { $$ = new AstFuncRef{$1, "unique", nullptr}; } | yUNIQUE { $$ = new AstFuncRef{$1, "unique"}; }
; ;
array_methodWith<nodeExprp>: array_methodWith<nodeExprp>:
@ -4887,7 +4887,7 @@ array_methodWith<nodeExprp>:
| array_methodNoRoot parenE yWITH__PAREN '(' expr ')' | array_methodNoRoot parenE yWITH__PAREN '(' expr ')'
{ $$ = new AstWithParse{$3, $1, $5}; } { $$ = new AstWithParse{$3, $1, $5}; }
| array_methodNoRoot '(' expr ')' yWITH__PAREN '(' expr ')' | 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 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); } | argsExprList ',' expr { $$ = $1->addNext($3); }
; ;
argsExprListE<nodeExprp>: // IEEE: part of list_of_arguments argsExprListE<argp>: // IEEE: part of list_of_arguments
argsExprOneE { $$ = $1; } argsExprOneE { $$ = $1; }
| argsExprListE ',' argsExprOneE { $$ = $1->addNext($3); } | 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 | pev_argsExprListE ',' pev_argsExprOneE { $$ = addNextNull($1, $3); }
//UNSUP ; //UNSUP ;
argsExprOneE<nodeExprp>: // IEEE: part of list_of_arguments argsExprOneE<argp>: // IEEE: part of list_of_arguments
/*empty*/ { $$ = new AstArg{CRELINE(), "", nullptr}; } /*empty*/ { $$ = new AstArg{CRELINE(), "", nullptr}; }
| expr { $$ = new AstArg{$1->fileline(), "", $1}; } | expr { $$ = new AstArg{$1->fileline(), "", $1}; }
; ;
@ -5426,7 +5426,7 @@ argsExprOneE<nodeExprp>: // IEEE: part of list_of_arguments
//UNSUP | pev_expr { $$ = $1; } //UNSUP | pev_expr { $$ = $1; }
//UNSUP ; //UNSUP ;
argsDottedList<nodeExprp>: // IEEE: part of list_of_arguments argsDottedList<argp>: // IEEE: part of list_of_arguments
argsDotted { $$ = $1; } argsDotted { $$ = $1; }
| argsDottedList ',' argsDotted { $$ = addNextNull($1, $3); } | 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 | pev_argsDottedList ',' pev_argsDotted { $$ = addNextNull($1, $3); }
//UNSUP ; //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 '(' ')' { $$ = new AstArg{$<fl>2, *$2, nullptr}; }
| '.' idAny '(' expr ')' { $$ = new AstArg{$<fl>2, *$2, $4}; } | '.' 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 '(' ')' { $$ = new AstArg{$<fl>2, *$2, nullptr}; }
//UNSUP | '.' idAny '(' pev_expr ')' { $$ = new AstArg{$<fl>2, *$2, $4}; } //UNSUP | '.' idAny '(' pev_expr ')' { $$ = new AstArg{$<fl>2, *$2, $4}; }
//UNSUP ; //UNSUP ;

View File

@ -1316,7 +1316,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(WT)","loc":"d,45:14,45:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(WT)","loc":"d,45:14,45:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": []}, ],"scopeNamep": []},
@ -1348,7 +1348,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(JU)","loc":"d,50:30,50:37","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(JU)","loc":"d,50:30,50:37","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -1365,7 +1365,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(PU)","loc":"d,51:15,51:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(PU)","loc":"d,51:15,51:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -1381,7 +1381,7 @@
], ],
"rhsp": [ "rhsp": [
{"type":"TASKREF","name":"push_back","addr":"(VU)","loc":"d,52:15,52:24","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED", {"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", {"type":"ARG","name":"","addr":"(XU)","loc":"d,52:25,52:32",
"exprp": [ "exprp": [
{"type":"PARSEREF","name":"message","addr":"(YU)","loc":"d,52:25,52:32","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"message","addr":"(YU)","loc":"d,52:25,52:32","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1414,7 +1414,7 @@
"rhsp": [ "rhsp": [
{"type":"LT","name":"","addr":"(IV)","loc":"d,57:33,57:34","dtypep":"(YE)", {"type":"LT","name":"","addr":"(IV)","loc":"d,57:33,57:34","dtypep":"(YE)",
"lhsp": [ "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": [ "rhsp": [
{"type":"PARSEREF","name":"m_bound","addr":"(KV)","loc":"d,57:35,57:42","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_bound","addr":"(KV)","loc":"d,57:35,57:42","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1432,7 +1432,7 @@
], ],
"rhsp": [ "rhsp": [
{"type":"TASKREF","name":"push_back","addr":"(PV)","loc":"d,58:17,58:26","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED", {"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", {"type":"ARG","name":"","addr":"(QV)","loc":"d,58:27,58:34",
"exprp": [ "exprp": [
{"type":"PARSEREF","name":"message","addr":"(RV)","loc":"d,58:27,58:34","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"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": []} {"type":"PARSEREF","name":"m_queue","addr":"(DW)","loc":"d,66:14,66:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -1486,7 +1486,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(KW)","loc":"d,67:15,67:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(KW)","loc":"d,67:15,67:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -1502,7 +1502,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(PW)","loc":"d,69:17,69:24","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(PW)","loc":"d,69:17,69:24","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "lhsp": [
@ -1522,7 +1522,7 @@
"condp": [ "condp": [
{"type":"GT","name":"","addr":"(XW)","loc":"d,74:17,74:18","dtypep":"(YE)", {"type":"GT","name":"","addr":"(XW)","loc":"d,74:17,74:18","dtypep":"(YE)",
"lhsp": [ "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": [ "rhsp": [
{"type":"CONST","name":"?32?sh0","addr":"(ZW)","loc":"d,74:19,74:20","dtypep":"(N)"} {"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": []} {"type":"PARSEREF","name":"m_queue","addr":"(DX)","loc":"d,75:19,75:26","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "lhsp": [
@ -1572,7 +1572,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(RX)","loc":"d,83:14,83:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(RX)","loc":"d,83:14,83:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -1590,7 +1590,7 @@
{"type":"PARSEREF","name":"m_queue","addr":"(YX)","loc":"d,84:15,84:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"m_queue","addr":"(YX)","loc":"d,84:15,84:22","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -1626,7 +1626,7 @@
"condp": [ "condp": [
{"type":"GT","name":"","addr":"(LY)","loc":"d,91:17,91:18","dtypep":"(YE)", {"type":"GT","name":"","addr":"(LY)","loc":"d,91:17,91:18","dtypep":"(YE)",
"lhsp": [ "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": [ "rhsp": [
{"type":"CONST","name":"?32?sh0","addr":"(NY)","loc":"d,91:19,91:20","dtypep":"(N)"} {"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": []} {"type":"REFDTYPE","name":"process","addr":"(YBB)","loc":"d,143:7,143:14","dtypep":"UNLINKED","typedefp":"UNLINKED","refDTypep":"UNLINKED","classOrPackagep":"UNLINKED","typeofp": [],"classOrPackageOpp": [],"paramsp": []}
],"delayp": [], ],"delayp": [],
"valuep": [ "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": []}, ],"attrsp": []},
{"type":"CSTMTUSER","name":"","addr":"(ACB)","loc":"d,145:7,145:9", {"type":"CSTMTUSER","name":"","addr":"(ACB)","loc":"d,145:7,145:9",
"nodesp": [ "nodesp": [
@ -1910,7 +1910,7 @@
{"type":"STMTEXPR","name":"","addr":"(YCB)","loc":"d,165:7,165:17", {"type":"STMTEXPR","name":"","addr":"(YCB)","loc":"d,165:7,165:17",
"exprp": [ "exprp": [
{"type":"TASKREF","name":"set_status","addr":"(ZCB)","loc":"d,165:7,165:17","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED", {"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", {"type":"ARG","name":"","addr":"(ADB)","loc":"d,165:18,165:24",
"exprp": [ "exprp": [
{"type":"PARSEREF","name":"KILLED","addr":"(BDB)","loc":"d,165:18,165:24","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"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", {"type":"STMTEXPR","name":"","addr":"(JDB)","loc":"d,173:7,173:17",
"exprp": [ "exprp": [
{"type":"TASKREF","name":"set_status","addr":"(KDB)","loc":"d,173:7,173:17","dtypep":"(WU)","dotted":"","taskp":"UNLINKED","classOrPackagep":"UNLINKED", {"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", {"type":"ARG","name":"","addr":"(LDB)","loc":"d,173:18,173:25",
"exprp": [ "exprp": [
{"type":"PARSEREF","name":"RUNNING","addr":"(MDB)","loc":"d,173:18,173:25","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"RUNNING","addr":"(MDB)","loc":"d,173:18,173:25","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1950,7 +1950,7 @@
"lhsp": [ "lhsp": [
{"type":"EQ","name":"","addr":"(QDB)","loc":"d,178:22,178:24","dtypep":"(YE)", {"type":"EQ","name":"","addr":"(QDB)","loc":"d,178:22,178:24","dtypep":"(YE)",
"lhsp": [ "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": [ "rhsp": [
{"type":"PARSEREF","name":"FINISHED","addr":"(SDB)","loc":"d,178:25,178:33","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"FINISHED","addr":"(SDB)","loc":"d,178:25,178:33","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
@ -1959,7 +1959,7 @@
"rhsp": [ "rhsp": [
{"type":"EQ","name":"","addr":"(TDB)","loc":"d,178:46,178:48","dtypep":"(YE)", {"type":"EQ","name":"","addr":"(TDB)","loc":"d,178:46,178:48","dtypep":"(YE)",
"lhsp": [ "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": [ "rhsp": [
{"type":"PARSEREF","name":"KILLED","addr":"(VDB)","loc":"d,178:49,178:55","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"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": []} {"type":"PARSEREF","name":"processQueue","addr":"(FEB)","loc":"d,184:14,184:26","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "rhsp": [
@ -2008,11 +2008,11 @@
{"type":"PARSEREF","name":"processQueue","addr":"(MEB)","loc":"d,185:9,185:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []} {"type":"PARSEREF","name":"processQueue","addr":"(MEB)","loc":"d,185:9,185:21","dtypep":"UNLINKED","lhsp": [],"ftaskrefp": []}
], ],
"rhsp": [ "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": [ "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", {"type":"STMTEXPR","name":"","addr":"(HB)","loc":"d,41:7,41:8",
"exprp": [ "exprp": [
{"type":"TASKREF","name":"f","addr":"(IB)","loc":"d,41:7,41:8","dtypep":"(JB)","dotted":"","taskp":"(Z)","classOrPackagep":"UNLINKED", {"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", {"type":"ARG","name":"","addr":"(KB)","loc":"d,41:9,41:736",
"exprp": [ "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)"} {"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)"}