mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 18:58:51 +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:
+7
-1
@@ -582,8 +582,14 @@ static void process() {
|
||||
// Must be after all Sel/array index based optimizations
|
||||
V3Reloop::reloopAll(v3Global.rootp());
|
||||
}
|
||||
}
|
||||
|
||||
if (v3Global.opt.inlineCFuncs()) {
|
||||
// These are no longer needed, remove references before CFunc inlining
|
||||
v3Global.rootp()->evalp(nullptr);
|
||||
v3Global.rootp()->evalNbap(nullptr);
|
||||
|
||||
if (!v3Global.opt.lintOnly() && !v3Global.opt.serializeOnly()) {
|
||||
if (v3Global.opt.fInlineCFuncs()) {
|
||||
// Inline small CFuncs to reduce function call overhead
|
||||
V3InlineCFuncs::inlineAll(v3Global.rootp());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user