clang
3.7.0
|
Per-function PGO state. More...
#include <CodeGenPGO.h>
Public Member Functions | |
CodeGenPGO (CodeGenModule &CGM) | |
bool | haveRegionCounts () const |
uint64_t | getCurrentRegionCount () const |
Return the counter value of the current region. More... | |
void | setCurrentRegionCount (uint64_t Count) |
Optional< uint64_t > | getStmtCount (const Stmt *S) |
void | setCurrentStmt (const Stmt *S) |
void | checkGlobalDecl (GlobalDecl GD) |
Check if we need to emit coverage mapping for a given declaration. More... | |
void | assignRegionCounters (const Decl *D, llvm::Function *Fn) |
void | emitEmptyCounterMapping (const Decl *D, StringRef FuncName, llvm::GlobalValue::LinkageTypes Linkage) |
void | emitCounterIncrement (CGBuilderTy &Builder, const Stmt *S) |
uint64_t | getRegionCount (const Stmt *S) |
Return the region count for the counter at the given index. More... | |
Per-function PGO state.
Definition at line 29 of file CodeGenPGO.h.
|
inline |
Definition at line 46 of file CodeGenPGO.h.
void CodeGenPGO::assignRegionCounters | ( | const Decl * | D, |
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 660 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::ClearUnusedCoverageMapping(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), clang::Decl::getLocation(), clang::CodeGen::CodeGenModule::getPGOReader(), clang::ASTContext::getSourceManager(), clang::Decl::isImplicit(), clang::SourceManager::isInMainFile(), and SM.
Referenced by clang::CodeGen::CodeGenFunction::GenerateCapturedStmtFunction(), clang::CodeGen::CodeGenFunction::GenerateCode(), and clang::CodeGen::CodeGenFunction::GenerateObjCMethod().
void CodeGenPGO::checkGlobalDecl | ( | GlobalDecl | GD | ) |
Check if we need to emit coverage mapping for a given declaration.
Definition at line 646 of file CodeGenPGO.cpp.
References clang::Ctor_Base, clang::Dtor_Base, clang::GlobalDecl::getCtorType(), clang::GlobalDecl::getDecl(), and clang::GlobalDecl::getDtorType().
Referenced by clang::CodeGen::CodeGenFunction::GenerateCode().
void CodeGenPGO::emitCounterIncrement | ( | CGBuilderTy & | Builder, |
const Stmt * | S | ||
) |
Definition at line 779 of file CodeGenPGO.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenModule::getLLVMContext(), and S.
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 721 of file CodeGenPGO.cpp.
References clang::CodeGen::CoverageMappingModuleGen::addFunctionMappingRecord(), clang::CodeGen::CoverageMappingGen::emitEmptyMapping(), clang::Decl::getBody(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCoverageMapping(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::ASTContext::getSourceManager(), and clang::SourceManager::isInSystemHeader().
Referenced by clang::CodeGen::CodeGenModule::EmitDeferredUnusedCoverageMappings().
|
inline |
Return the counter value of the current region.
Definition at line 56 of file CodeGenPGO.h.
|
inline |
Return the region count for the counter at the given index.
Definition at line 109 of file CodeGenPGO.h.
References haveRegionCounts(), and S.
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 65 of file CodeGenPGO.h.
References clang::None.
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 53 of file CodeGenPGO.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), and getRegionCount().
|
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 61 of file CodeGenPGO.h.
References clang::LangAS::Count.
Referenced by setCurrentStmt().
|
inline |
If the execution count for the current statement is known, record that as the current count.
Definition at line 76 of file CodeGenPGO.h.
References clang::LangAS::Count, getStmtCount(), and setCurrentRegionCount().
Referenced by clang::CodeGen::CodeGenFunction::EmitStmt(), and clang::CodeGen::CodeGenFunction::EvaluateExprAsBool().