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:
+2
-7
@@ -32,7 +32,7 @@ constexpr int VL_VALUE_STRING_MAX_WIDTH = 8192;
|
||||
//######################################################################
|
||||
// EmitCFunc
|
||||
|
||||
bool EmitCFunc::emitSimpleOk(AstNodeMath* nodep) {
|
||||
bool EmitCFunc::emitSimpleOk(AstNodeExpr* nodep) {
|
||||
// Can we put out a simple (A + B) instead of VL_ADD_III(A,B)?
|
||||
if (nodep->emitSimpleOperator() == "") return false;
|
||||
if (nodep->isWide()) return false;
|
||||
@@ -433,12 +433,7 @@ void EmitCFunc::emitCCallArgs(const AstNodeCCall* nodep, const string& selfPoint
|
||||
iterate(subnodep);
|
||||
comma = true;
|
||||
}
|
||||
if (VN_IS(nodep->backp(), NodeMath) || VN_IS(nodep->backp(), CReturn)) {
|
||||
// We should have a separate CCall for math and statement usage, but...
|
||||
puts(")");
|
||||
} else {
|
||||
puts(");\n");
|
||||
}
|
||||
puts(")");
|
||||
}
|
||||
|
||||
void EmitCFunc::emitDereference(const string& pointer) {
|
||||
|
||||
Reference in New Issue
Block a user