Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===- ModuleInliner.h - Module level Inliner pass --------------*- 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 LLVM_TRANSFORMS_IPO_MODULEINLINER_H |
||
10 | #define LLVM_TRANSFORMS_IPO_MODULEINLINER_H |
||
11 | |||
12 | #include "llvm/Analysis/InlineAdvisor.h" |
||
13 | #include "llvm/Analysis/InlineCost.h" |
||
14 | #include "llvm/IR/PassManager.h" |
||
15 | |||
16 | namespace llvm { |
||
17 | |||
18 | /// The module inliner pass for the new pass manager. |
||
19 | /// |
||
20 | /// This pass wires together the inlining utilities and the inline cost |
||
21 | /// analysis into a module pass. Different from SCC inliner, it considers every |
||
22 | /// call in every function in the whole module and tries to inline if |
||
23 | /// profitable. With this module level inliner, it is possible to evaluate more |
||
24 | /// heuristics in the module level such like PriorityInlineOrder. It can be |
||
25 | /// tuned with a number of parameters to control what cost model is used and |
||
26 | /// what tradeoffs are made when making the decision. |
||
27 | class ModuleInlinerPass : public PassInfoMixin<ModuleInlinerPass> { |
||
28 | public: |
||
29 | ModuleInlinerPass(InlineParams Params = getInlineParams(), |
||
30 | InliningAdvisorMode Mode = InliningAdvisorMode::Default, |
||
31 | ThinOrFullLTOPhase LTOPhase = ThinOrFullLTOPhase::None) |
||
32 | : Params(Params), Mode(Mode), LTOPhase(LTOPhase){}; |
||
33 | ModuleInlinerPass(ModuleInlinerPass &&Arg) = default; |
||
34 | |||
35 | PreservedAnalyses run(Module &, ModuleAnalysisManager &); |
||
36 | |||
37 | private: |
||
38 | InlineAdvisor &getAdvisor(const ModuleAnalysisManager &MAM, |
||
39 | FunctionAnalysisManager &FAM, Module &M); |
||
40 | std::unique_ptr<InlineAdvisor> OwnedAdvisor; |
||
41 | const InlineParams Params; |
||
42 | const InliningAdvisorMode Mode; |
||
43 | const ThinOrFullLTOPhase LTOPhase; |
||
44 | }; |
||
45 | } // end namespace llvm |
||
46 | |||
47 | #endif // LLVM_TRANSFORMS_IPO_MODULEINLINER_H |