003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/Analysis
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
Analysis
/
📁
..
📄
AliasAnalysis.h
(51.98 KB)
📄
AliasAnalysisEvaluator.h
(2.7 KB)
📄
AliasSetTracker.h
(15.42 KB)
📄
AssumeBundleQueries.h
(6.66 KB)
📄
AssumptionCache.h
(8.39 KB)
📄
BasicAliasAnalysis.h
(10.2 KB)
📄
BlockFrequencyInfo.h
(5.59 KB)
📄
BlockFrequencyInfoImpl.h
(56.46 KB)
📄
BranchProbabilityInfo.h
(10.1 KB)
📄
CFG.h
(7.76 KB)
📄
CFGPrinter.h
(9.31 KB)
📄
CFLAliasAnalysisUtils.h
(1.66 KB)
📄
CFLAndersAliasAnalysis.h
(3.97 KB)
📄
CFLSteensAliasAnalysis.h
(4.58 KB)
📄
CGSCCPassManager.h
(41.2 KB)
📄
CallGraph.h
(18.88 KB)
📄
CallGraphSCCPass.h
(5.01 KB)
📄
CallPrinter.h
(799 B)
📄
CaptureTracking.h
(4.78 KB)
📄
CmpInstAnalysis.h
(2.57 KB)
📄
CodeMetrics.h
(3.15 KB)
📄
ConstantFolding.h
(8.01 KB)
📄
DDG.h
(19.15 KB)
📄
DOTGraphTraitsPass.h
(5.5 KB)
📄
DemandedBits.h
(4.07 KB)
📄
DependenceAnalysis.h
(41.83 KB)
📄
DependenceGraphBuilder.h
(7.74 KB)
📄
DivergenceAnalysis.h
(7.38 KB)
📄
DomPrinter.h
(1.04 KB)
📄
DomTreeUpdater.h
(13.2 KB)
📄
DominanceFrontier.h
(6.63 KB)
📄
DominanceFrontierImpl.h
(7.12 KB)
📄
EHPersonalities.h
(3.22 KB)
📄
GlobalsModRef.h
(5.96 KB)
📄
GuardUtils.h
(2.11 KB)
📄
HeatUtils.h
(1.16 KB)
📄
IVDescriptors.h
(14.56 KB)
📄
IVUsers.h
(6.07 KB)
📄
IndirectCallPromotionAnalysis.h
(2.61 KB)
📄
IndirectCallVisitor.h
(1.16 KB)
📄
InlineAdvisor.h
(8.71 KB)
📄
InlineCost.h
(11.33 KB)
📄
InlineFeaturesAnalysis.h
(1.5 KB)
📄
InlineModelFeatureMaps.h
(3.41 KB)
📄
InlineSizeEstimatorAnalysis.h
(1.07 KB)
📄
InstructionPrecedenceTracking.h
(5.9 KB)
📄
InstructionSimplify.h
(13.36 KB)
📄
Interval.h
(4.84 KB)
📄
IntervalIterator.h
(10.64 KB)
📄
IntervalPartition.h
(4.05 KB)
📄
IteratedDominanceFrontier.h
(2.62 KB)
📄
LazyBlockFrequencyInfo.h
(4.34 KB)
📄
LazyBranchProbabilityInfo.h
(4.21 KB)
📄
LazyCallGraph.h
(50.13 KB)
📄
LazyValueInfo.h
(5.4 KB)
📄
LegacyDivergenceAnalysis.h
(2.53 KB)
📄
Lint.h
(1.35 KB)
📄
Loads.h
(7.86 KB)
📄
LoopAccessAnalysis.h
(29.75 KB)
📄
LoopAnalysisManager.h
(5.83 KB)
📄
LoopCacheAnalysis.h
(11.91 KB)
📄
LoopInfo.h
(48.27 KB)
📄
LoopInfoImpl.h
(27.14 KB)
📄
LoopIterator.h
(8.83 KB)
📄
LoopNestAnalysis.h
(5.61 KB)
📄
LoopPass.h
(4.29 KB)
📄
LoopUnrollAnalyzer.h
(3.42 KB)
📄
MLInlineAdvisor.h
(3.48 KB)
📄
MLModelRunner.h
(1.16 KB)
📄
MemoryBuiltins.h
(13.42 KB)
📄
MemoryDependenceAnalysis.h
(20.82 KB)
📄
MemoryLocation.h
(10.99 KB)
📄
MemorySSA.h
(45.92 KB)
📄
MemorySSAUpdater.h
(14.55 KB)
📄
ModuleSummaryAnalysis.h
(3.44 KB)
📄
MustExecute.h
(20.2 KB)
📄
ObjCARCAliasAnalysis.h
(3.35 KB)
📄
ObjCARCAnalysisUtils.h
(10.22 KB)
📄
ObjCARCInstKind.h
(4.87 KB)
📄
OptimizationRemarkEmitter.h
(5.93 KB)
📄
PHITransAddr.h
(4.77 KB)
📄
Passes.h
(3.88 KB)
📄
PhiValues.h
(5.25 KB)
📄
PostDominators.h
(3.41 KB)
📄
ProfileSummaryInfo.h
(9.3 KB)
📄
PtrUseVisitor.h
(9.96 KB)
📄
RegionInfo.h
(35.23 KB)
📄
RegionInfoImpl.h
(25.16 KB)
📄
RegionIterator.h
(14.07 KB)
📄
RegionPass.h
(4.05 KB)
📄
RegionPrinter.h
(2.25 KB)
📄
ScalarEvolution.h
(89.21 KB)
📄
ScalarEvolutionAliasAnalysis.h
(2.09 KB)
📄
ScalarEvolutionDivision.h
(2.48 KB)
📄
ScalarEvolutionExpressions.h
(28.61 KB)
📄
ScalarEvolutionNormalization.h
(2.47 KB)
📄
ScopedNoAliasAA.h
(2.83 KB)
📄
SparsePropagation.h
(19.43 KB)
📄
StackLifetime.h
(6.16 KB)
📄
StackSafetyAnalysis.h
(4.91 KB)
📄
SyncDependenceAnalysis.h
(2.85 KB)
📄
SyntheticCountsUtils.h
(1.85 KB)
📄
TargetFolder.h
(11.04 KB)
📄
TargetLibraryInfo.def
(55.35 KB)
📄
TargetLibraryInfo.h
(16.86 KB)
📄
TargetTransformInfo.h
(96.51 KB)
📄
TargetTransformInfoImpl.h
(37.63 KB)
📄
Trace.h
(4.1 KB)
📄
TypeBasedAliasAnalysis.h
(3.05 KB)
📄
TypeMetadataUtils.h
(1.94 KB)
📁
Utils
📄
ValueLattice.h
(15.14 KB)
📄
ValueLatticeUtils.h
(1.66 KB)
📄
ValueTracking.h
(35.82 KB)
📄
VecFuncs.def
(10.94 KB)
📄
VectorUtils.h
(37.26 KB)
Editing: ProfileSummaryInfo.h
//===- llvm/Analysis/ProfileSummaryInfo.h - profile summary ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains a pass that provides access to profile summary // information. // //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_PROFILE_SUMMARY_INFO_H #define LLVM_ANALYSIS_PROFILE_SUMMARY_INFO_H #include "llvm/ADT/DenseMap.h" #include "llvm/IR/PassManager.h" #include "llvm/IR/ProfileSummary.h" #include "llvm/Pass.h" #include <memory> namespace llvm { class BasicBlock; class BlockFrequencyInfo; class CallBase; class Function; class ProfileSummary; /// Analysis providing profile information. /// /// This is an immutable analysis pass that provides ability to query global /// (program-level) profile information. The main APIs are isHotCount and /// isColdCount that tells whether a given profile count is considered hot/cold /// based on the profile summary. This also provides convenience methods to /// check whether a function is hot or cold. // FIXME: Provide convenience methods to determine hotness/coldness of other IR // units. This would require making this depend on BFI. class ProfileSummaryInfo { private: Module &M; std::unique_ptr<ProfileSummary> Summary; void computeThresholds(); // Count thresholds to answer isHotCount and isColdCount queries. Optional<uint64_t> HotCountThreshold, ColdCountThreshold; // True if the working set size of the code is considered huge, // because the number of profile counts required to reach the hot // percentile is above a huge threshold. Optional<bool> HasHugeWorkingSetSize; // True if the working set size of the code is considered large, // because the number of profile counts required to reach the hot // percentile is above a large threshold. Optional<bool> HasLargeWorkingSetSize; // Compute the threshold for a given cutoff. Optional<uint64_t> computeThreshold(int PercentileCutoff) const; // The map that caches the threshold values. The keys are the percentile // cutoff values and the values are the corresponding threshold values. mutable DenseMap<int, uint64_t> ThresholdCache; public: ProfileSummaryInfo(Module &M) : M(M) { refresh(); } ProfileSummaryInfo(ProfileSummaryInfo &&Arg) = default; /// If no summary is present, attempt to refresh. void refresh(); /// Returns true if profile summary is available. bool hasProfileSummary() const { return Summary != nullptr; } /// Returns true if module \c M has sample profile. bool hasSampleProfile() const { return hasProfileSummary() && Summary->getKind() == ProfileSummary::PSK_Sample; } /// Returns true if module \c M has instrumentation profile. bool hasInstrumentationProfile() const { return hasProfileSummary() && Summary->getKind() == ProfileSummary::PSK_Instr; } /// Returns true if module \c M has context sensitive instrumentation profile. bool hasCSInstrumentationProfile() const { return hasProfileSummary() && Summary->getKind() == ProfileSummary::PSK_CSInstr; } /// Handle the invalidation of this information. /// /// When used as a result of \c ProfileSummaryAnalysis this method will be /// called when the module this was computed for changes. Since profile /// summary is immutable after it is annotated on the module, we return false /// here. bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &) { return false; } /// Returns the profile count for \p CallInst. Optional<uint64_t> getProfileCount(const CallBase &CallInst, BlockFrequencyInfo *BFI, bool AllowSynthetic = false) const; /// Returns true if module \c M has partial-profile sample profile. bool hasPartialSampleProfile() const; /// Returns true if the working set size of the code is considered huge. bool hasHugeWorkingSetSize() const; /// Returns true if the working set size of the code is considered large. bool hasLargeWorkingSetSize() const; /// Returns true if \p F has hot function entry. bool isFunctionEntryHot(const Function *F) const; /// Returns true if \p F contains hot code. bool isFunctionHotInCallGraph(const Function *F, BlockFrequencyInfo &BFI) const; /// Returns true if \p F has cold function entry. bool isFunctionEntryCold(const Function *F) const; /// Returns true if \p F contains only cold code. bool isFunctionColdInCallGraph(const Function *F, BlockFrequencyInfo &BFI) const; /// Returns true if the hotness of \p F is unknown. bool isFunctionHotnessUnknown(const Function &F) const; /// Returns true if \p F contains hot code with regard to a given hot /// percentile cutoff value. bool isFunctionHotInCallGraphNthPercentile(int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const; /// Returns true if \p F contains cold code with regard to a given cold /// percentile cutoff value. bool isFunctionColdInCallGraphNthPercentile(int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const; /// Returns true if count \p C is considered hot. bool isHotCount(uint64_t C) const; /// Returns true if count \p C is considered cold. bool isColdCount(uint64_t C) const; /// Returns true if count \p C is considered hot with regard to a given /// hot percentile cutoff value. bool isHotCountNthPercentile(int PercentileCutoff, uint64_t C) const; /// Returns true if count \p C is considered cold with regard to a given /// cold percentile cutoff value. bool isColdCountNthPercentile(int PercentileCutoff, uint64_t C) const; /// Returns true if BasicBlock \p BB is considered hot. bool isHotBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const; /// Returns true if BasicBlock \p BB is considered cold. bool isColdBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const; /// Returns true if BasicBlock \p BB is considered hot with regard to a given /// hot percentile cutoff value. bool isHotBlockNthPercentile(int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const; /// Returns true if BasicBlock \p BB is considered cold with regard to a given /// cold percentile cutoff value. bool isColdBlockNthPercentile(int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const; /// Returns true if the call site \p CB is considered hot. bool isHotCallSite(const CallBase &CB, BlockFrequencyInfo *BFI) const; /// Returns true if call site \p CB is considered cold. bool isColdCallSite(const CallBase &CB, BlockFrequencyInfo *BFI) const; /// Returns HotCountThreshold if set. Recompute HotCountThreshold /// if not set. uint64_t getOrCompHotCountThreshold() const; /// Returns ColdCountThreshold if set. Recompute HotCountThreshold /// if not set. uint64_t getOrCompColdCountThreshold() const; /// Returns HotCountThreshold if set. uint64_t getHotCountThreshold() const { return HotCountThreshold ? HotCountThreshold.getValue() : 0; } /// Returns ColdCountThreshold if set. uint64_t getColdCountThreshold() const { return ColdCountThreshold ? ColdCountThreshold.getValue() : 0; } private: template <bool isHot> bool isFunctionHotOrColdInCallGraphNthPercentile( int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const; template <bool isHot> bool isHotOrColdCountNthPercentile(int PercentileCutoff, uint64_t C) const; template <bool isHot> bool isHotOrColdBlockNthPercentile(int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const; }; /// An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo. class ProfileSummaryInfoWrapperPass : public ImmutablePass { std::unique_ptr<ProfileSummaryInfo> PSI; public: static char ID; ProfileSummaryInfoWrapperPass(); ProfileSummaryInfo &getPSI() { return *PSI; } const ProfileSummaryInfo &getPSI() const { return *PSI; } bool doInitialization(Module &M) override; bool doFinalization(Module &M) override; void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); } }; /// An analysis pass based on the new PM to deliver ProfileSummaryInfo. class ProfileSummaryAnalysis : public AnalysisInfoMixin<ProfileSummaryAnalysis> { public: typedef ProfileSummaryInfo Result; Result run(Module &M, ModuleAnalysisManager &); private: friend AnalysisInfoMixin<ProfileSummaryAnalysis>; static AnalysisKey Key; }; /// Printer pass that uses \c ProfileSummaryAnalysis. class ProfileSummaryPrinterPass : public PassInfoMixin<ProfileSummaryPrinterPass> { raw_ostream &OS; public: explicit ProfileSummaryPrinterPass(raw_ostream &OS) : OS(OS) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); }; } // end namespace llvm #endif
Upload File
Create Folder