[BOLT][AArch64] Enable function print after ADRRelaxation (#119869)

Introduce `--print-adr-relaxation` to print after ADR Relaxation pass.
This commit is contained in:
Paschalis Mpeis
2024-12-16 12:06:56 +00:00
committed by GitHub
parent d280a9c5e2
commit 2df48fa78b
2 changed files with 9 additions and 2 deletions

View File

@@ -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"; }

View File

@@ -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