LLVM  14.0.0git
HotColdSplitting.h
Go to the documentation of this file.
1 //===- HotColdSplitting.h ---- Outline Cold Regions -------------*- 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 // This pass outlines cold regions to a separate function.
9 //
10 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_TRANSFORMS_IPO_HOTCOLDSPLITTING_H
13 #define LLVM_TRANSFORMS_IPO_HOTCOLDSPLITTING_H
14 
15 #include "llvm/IR/PassManager.h"
16 
17 namespace llvm {
18 
19 class Module;
20 class ProfileSummaryInfo;
21 class BlockFrequencyInfo;
22 class TargetTransformInfo;
23 class OptimizationRemarkEmitter;
24 class AssumptionCache;
25 class DominatorTree;
26 class CodeExtractorAnalysisCache;
27 
28 /// A sequence of basic blocks.
29 ///
30 /// A 0-sized SmallVector is slightly cheaper to move than a std::vector.
32 
34 public:
40  : PSI(ProfSI), GetBFI(GBFI), GetTTI(GTTI), GetORE(GORE), LookupAC(LAC) {}
41  bool run(Module &M);
42 
43 private:
44  bool isFunctionCold(const Function &F) const;
45  bool shouldOutlineFrom(const Function &F) const;
46  bool outlineColdRegions(Function &F, bool HasProfileSummary);
47  Function *extractColdRegion(const BlockSequence &Region,
48  const CodeExtractorAnalysisCache &CEAC,
52  AssumptionCache *AC, unsigned Count);
53  ProfileSummaryInfo *PSI;
57  function_ref<AssumptionCache *(Function &)> LookupAC;
58 };
59 
60 /// Pass to outline cold regions.
61 class HotColdSplittingPass : public PassInfoMixin<HotColdSplittingPass> {
62 public:
64 };
65 
66 } // end namespace llvm
67 
68 #endif // LLVM_TRANSFORMS_IPO_HOTCOLDSPLITTING_H
69 
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::Function
Definition: Function.h:61
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::HotColdSplittingPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: HotColdSplitting.cpp:755
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:168
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:151
llvm::HotColdSplitting
Definition: HotColdSplitting.h:33
llvm::HotColdSplitting::HotColdSplitting
HotColdSplitting(ProfileSummaryInfo *ProfSI, function_ref< BlockFrequencyInfo *(Function &)> GBFI, function_ref< TargetTransformInfo &(Function &)> GTTI, std::function< OptimizationRemarkEmitter &(Function &)> *GORE, function_ref< AssumptionCache *(Function &)> LAC)
Definition: HotColdSplitting.h:35
llvm::HotColdSplitting::run
bool run(Module &M)
Definition: HotColdSplitting.cpp:699
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::HotColdSplittingPass
Pass to outline cold regions.
Definition: HotColdSplitting.h:61
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition: BlockFrequencyInfo.h:37
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition: ProfileSummaryInfo.h:39
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:168
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
llvm::AssumptionCache
A cache of @llvm.assume calls within a function.
Definition: AssumptionCache.h:41
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:421
PassManager.h
llvm::CodeExtractorAnalysisCache
A cache for the CodeExtractor analysis.
Definition: CodeExtractor.h:46
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::Region
Definition: RegionInfo.h:889