Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:40

0001 //===- ModuleInliner.h - Module level Inliner pass --------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_TRANSFORMS_IPO_MODULEINLINER_H
0010 #define LLVM_TRANSFORMS_IPO_MODULEINLINER_H
0011 
0012 #include "llvm/Analysis/InlineAdvisor.h"
0013 #include "llvm/Analysis/InlineCost.h"
0014 #include "llvm/IR/PassManager.h"
0015 
0016 namespace llvm {
0017 
0018 /// The module inliner pass for the new pass manager.
0019 ///
0020 /// This pass wires together the inlining utilities and the inline cost
0021 /// analysis into a module pass. Different from SCC inliner, it considers every
0022 /// call in every function in the whole module and tries to inline if
0023 /// profitable. With this module level inliner, it is possible to evaluate more
0024 /// heuristics in the module level such like PriorityInlineOrder. It can be
0025 /// tuned with a number of parameters to control what cost model is used and
0026 /// what tradeoffs are made when making the decision.
0027 class ModuleInlinerPass : public PassInfoMixin<ModuleInlinerPass> {
0028 public:
0029   ModuleInlinerPass(InlineParams Params = getInlineParams(),
0030                     InliningAdvisorMode Mode = InliningAdvisorMode::Default,
0031                     ThinOrFullLTOPhase LTOPhase = ThinOrFullLTOPhase::None)
0032       : Params(Params), Mode(Mode), LTOPhase(LTOPhase){};
0033   ModuleInlinerPass(ModuleInlinerPass &&Arg) = default;
0034 
0035   PreservedAnalyses run(Module &, ModuleAnalysisManager &);
0036 
0037 private:
0038   InlineAdvisor &getAdvisor(const ModuleAnalysisManager &MAM,
0039                             FunctionAnalysisManager &FAM, Module &M);
0040   std::unique_ptr<InlineAdvisor> OwnedAdvisor;
0041   const InlineParams Params;
0042   const InliningAdvisorMode Mode;
0043   const ThinOrFullLTOPhase LTOPhase;
0044 };
0045 } // end namespace llvm
0046 
0047 #endif // LLVM_TRANSFORMS_IPO_MODULEINLINER_H