Skip to content

Commit

Permalink
Move superReference to AstFuncRef and AstTaskRef
Browse files Browse the repository at this point in the history
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Oct 24, 2023
1 parent bcda2c8 commit b68e5ee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/V3AstNodeExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class AstNodeFTaskRef VL_NOT_FINAL : public AstNodeExpr {
string m_dotted; // Dotted part of scope the name()ed task/func is under or ""
string m_inlinedDots; // Dotted hierarchy flattened out
bool m_pli = false; // Pli system call ($name)
bool m_superReference = false; // Called with super reference
VIsCached m_purity; // Pure state

protected:
Expand Down Expand Up @@ -262,8 +261,6 @@ class AstNodeFTaskRef VL_NOT_FINAL : public AstNodeExpr {
void classOrPackagep(AstNodeModule* nodep) { m_classOrPackagep = nodep; }
bool pli() const { return m_pli; }
void pli(bool flag) { m_pli = flag; }
bool superReference() const { return m_superReference; }
void superReference(bool flag) { m_superReference = flag; }
bool isPure() override;

string emitVerilog() final override { V3ERROR_NA_RETURN(""); }
Expand Down Expand Up @@ -4204,12 +4201,15 @@ class AstCNew final : public AstNodeCCall {
// === AstNodeFTaskRef ===
class AstFuncRef final : public AstNodeFTaskRef {
// A reference to a function
bool m_superReference = false; // Called with super reference
public:
AstFuncRef(FileLine* fl, AstParseRef* namep, AstNodeExpr* pinsp)
: ASTGEN_SUPER_FuncRef(fl, (AstNode*)namep, pinsp) {}
AstFuncRef(FileLine* fl, const string& name, AstNodeExpr* pinsp)
: ASTGEN_SUPER_FuncRef(fl, name, pinsp) {}
ASTGEN_MEMBERS_AstFuncRef;
bool superReference() const { return m_superReference; }
void superReference(bool flag) { m_superReference = flag; }
};
class AstMethodCall final : public AstNodeFTaskRef {
// A reference to a member task (or function)
Expand Down Expand Up @@ -4246,6 +4246,7 @@ class AstNew final : public AstNodeFTaskRef {
};
class AstTaskRef final : public AstNodeFTaskRef {
// A reference to a task
bool m_superReference = false; // Called with super reference
public:
AstTaskRef(FileLine* fl, AstParseRef* namep, AstNodeExpr* pinsp)
: ASTGEN_SUPER_TaskRef(fl, (AstNode*)namep, pinsp) {
Expand All @@ -4256,6 +4257,8 @@ class AstTaskRef final : public AstNodeFTaskRef {
dtypeSetVoid();
}
ASTGEN_MEMBERS_AstTaskRef;
bool superReference() const { return m_superReference; }
void superReference(bool flag) { m_superReference = flag; }
};

// === AstNodePreSel ===
Expand Down
10 changes: 9 additions & 1 deletion src/V3LinkDot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3081,7 +3081,15 @@ class LinkDotResolveVisitor final : public VNVisitor {
m_ds.init(m_curSymp);
iterateChildren(nodep);
}
if (m_ds.m_super) nodep->superReference(true);

if (m_ds.m_super) {
if (AstFuncRef* const funcRefp = VN_CAST(nodep, FuncRef)) {
funcRefp->superReference(true);
} else if (AstTaskRef* const taskRefp = VN_CAST(nodep, TaskRef)) {
taskRefp->superReference(true);
}
}

bool staticAccess = false;
if (m_ds.m_unresolvedClass) {
// Unable to link before V3Param
Expand Down
7 changes: 6 additions & 1 deletion src/V3Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,12 @@ class TaskVisitor final : public VNVisitor {
ccallp->dtypeSetVoid();
beginp->addNext(ccallp->makeStmt());
}
ccallp->superReference(refp->superReference());

if (const AstFuncRef* const funcRefp = VN_CAST(refp, FuncRef)) {
ccallp->superReference(funcRefp->superReference());
} else if (const AstTaskRef* const taskRefp = VN_CAST(refp, TaskRef)) {
ccallp->superReference(taskRefp->superReference());
}

// Convert complicated outputs to temp signals
{
Expand Down

0 comments on commit b68e5ee

Please sign in to comment.