aboutsummaryrefslogtreecommitdiff
path: root/bolt/lib/Rewrite/BinaryPassManager.cpp
diff options
context:
space:
mode:
authorYafetBeyene <127161378+yafet-a@users.noreply.github.com>2025-08-22 10:51:09 +0100
committerGitHub <noreply@github.com>2025-08-22 10:51:09 +0100
commitfda24dbc16abc414bf21b74e77d3acd2ecadfdb9 (patch)
tree28067bb5e085c365577cf2fdd365c554f3483bd5 /bolt/lib/Rewrite/BinaryPassManager.cpp
parent7594b4b8d1bca197282d185e6c309cd71fcce380 (diff)
downloadllvm-fda24dbc16abc414bf21b74e77d3acd2ecadfdb9.zip
llvm-fda24dbc16abc414bf21b74e77d3acd2ecadfdb9.tar.gz
llvm-fda24dbc16abc414bf21b74e77d3acd2ecadfdb9.tar.bz2
[BOLT] Add dump-dot-func option for selective function CFG dumping (#153007)
## Change: * Added `--dump-dot-func` command-line option that allows users to dump CFGs only for specific functions instead of dumping all functions (the current only available option being `--dump-dot-all`) ## Usage: * Users can now specify function names or regex patterns (e.g., `--dump-dot-func=main,helper` or `--dump-dot-func="init.*`") to generate .dot files only for functions of interest * Aims to save time when analysing specific functions in large binaries (e.g., only dumping graphs for performance-critical functions identified through profiling) and we can now avoid reduce output clutter from generating thousands of unnecessary .dot files when analysing large binaries ## Testing The introduced test `dump-dot-func.test` confirms the new option does the following: - [x] 1. `dump-dot-func` can correctly filter a specified functions - [x] 2. Can achieve the above with regexes - [x] 3. Can do 1. with a list of functions - [x] No option specified creates no dot files - [x] Passing in a non-existent function generates no dumping messages - [x] `dump-dot-all` continues to work as expected
Diffstat (limited to 'bolt/lib/Rewrite/BinaryPassManager.cpp')
-rw-r--r--bolt/lib/Rewrite/BinaryPassManager.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/bolt/lib/Rewrite/BinaryPassManager.cpp b/bolt/lib/Rewrite/BinaryPassManager.cpp
index 996d2e9..0ddb73f 100644
--- a/bolt/lib/Rewrite/BinaryPassManager.cpp
+++ b/bolt/lib/Rewrite/BinaryPassManager.cpp
@@ -52,6 +52,7 @@ namespace opts {
extern cl::opt<bool> PrintAll;
extern cl::opt<bool> PrintDynoStats;
extern cl::opt<bool> DumpDotAll;
+extern bool shouldDumpDot(const bolt::BinaryFunction &Function);
extern cl::opt<std::string> AsmDump;
extern cl::opt<bolt::PLTCall::OptType> PLT;
extern cl::opt<bolt::IdenticalCodeFolding::ICFLevel, false,
@@ -340,7 +341,7 @@ Error BinaryFunctionPassManager::runPasses() {
Function.print(BC.outs(), Message);
- if (opts::DumpDotAll)
+ if (opts::shouldDumpDot(Function))
Function.dumpGraphForPass(PassIdName);
}
}