LLVM  5.0.0
Public Member Functions | List of all members
llvm::ProfileSummaryInfo Class Reference

Analysis providing profile information. More...

#include "llvm/Analysis/ProfileSummaryInfo.h"

Public Member Functions

 ProfileSummaryInfo (Module &M)
 
 ProfileSummaryInfo (ProfileSummaryInfo &&Arg)
 
bool hasProfileSummary ()
 Returns true if profile summary is available. More...
 
bool hasSampleProfile ()
 Returns true if module M has sample profile. More...
 
bool hasInstrumentationProfile ()
 Returns true if module M has instrumentation profile. More...
 
bool invalidate (Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &)
 Handle the invalidation of this information. More...
 
Optional< uint64_t > getProfileCount (const Instruction *CallInst, BlockFrequencyInfo *BFI)
 Returns the profile count for CallInst. More...
 
bool isFunctionEntryHot (const Function *F)
 Returns true if F has hot function entry. More...
 
bool isFunctionHotInCallGraph (const Function *F)
 Returns true if F has hot function entry or hot call edge. More...
 
bool isFunctionEntryCold (const Function *F)
 Returns true if F has cold function entry. More...
 
bool isFunctionColdInCallGraph (const Function *F)
 Returns true if F has cold function entry or cold call edge. More...
 
bool isHotCount (uint64_t C)
 Returns true if F is a hot function. More...
 
bool isColdCount (uint64_t C)
 Returns true if count C is considered cold. More...
 
bool isHotBB (const BasicBlock *B, BlockFrequencyInfo *BFI)
 Returns true if BasicBlock B is considered hot. More...
 
bool isColdBB (const BasicBlock *B, BlockFrequencyInfo *BFI)
 Returns true if BasicBlock B is considered cold. More...
 
bool isHotCallSite (const CallSite &CS, BlockFrequencyInfo *BFI)
 Returns true if CallSite CS is considered hot. More...
 
bool isColdCallSite (const CallSite &CS, BlockFrequencyInfo *BFI)
 Returns true if Callsite CS is considered cold. More...
 

Detailed Description

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.

Definition at line 44 of file ProfileSummaryInfo.h.

Constructor & Destructor Documentation

llvm::ProfileSummaryInfo::ProfileSummaryInfo ( Module &  M)
inline

Definition at line 54 of file ProfileSummaryInfo.h.

llvm::ProfileSummaryInfo::ProfileSummaryInfo ( ProfileSummaryInfo &&  Arg)
inline

Definition at line 55 of file ProfileSummaryInfo.h.

Member Function Documentation

Optional< uint64_t > ProfileSummaryInfo::getProfileCount ( const Instruction *  CallInst,
BlockFrequencyInfo *  BFI 
)
bool llvm::ProfileSummaryInfo::hasInstrumentationProfile ( )
inline

Returns true if module M has instrumentation profile.

Definition at line 68 of file ProfileSummaryInfo.h.

References hasProfileSummary(), and llvm::ProfileSummary::PSK_Instr.

bool llvm::ProfileSummaryInfo::hasProfileSummary ( )
inline

Returns true if profile summary is available.

Definition at line 59 of file ProfileSummaryInfo.h.

Referenced by hasInstrumentationProfile(), and hasSampleProfile().

bool llvm::ProfileSummaryInfo::hasSampleProfile ( )
inline

Returns true if module M has sample profile.

Definition at line 62 of file ProfileSummaryInfo.h.

References hasProfileSummary(), and llvm::ProfileSummary::PSK_Sample.

Referenced by getProfileCount().

bool llvm::ProfileSummaryInfo::invalidate ( Module &  ,
const PreservedAnalyses &  ,
ModuleAnalysisManager::Invalidator &   
)
inline

Handle the invalidation of this information.

When used as a result of 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.

Definition at line 79 of file ProfileSummaryInfo.h.

bool ProfileSummaryInfo::isColdBB ( const BasicBlock *  B,
BlockFrequencyInfo *  BFI 
)

Returns true if BasicBlock B is considered cold.

Definition at line 187 of file ProfileSummaryInfo.cpp.

References llvm::BlockFrequencyInfo::getBlockProfileCount(), and isColdCount().

bool ProfileSummaryInfo::isColdCallSite ( const CallSite &  CS,
BlockFrequencyInfo *  BFI 
)
bool ProfileSummaryInfo::isColdCount ( uint64_t  C)

Returns true if count C is considered cold.

Definition at line 176 of file ProfileSummaryInfo.cpp.

References llvm::Optional< T >::getValue().

Referenced by getHotness(), isColdBB(), isColdCallSite(), isFunctionColdInCallGraph(), and isFunctionEntryCold().

bool ProfileSummaryInfo::isFunctionColdInCallGraph ( const Function *  F)

Returns true if F has cold function entry or cold call edge.

Returns true if the function's entry and total call edge count is cold.

If it returns false, it either means it is not cold or it is unknown whether it is cold or not (for example, no profile data is available).

Definition at line 126 of file ProfileSummaryInfo.cpp.

References llvm::Function::getEntryCount(), getProfileCount(), I, and isColdCount().

bool ProfileSummaryInfo::isFunctionEntryCold ( const Function *  F)

Returns true if F has cold function entry.

Returns true if the function's entry is a cold.

If it returns false, it either means it is not cold or it is unknown whether it is cold or not (for example, no profile data is available).

Definition at line 145 of file ProfileSummaryInfo.cpp.

References llvm::CallingConv::Cold, llvm::Function::getEntryCount(), llvm::Function::hasFnAttribute(), and isColdCount().

Referenced by llvm::ProfileSummaryPrinterPass::run().

bool ProfileSummaryInfo::isFunctionEntryHot ( const Function *  F)

Returns true if F has hot function entry.

Returns true if the function's entry is hot.

If it returns false, it either means it is not hot or it is unknown whether it is hot or not (for example, no profile data is available).

Definition at line 94 of file ProfileSummaryInfo.cpp.

References llvm::Function::getEntryCount(), and isHotCount().

Referenced by llvm::ProfileSummaryPrinterPass::run().

bool ProfileSummaryInfo::isFunctionHotInCallGraph ( const Function *  F)

Returns true if F has hot function entry or hot call edge.

Returns true if the function's entry or total call edge count is hot.

If it returns false, it either means it is not hot or it is unknown whether it is hot or not (for example, no profile data is available).

Definition at line 107 of file ProfileSummaryInfo.cpp.

References llvm::Function::getEntryCount(), getProfileCount(), I, and isHotCount().

bool ProfileSummaryInfo::isHotBB ( const BasicBlock *  B,
BlockFrequencyInfo *  BFI 
)

Returns true if BasicBlock B is considered hot.

Definition at line 182 of file ProfileSummaryInfo.cpp.

References llvm::BlockFrequencyInfo::getBlockProfileCount(), and isHotCount().

bool ProfileSummaryInfo::isHotCallSite ( const CallSite &  CS,
BlockFrequencyInfo *  BFI 
)
bool ProfileSummaryInfo::isHotCount ( uint64_t  C)

Returns true if F is a hot function.

Definition at line 170 of file ProfileSummaryInfo.cpp.

References llvm::Optional< T >::getValue().

Referenced by getHotness(), isFunctionEntryHot(), isFunctionHotInCallGraph(), isHotBB(), and isHotCallSite().


The documentation for this class was generated from the following files: