LLVM  14.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 
16 #include "llvm/IR/PassManager.h"
17 #include <utility>
18 
19 namespace llvm {
20 
21 /// The module inliner pass for the new pass manager.
22 ///
23 /// This pass wires together the inlining utilities and the inline cost
24 /// analysis into a module pass. Different from SCC inliner, it considers every
25 /// call in every function in the whole module and tries to inline if
26 /// profitable. With this module level inliner, it is possible to evaluate more
27 /// heuristics in the module level such like PriorityInlineOrder. It can be
28 /// tuned with a number of parameters to control what cost model is used and
29 /// what tradeoffs are made when making the decision.
30 class ModuleInlinerPass : public PassInfoMixin<ModuleInlinerPass> {
31 public:
34  : Params(Params), Mode(Mode){};
36 
38 
39 private:
40  InlineAdvisor &getAdvisor(const ModuleAnalysisManager &MAM,
42  std::unique_ptr<InlineAdvisor> OwnedAdvisor;
43  const InlineParams Params;
44  const InliningAdvisorMode Mode;
45 };
46 } // end namespace llvm
47 
48 #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:155
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
FAM
FunctionAnalysisManager FAM
Definition: PassBuilderBindings.cpp:59
llvm::InlineParams
Thresholds to tune inline cost analysis.
Definition: InlineCost.h:184
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:185
ImportedFunctionsInliningStatistics.h
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:3063
llvm::ModuleInlinerPass
The module inliner pass for the new pass manager.
Definition: ModuleInliner.h:30
llvm::ModuleInlinerPass::run
PreservedAnalyses run(Module &, ModuleAnalysisManager &)
Definition: ModuleInliner.cpp:117
ReplayInlineAdvisor.h
llvm::InliningAdvisorMode
InliningAdvisorMode
There are 3 scenarios we can use the InlineAdvisor:
Definition: InlineAdvisor.h:41
llvm::ModuleInlinerPass::ModuleInlinerPass
ModuleInlinerPass(InlineParams Params=getInlineParams(), InliningAdvisorMode Mode=InliningAdvisorMode::Default)
Definition: ModuleInliner.h:32
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:140
PassManager.h
llvm::InliningAdvisorMode::Default
@ Default
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44