LLVM: llvm::StaticDataProfileInfo Class Reference (original) (raw)

A class that holds the constants that represent static data and their profile information and provides methods to operate on them. More...

#include "[llvm/Analysis/StaticDataProfileInfo.h](StaticDataProfileInfo%5F8h%5Fsource.html)"

Public Types
enum class StaticDataHotness : int8_t { Cold = -1 , LukewarmOrUnknown = 0 , Hot = 1 }
Use signed enums for enum value comparison, and make 'LukewarmOrUnknown' as 0 so any accidentally uninitialized value will default to unknown. More...
Public Member Functions
LLVM_ABI std::optional< uint64_t > getConstantProfileCount (const Constant *C) const
If C has a count, return it. Otherwise, return std::nullopt.
LLVM_ABI StaticDataHotness getConstantHotnessUsingProfileCount (const Constant *C, const ProfileSummaryInfo *PSI, uint64_t Count) const
Return the hotness of the constant C based on its profile count Count.
LLVM_ABI StaticDataHotness getSectionHotnessUsingDataAccessProfile (std::optional< StringRef > SectionPrefix) const
Return the hotness based on section prefix SectionPrefix.
LLVM_ABI StringRef hotnessToStr (StaticDataHotness Hotness) const
Return the string representation of the hotness enum Hotness.
StaticDataProfileInfo (bool EnableDataAccessProf)
LLVM_ABI void addConstantProfileCount (const Constant *C, std::optional< uint64_t > Count)
If Count is not nullopt, add it to the profile count of the constant C in a saturating way, and clamp the count to getInstrMaxCountValue if the result exceeds it.
LLVM_ABI StringRef getConstantSectionPrefix (const Constant *C, const ProfileSummaryInfo *PSI) const
Given a constant C, returns a section prefix.
Public Attributes
DenseMap< const Constant *, uint64_t > ConstantProfileCounts
A constant is tracked only if the following conditions are met.
DenseSet< const Constant * > ConstantWithoutCounts
Keeps track of the constants that are seen at least once without profile counts.
bool EnableDataAccessProf = false

A class that holds the constants that represent static data and their profile information and provides methods to operate on them.

Definition at line 33 of file StaticDataProfileInfo.h.

StaticDataHotness

Use signed enums for enum value comparison, and make 'LukewarmOrUnknown' as 0 so any accidentally uninitialized value will default to unknown.

Enumerator
Cold
LukewarmOrUnknown
Hot

Definition at line 52 of file StaticDataProfileInfo.h.

llvm::StaticDataProfileInfo::StaticDataProfileInfo ( bool EnableDataAccessProf) inline

addConstantProfileCount()

void StaticDataProfileInfo::addConstantProfileCount ( const Constant * C,
std::optional< uint64_t > Count )

getConstantHotnessUsingProfileCount()

getConstantProfileCount()

getConstantSectionPrefix()

Given a constant C, returns a section prefix.

If C is a global variable, the section prefix is the bigger one between its existing section prefix and its use profile count. Otherwise, the section prefix is based on its use profile count.

Definition at line 116 of file StaticDataProfileInfo.cpp.

References llvm::CallingConv::C, Cold, llvm::Count, llvm::dbgs(), llvm::dyn_cast(), EnableDataAccessProf, getConstantHotnessUsingProfileCount(), getConstantProfileCount(), getSectionHotnessUsingDataAccessProfile(), Hot, hotnessToStr(), llvm::memprof::IsAnnotationOK(), LLVM_DEBUG, and LukewarmOrUnknown.

getSectionHotnessUsingDataAccessProfile()

StaticDataProfileInfo::StaticDataHotness StaticDataProfileInfo::getSectionHotnessUsingDataAccessProfile ( std::optional< StringRef > SectionPrefix ) const

hotnessToStr()

StringRef StaticDataProfileInfo::hotnessToStr ( StaticDataHotness Hotness ) const

ConstantProfileCounts

ConstantWithoutCounts

EnableDataAccessProf

bool llvm::StaticDataProfileInfo::EnableDataAccessProf = false


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