Internals: Remove AstSysFuncAsTask
This commit is contained in:
parent
b12b1c9658
commit
6a225d5d00
|
|
@ -3522,24 +3522,6 @@ public:
|
|||
string emitVerilog() const { return m_isFatal ? "$fatal" : "$stop"; }
|
||||
bool isFatal() const { return m_isFatal; }
|
||||
};
|
||||
class AstSysFuncAsTask final : public AstNodeStmt {
|
||||
// TODO: This is superseded by AstStmtExpr, remove
|
||||
// Call what is normally a system function (with a return) in a non-return context
|
||||
// @astgen op1 := lhsp : AstNodeExpr
|
||||
public:
|
||||
AstSysFuncAsTask(FileLine* fl, AstNodeExpr* lhsp)
|
||||
: ASTGEN_SUPER_SysFuncAsTask(fl) {
|
||||
this->lhsp(lhsp);
|
||||
}
|
||||
ASTGEN_MEMBERS_AstSysFuncAsTask;
|
||||
string verilogKwd() const override { return ""; }
|
||||
bool isGateOptimizable() const override { return true; }
|
||||
bool isPredictOptimizable() const override { return true; }
|
||||
bool isPure() override { return true; }
|
||||
bool isOutputter() override { return false; }
|
||||
int instrCount() const override { return 0; }
|
||||
bool sameNode(const AstNode* /*samep*/) const override { return true; }
|
||||
};
|
||||
class AstSystemT final : public AstNodeStmt {
|
||||
// $system used as task
|
||||
// @astgen op1 := lhsp : AstNodeExpr
|
||||
|
|
|
|||
|
|
@ -1044,11 +1044,6 @@ public:
|
|||
}
|
||||
puts(")");
|
||||
}
|
||||
void visit(AstSysFuncAsTask* nodep) override {
|
||||
if (!nodep->lhsp()->isWide()) putns(nodep, "(void)");
|
||||
iterateAndNextConstNull(nodep->lhsp());
|
||||
if (!nodep->lhsp()->isWide()) putns(nodep, ";\n");
|
||||
}
|
||||
void visit(AstStackTraceF* nodep) override { putns(nodep, "VL_STACKTRACE_N()"); }
|
||||
void visit(AstStackTraceT* nodep) override { putns(nodep, "VL_STACKTRACE();\n"); }
|
||||
void visit(AstSystemT* nodep) override {
|
||||
|
|
@ -1076,7 +1071,11 @@ public:
|
|||
puts(")");
|
||||
}
|
||||
void visit(AstStmtExpr* nodep) override {
|
||||
putns(nodep, "");
|
||||
if (VN_IS(nodep->exprp()->dtypep()->skipRefp(), VoidDType)) {
|
||||
putns(nodep, "");
|
||||
} else {
|
||||
putns(nodep, "(void)"); // Prevent unused expression warning in C
|
||||
}
|
||||
iterateConst(nodep->exprp());
|
||||
puts(";\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,10 +344,6 @@ class EmitVBaseVisitorConst VL_NOT_FINAL : public VNVisitorConst {
|
|||
}
|
||||
puts(");\n");
|
||||
}
|
||||
void visit(AstSysFuncAsTask* nodep) override {
|
||||
iterateAndNextConstNull(nodep->lhsp());
|
||||
puts(";\n");
|
||||
}
|
||||
void visit(AstSysIgnore* nodep) override {
|
||||
putfs(nodep, nodep->verilogKwd());
|
||||
putbs("(");
|
||||
|
|
|
|||
|
|
@ -1432,6 +1432,11 @@ class WidthVisitor final : public VNVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
void visit(AstStmtExpr* nodep) override {
|
||||
assertAtStatement(nodep);
|
||||
userIterateAndNext(nodep->exprp(), WidthVP{SELF, BOTH}.p());
|
||||
}
|
||||
|
||||
void visit(AstImplication* nodep) override {
|
||||
if (m_vup->prelim()) {
|
||||
iterateCheckBool(nodep, "LHS", nodep->lhsp(), BOTH);
|
||||
|
|
@ -4193,16 +4198,12 @@ class WidthVisitor final : public VNVisitor {
|
|||
nodep->dtypeFrom(ftaskp);
|
||||
nodep->classOrPackagep(classp);
|
||||
if (VN_IS(ftaskp, Task)) {
|
||||
if (!m_vup) {
|
||||
nodep->dtypeSetVoid();
|
||||
} else {
|
||||
if (m_vup->prelim()) {
|
||||
nodep->v3error(
|
||||
"Cannot call a task/void-function as a member function: "
|
||||
<< nodep->prettyNameQ());
|
||||
}
|
||||
nodep->dtypeSetVoid();
|
||||
if (m_vup && m_vup->prelim() && !VN_IS(nodep->backp(), StmtExpr)) {
|
||||
nodep->v3error(
|
||||
"Cannot call a task/void-function as a member function: "
|
||||
<< nodep->prettyNameQ());
|
||||
}
|
||||
nodep->dtypeSetVoid();
|
||||
}
|
||||
if (withp) nodep->addPinsp(withp);
|
||||
processFTaskRefArgs(nodep);
|
||||
|
|
@ -5766,10 +5767,6 @@ class WidthVisitor final : public VNVisitor {
|
|||
nodep->dtypeSetSigned32(); // Spec says integer return
|
||||
}
|
||||
}
|
||||
void visit(AstSysFuncAsTask* nodep) override {
|
||||
assertAtStatement(nodep);
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, BOTH}.p());
|
||||
}
|
||||
void visit(AstSystemT* nodep) override {
|
||||
assertAtStatement(nodep);
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, BOTH}.p());
|
||||
|
|
@ -6143,7 +6140,7 @@ class WidthVisitor final : public VNVisitor {
|
|||
visit(static_cast<AstNodeFTaskRef*>(nodep));
|
||||
if (nodep->taskp() && VN_IS(nodep->taskp(), Task)) {
|
||||
UASSERT_OBJ(m_vup, nodep, "Function reference where widthed expression expection");
|
||||
if (m_vup->prelim())
|
||||
if (m_vup->prelim() && !VN_IS(nodep->backp(), StmtExpr))
|
||||
nodep->v3error(
|
||||
"Cannot call a task/void-function as a function: " << nodep->prettyNameQ());
|
||||
nodep->dtypeSetVoid();
|
||||
|
|
|
|||
|
|
@ -4430,7 +4430,7 @@ system_t_call<nodeStmtp>: // IEEE: system_tf_call (as task)
|
|||
nullptr, nullptr}; }
|
||||
//
|
||||
// Any system function as a task
|
||||
| system_f_call_or_t { $$ = new AstSysFuncAsTask{$<fl>1, $1}; }
|
||||
| system_f_call_or_t { $$ = new AstStmtExpr{$<fl>1, $1}; }
|
||||
;
|
||||
|
||||
system_f_call<nodeExprp>: // IEEE: system_tf_call (as func)
|
||||
|
|
|
|||
|
|
@ -1028,8 +1028,8 @@
|
|||
"childDTypep": [
|
||||
{"type":"BASICDTYPE","name":"string","addr":"(KQ)","loc":"d,231:35,231:41","dtypep":"(KQ)","keyword":"string","generic":false,"rangep": []}
|
||||
],"delayp": [],"valuep": [],"attrsp": []},
|
||||
{"type":"SYSFUNCASTASK","name":"","addr":"(LQ)","loc":"d,232:10,232:18",
|
||||
"lhsp": [
|
||||
{"type":"STMTEXPR","name":"","addr":"(LQ)","loc":"d,232:10,232:18",
|
||||
"exprp": [
|
||||
{"type":"RAND","name":"","addr":"(MQ)","loc":"d,232:10,232:18","dtypep":"UNLINKED",
|
||||
"seedp": [
|
||||
{"type":"DOT","name":"","addr":"(NQ)","loc":"d,232:20,232:21","dtypep":"UNLINKED","colon":false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue