[llvm] [BOLT][AArch64][NFC] Enable function print after ADRRelaxation (PR #119869)
Paschalis Mpeis via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 04:17:19 PST 2024
https://github.com/paschalis-mpeis created https://github.com/llvm/llvm-project/pull/119869
Introduce `--print-adr-relaxation` to print after ADR Relaxation pass.
>From 9207813d1c50e6daa4570d1e2c8be2294b39a311 Mon Sep 17 00:00:00 2001
From: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: Fri, 13 Dec 2024 11:53:37 +0000
Subject: [PATCH] [BOLT][AArch64][NFC] Enable function print after
ADRRelaxation
Introduce `--print-adr-relaxation` to print after ADR Relaxation pass.
---
bolt/include/bolt/Passes/ADRRelaxationPass.h | 3 ++-
bolt/lib/Rewrite/BinaryPassManager.cpp | 8 +++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/bolt/include/bolt/Passes/ADRRelaxationPass.h b/bolt/include/bolt/Passes/ADRRelaxationPass.h
index 1d35a335c0250c..b9f92dec7f03b6 100644
--- a/bolt/include/bolt/Passes/ADRRelaxationPass.h
+++ b/bolt/include/bolt/Passes/ADRRelaxationPass.h
@@ -25,7 +25,8 @@ namespace bolt {
class ADRRelaxationPass : public BinaryFunctionPass {
public:
- explicit ADRRelaxationPass() : BinaryFunctionPass(false) {}
+ explicit ADRRelaxationPass(const cl::opt<bool> &PrintPass)
+ : BinaryFunctionPass(PrintPass) {}
const char *getName() const override { return "adr-relaxation"; }
diff --git a/bolt/lib/Rewrite/BinaryPassManager.cpp b/bolt/lib/Rewrite/BinaryPassManager.cpp
index b0906041833484..6f074d5d1191fa 100644
--- a/bolt/lib/Rewrite/BinaryPassManager.cpp
+++ b/bolt/lib/Rewrite/BinaryPassManager.cpp
@@ -126,6 +126,11 @@ static cl::opt<bool> PrintJTFootprintReduction(
cl::desc("print function after jt-footprint-reduction pass"), cl::Hidden,
cl::cat(BoltOptCategory));
+static cl::opt<bool>
+ PrintAdrRelaxation("print-adr-relaxation",
+ cl::desc("print functions after ADR Relaxation pass"),
+ cl::Hidden, cl::cat(BoltOptCategory));
+
static cl::opt<bool>
PrintLongJmp("print-longjmp",
cl::desc("print functions after longjmp pass"), cl::Hidden,
@@ -493,7 +498,8 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
Manager.registerPass(std::make_unique<ReorderData>());
if (BC.isAArch64()) {
- Manager.registerPass(std::make_unique<ADRRelaxationPass>());
+ Manager.registerPass(
+ std::make_unique<ADRRelaxationPass>(PrintAdrRelaxation));
// Tighten branches according to offset differences between branch and
// targets. No extra instructions after this pass, otherwise we may have
More information about the llvm-commits
mailing list