Optimize generated function inlining (#7811)

Previously V3InlineCFuncs inlined call sites but never deleted the now
dead callees. Also missed a lot of opportunities due to evaluation order.

Rewrite using a graph based algorithm, using only a single traversal of
the netlist. This is clearer, more accurate, and faster at compile time.

Also add a clean -fno-inline-cfuncs disable. Setting the limits to 0
still disables inlining, except of empty functions, which can be inlined
with 0 limits (they are no ops). It will also prune unused functions
without -fno-inline-cfuncs.

Pass now also respects `--output-split`
This commit is contained in:
Geza Lore
2026-06-21 18:31:56 +01:00
committed by GitHub
parent 5fc03ae913
commit bcaa110f60
28 changed files with 612 additions and 232 deletions
+1
View File
@@ -1094,6 +1094,7 @@ class TraceVisitor final : public VNVisitor {
// Create the trace registration function
m_regFuncp = new AstCFunc{m_topScopep->fileline(), "trace_register", m_topScopep};
m_regFuncp->argTypes(v3Global.opt.traceClassBase() + "* tracep");
m_regFuncp->entryPoint(true);
m_regFuncp->isTrace(true);
m_regFuncp->slow(true);
m_regFuncp->isStatic(false);