mirror of
https://github.com/verilator/verilator.git
synced 2026-09-06 08:57:23 +02:00
Optimize constify within Expand and Subst (#6111)
These passes blow up the Ast size on some designs, so delaying running V3Const until after the whole pass can notably increase peak memory usage. In this patch we apply V3Const per CFunc within these passes, which saves on memory. Added -fno-const-eager to disable the intra-pass V3Const application, for debugging.
This commit is contained in:
@@ -357,6 +357,16 @@ class ExpandVisitor final : public VNVisitor {
|
||||
}
|
||||
|
||||
// VISITORS
|
||||
void visit(AstCFunc* nodep) override {
|
||||
iterateChildren(nodep);
|
||||
|
||||
// Constant fold here, as Ast size can likely be reduced
|
||||
if (v3Global.opt.fConstEager()) {
|
||||
AstNode* const editedp = V3Const::constifyEditCpp(nodep);
|
||||
UASSERT_OBJ(editedp == nodep, editedp, "Should not have replaced CFunc");
|
||||
}
|
||||
}
|
||||
|
||||
void visit(AstExtend* nodep) override {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
iterateChildren(nodep);
|
||||
|
||||
Reference in New Issue
Block a user