mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 18:13:50 +02:00
Make all expressions derive from AstNodeExpr (#3721).
Apart from the representational changes below, this patch renames AstNodeMath to AstNodeExpr, and AstCMath to AstCExpr. Now every expression (i.e.: those AstNodes that represent a [possibly void] value, with value being interpreted in a very general sense) has AstNodeExpr as a super class. This necessitates the introduction of an AstStmtExpr, which represents an expression in statement position, e.g : 'foo();' would be represented as AstStmtExpr(AstCCall(foo)). In exchange we can get rid of isStatement() in AstNodeStmt, which now really always represent a statement Peak memory consumption and verilation speed are not measurably changed. Partial step towards #3420
This commit is contained in:
+9
-4
@@ -152,15 +152,20 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
AstNode* const returnp = new AstCReturn(
|
||||
funcp->fileline(), new AstCCall(funcp->fileline(), funcp, argsp));
|
||||
AstCCall* const callp = new AstCCall{funcp->fileline(), funcp, argsp};
|
||||
if (AstNodeDType* const dtypep = funcp->dtypep()) {
|
||||
callp->dtypep(dtypep);
|
||||
} else {
|
||||
callp->dtypeSetVoid();
|
||||
}
|
||||
AstNode* const returnp = new AstCReturn{funcp->fileline(), callp};
|
||||
|
||||
if (moreOfSame) {
|
||||
AstIf* const ifp = new AstIf(
|
||||
funcp->fileline(),
|
||||
new AstEq(
|
||||
funcp->fileline(), new AstCMath(funcp->fileline(), "this", 64),
|
||||
new AstCMath(funcp->fileline(),
|
||||
funcp->fileline(), new AstCExpr(funcp->fileline(), "this", 64),
|
||||
new AstCExpr(funcp->fileline(),
|
||||
string("&(") + funcp->scopep()->nameVlSym() + ")",
|
||||
64)),
|
||||
returnp);
|
||||
|
||||
Reference in New Issue
Block a user