clang 18.0.0git
|
Per-function PGO state. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CodeGenPGO.h"
Public Member Functions | |
CodeGenPGO (CodeGenModule &CGModule) | |
bool | haveRegionCounts () const |
Whether or not we have PGO region data for the current function. | |
uint64_t | getCurrentRegionCount () const |
Return the counter value of the current region. | |
void | setCurrentRegionCount (uint64_t Count) |
Set the counter value for the current region. | |
std::optional< uint64_t > | getStmtCount (const Stmt *S) const |
Check if an execution count is known for a given statement. | |
void | setCurrentStmt (const Stmt *S) |
If the execution count for the current statement is known, record that as the current count. | |
void | assignRegionCounters (GlobalDecl GD, llvm::Function *Fn) |
Assign counters to regions and configure them for PGO of a given function. | |
void | emitEmptyCounterMapping (const Decl *D, StringRef FuncName, llvm::GlobalValue::LinkageTypes Linkage) |
Emit a coverage mapping range with a counter zero for an unused declaration. | |
void | valueProfile (CGBuilderTy &Builder, uint32_t ValueKind, llvm::Instruction *ValueSite, llvm::Value *ValuePtr) |
void | setValueProfilingFlag (llvm::Module &M) |
void | emitCounterIncrement (CGBuilderTy &Builder, const Stmt *S, llvm::Value *StepV) |
uint64_t | getRegionCount (const Stmt *S) |
Return the region count for the counter at the given index. | |
Per-function PGO state.
Definition at line 28 of file CodeGenPGO.h.
|
inline |
Definition at line 44 of file CodeGenPGO.h.
void CodeGenPGO::assignRegionCounters | ( | GlobalDecl | GD, |
llvm::Function * | Fn | ||
) |
Assign counters to regions and configure them for PGO of a given function.
Does nothing if instrumentation is not enabled and either generates global variables or associates PGO data with each of the counters depending on whether we are generating or using instrumentation.
Definition at line 795 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::ClearUnusedCoverageMapping(), clang::Ctor_Base, clang::Dtor_Base, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), clang::GlobalDecl::getCtorType(), clang::TargetInfo::getCXXABI(), clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::Decl::getLocation(), clang::CodeGen::CodeGenModule::getPGOReader(), clang::ASTContext::getSourceManager(), clang::CodeGen::CodeGenModule::getTarget(), clang::Decl::hasAttr(), clang::Decl::hasBody(), clang::TargetCXXABI::hasConstructorVariants(), clang::CodeGenOptions::hasProfileClangInstr(), clang::CodeGen::CodeGenFunction::IsConstructorDelegationValid(), clang::Decl::isImplicit(), and SM.
void CodeGenPGO::emitCounterIncrement | ( | CGBuilderTy & | Builder, |
const Stmt * | S, | ||
llvm::Value * | StepV | ||
) |
Definition at line 953 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenModule::getLLVMContext(), and clang::CodeGenOptions::hasProfileClangInstr().
void CodeGenPGO::emitEmptyCounterMapping | ( | const Decl * | D, |
StringRef | FuncName, | ||
llvm::GlobalValue::LinkageTypes | Linkage | ||
) |
Emit a coverage mapping range with a counter zero for an unused declaration.
Definition at line 909 of file CodeGenPGO.cpp.
References clang::CodeGen::CoverageMappingModuleGen::addFunctionMappingRecord(), clang::CodeGen::CoverageMappingGen::emitEmptyMapping(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCoverageMapping(), clang::CodeGen::CodeGenModule::getLangOpts(), and clang::ASTContext::getSourceManager().
Referenced by clang::CodeGen::CodeGenModule::EmitDeferredUnusedCoverageMappings().
|
inline |
Return the counter value of the current region.
Definition at line 54 of file CodeGenPGO.h.
|
inline |
Return the region count for the counter at the given index.
Definition at line 112 of file CodeGenPGO.h.
References haveRegionCounts().
|
inline |
Check if an execution count is known for a given statement.
If so, return true and put the value in Count; else return false.
Definition at line 63 of file CodeGenPGO.h.
Referenced by setCurrentStmt().
|
inline |
Whether or not we have PGO region data for the current function.
This is false both when we have no data at all and when our data has been discarded.
Definition at line 51 of file CodeGenPGO.h.
Referenced by getRegionCount(), and valueProfile().
|
inline |
Set the counter value for the current region.
This is used to keep track of changes to the most recent counter from control flow and non-local exits.
Definition at line 59 of file CodeGenPGO.h.
Referenced by setCurrentStmt().
|
inline |
If the execution count for the current statement is known, record that as the current count.
Definition at line 74 of file CodeGenPGO.h.
References getStmtCount(), and setCurrentRegionCount().
void CodeGenPGO::setValueProfilingFlag | ( | llvm::Module & | M | ) |
Definition at line 976 of file CodeGenPGO.cpp.
References EnableValueProfiling(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), and clang::CodeGenOptions::hasProfileClangInstr().
Referenced by clang::CodeGen::CodeGenModule::Release().
void CodeGenPGO::valueProfile | ( | CGBuilderTy & | Builder, |
uint32_t | ValueKind, | ||
llvm::Instruction * | ValueSite, | ||
llvm::Value * | ValuePtr | ||
) |
Definition at line 984 of file CodeGenPGO.cpp.
References EnableValueProfiling(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getPGOReader(), clang::CodeGenOptions::hasProfileClangInstr(), and haveRegionCounts().