LLVM 17.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
16namespace 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.
27class ModuleInlinerPass : public PassInfoMixin<ModuleInlinerPass> {
28public:
32 : Params(Params), Mode(Mode), LTOPhase(LTOPhase){};
34
36
37private:
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
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
This header defines various interfaces for pass management in LLVM.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
Interface for deciding whether to inline a call site or not.
The module inliner pass for the new pass manager.
Definition: ModuleInliner.h:27
ModuleInlinerPass(InlineParams Params=getInlineParams(), InliningAdvisorMode Mode=InliningAdvisorMode::Default, ThinOrFullLTOPhase LTOPhase=ThinOrFullLTOPhase::None)
Definition: ModuleInliner.h:29
PreservedAnalyses run(Module &, ModuleAnalysisManager &)
ModuleInlinerPass(ModuleInlinerPass &&Arg)=default
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
InliningAdvisorMode
There are 4 scenarios we can use the InlineAdvisor:
Definition: InlineAdvisor.h:44
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition: Pass.h:73
@ None
No LTO/ThinLTO behavior needed.
InlineParams getInlineParams()
Generate the parameters to tune the inline cost analysis based only on the commandline options.
Thresholds to tune inline cost analysis.
Definition: InlineCost.h:205
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371