1 //===- bolt/Passes/ADRRelaxationPass.h --------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file declares the FixRelaxations class, which locates instructions with 10 // wrong targets and fixes them. Such problems usually occurs when linker 11 // relaxes (changes) instructions, but doesn't fix relocations types properly 12 // for them. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #ifndef BOLT_PASSES_FIXRELAXATIONPASS_H 17 #define BOLT_PASSES_FIXRELAXATIONPASS_H 18 19 #include "bolt/Passes/BinaryPasses.h" 20 21 namespace llvm { 22 namespace bolt { 23 24 class FixRelaxations : public BinaryFunctionPass { 25 void runOnFunction(BinaryFunction &Function); 26 27 public: FixRelaxations(const cl::opt<bool> & PrintPass)28 explicit FixRelaxations(const cl::opt<bool> &PrintPass) 29 : BinaryFunctionPass(PrintPass) {} 30 getName()31 const char *getName() const override { return "fix-relaxations"; } 32 33 /// Pass entry point 34 Error runOnFunctions(BinaryContext &BC) override; 35 }; 36 37 } // namespace bolt 38 } // namespace llvm 39 40 #endif 41