mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Avoid repeated traversal for SC text sections in emit when not needed
Repeatedly traversing whole modules in emit (due to file splitting) looking for `systemc_* sections can add up to a lot of time on large designs that have been flattened and need to be split into many files. Assuming `systemc_* is a rarely used feature, just don't bother if we don't need to. This gain 9% verilation speed improvement on a large benchmark.
This commit is contained in:
@@ -235,6 +235,10 @@ void EmitCBaseVisitor::emitModCUse(const AstNodeModule* modp, VUseType useType)
|
||||
}
|
||||
|
||||
void EmitCBaseVisitor::emitTextSection(const AstNodeModule* modp, VNType type) {
|
||||
// Short circuit if nothing to do. This can save a lot of time on large designs as this
|
||||
// function needs to traverse the entire module linearly.
|
||||
if (!v3Global.hasSCTextSections()) return;
|
||||
|
||||
int last_line = -999;
|
||||
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||
if (const AstNodeText* const textp = VN_CAST(nodep, NodeText)) {
|
||||
|
||||
Reference in New Issue
Block a user