LLVM 22.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"
16
17namespace llvm {
18
19/// The module inliner pass for the new pass manager.
20///
21/// This pass wires together the inlining utilities and the inline cost
22/// analysis into a module pass. Different from SCC inliner, it considers every
23/// call in every function in the whole module and tries to inline if
24/// profitable. With this module level inliner, it is possible to evaluate more
25/// heuristics in the module level such like PriorityInlineOrder. It can be
26/// tuned with a number of parameters to control what cost model is used and
27/// what tradeoffs are made when making the decision.
28class ModuleInlinerPass : public PassInfoMixin<ModuleInlinerPass> {
29public:
33 : Params(Params), Mode(Mode), LTOPhase(LTOPhase){};
35
37
38private:
39 InlineAdvisor &getAdvisor(const ModuleAnalysisManager &MAM,
41 std::unique_ptr<InlineAdvisor> OwnedAdvisor;
42 const InlineParams Params;
43 const InliningAdvisorMode Mode;
44 const ThinOrFullLTOPhase LTOPhase;
45};
46} // end namespace llvm
47
48#endif // LLVM_TRANSFORMS_IPO_MODULEINLINER_H
#define LLVM_ABI
Definition: Compiler.h:213
This header defines various interfaces for pass management in LLVM.
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
Interface for deciding whether to inline a call site or not.
The module inliner pass for the new pass manager.
Definition: ModuleInliner.h:28
ModuleInlinerPass(InlineParams Params=getInlineParams(), InliningAdvisorMode Mode=InliningAdvisorMode::Default, ThinOrFullLTOPhase LTOPhase=ThinOrFullLTOPhase::None)
Definition: ModuleInliner.h:30
LLVM_ABI 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:67
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
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:43
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition: Pass.h:77
@ None
No LTO/ThinLTO behavior needed.
LLVM_ABI 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:207
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70