xref: /llvm-project/bolt/include/bolt/Passes/PLTCall.h (revision a5f3d1a803020167bd9d494a8a3921e7dcc1550a)
1 //===- bolt/Passes/PLTCall.h - PLT call optimization ------------*- 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 #ifndef BOLT_PASSES_PLTCALL_H
10 #define BOLT_PASSES_PLTCALL_H
11 
12 #include "bolt/Passes/BinaryPasses.h"
13 
14 namespace llvm {
15 namespace bolt {
16 
17 class PLTCall : public BinaryFunctionPass {
18 public:
19   /// PLT optimization type
20   enum OptType : char {
21     OT_NONE = 0, /// Do not optimize
22     OT_HOT = 1,  /// Optimize hot PLT calls
23     OT_ALL = 2   /// Optimize all PLT calls
24   };
25 
PLTCall(const cl::opt<bool> & PrintPass)26   explicit PLTCall(const cl::opt<bool> &PrintPass)
27       : BinaryFunctionPass(PrintPass) {}
28 
getName()29   const char *getName() const override { return "PLT call optimization"; }
shouldPrint(const BinaryFunction & BF)30   bool shouldPrint(const BinaryFunction &BF) const override {
31     return BinaryFunctionPass::shouldPrint(BF);
32   }
33   Error runOnFunctions(BinaryContext &BC) override;
34 };
35 
36 } // namespace bolt
37 } // namespace llvm
38 
39 #endif
40