LLVM  15.0.0git
ModuleInliner.h
Go to the documentation of this file.
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 
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:
32  : Params(Params), Mode(Mode), LTOPhase(LTOPhase){};
34 
36 
37 private:
38  InlineAdvisor &getAdvisor(const ModuleAnalysisManager &MAM,
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
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371
FAM
FunctionAnalysisManager FAM
Definition: PassBuilderBindings.cpp:59
llvm::InlineParams
Thresholds to tune inline cost analysis.
Definition: InlineCost.h:190
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:186
llvm::ThinOrFullLTOPhase
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition: Pass.h:73
MAM
ModuleAnalysisManager MAM
Definition: PassBuilderBindings.cpp:61
InlineAdvisor.h
llvm::getInlineParams
InlineParams getInlineParams()
Generate the parameters to tune the inline cost analysis based only on the commandline options.
Definition: InlineCost.cpp:3054
llvm::ModuleInlinerPass
The module inliner pass for the new pass manager.
Definition: ModuleInliner.h:27
llvm::ModuleInlinerPass::run
PreservedAnalyses run(Module &, ModuleAnalysisManager &)
Definition: ModuleInliner.cpp:109
llvm::InliningAdvisorMode
InliningAdvisorMode
There are 3 scenarios we can use the InlineAdvisor:
Definition: InlineAdvisor.h:42
InlineCost.h
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::InlineAdvisor
Interface for deciding whether to inline a call site or not.
Definition: InlineAdvisor.h:163
llvm::ModuleInlinerPass::ModuleInlinerPass
ModuleInlinerPass(InlineParams Params=getInlineParams(), InliningAdvisorMode Mode=InliningAdvisorMode::Default, ThinOrFullLTOPhase LTOPhase=ThinOrFullLTOPhase::None)
Definition: ModuleInliner.h:29
PassManager.h
llvm::ThinOrFullLTOPhase::None
@ None
No LTO/ThinLTO behavior needed.
llvm::InliningAdvisorMode::Default
@ Default
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42