mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 00:30:34 +02:00
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:
@@ -980,6 +980,7 @@ public:
|
||||
AstCFunc* rootFuncp = nullptr;
|
||||
if (!v3Global.opt.libCreate().empty()) {
|
||||
rootFuncp = newCFunc(flp, "trace_init_root");
|
||||
rootFuncp->entryPoint(true);
|
||||
for (size_t i = 0; i < m_topScopeRootFuncCount; ++i) {
|
||||
AstCCall* const callp = new AstCCall{flp, topScopeFuncps.at(i)};
|
||||
callp->dtypeSetVoid();
|
||||
@@ -1017,6 +1018,7 @@ public:
|
||||
// Set name of top level function
|
||||
AstCFunc* const topFuncp = m_topFuncps.front();
|
||||
topFuncp->name("trace_init_top");
|
||||
topFuncp->entryPoint(true);
|
||||
|
||||
if (rootFuncp && v3Global.opt.debugCheck()) checkCallsRecurse(rootFuncp);
|
||||
checkCalls(topFuncp);
|
||||
|
||||
Reference in New Issue
Block a user