clang  3.7.0
Public Member Functions | List of all members
clang::CodeGen::CodeGenPGO Class Reference

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...
 

Detailed Description

Per-function PGO state.

Definition at line 29 of file CodeGenPGO.h.

Constructor & Destructor Documentation

clang::CodeGen::CodeGenPGO::CodeGenPGO ( CodeGenModule CGM)
inline

Definition at line 46 of file CodeGenPGO.h.

Member Function Documentation

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 
)
void CodeGenPGO::emitEmptyCounterMapping ( const Decl D,
StringRef  FuncName,
llvm::GlobalValue::LinkageTypes  Linkage 
)
uint64_t clang::CodeGen::CodeGenPGO::getCurrentRegionCount ( ) const
inline

Return the counter value of the current region.

Definition at line 56 of file CodeGenPGO.h.

uint64_t clang::CodeGen::CodeGenPGO::getRegionCount ( const Stmt S)
inline

Return the region count for the counter at the given index.

Definition at line 109 of file CodeGenPGO.h.

References haveRegionCounts(), and S.

Optional<uint64_t> clang::CodeGen::CodeGenPGO::getStmtCount ( const Stmt S)
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 65 of file CodeGenPGO.h.

References clang::None.

Referenced by setCurrentStmt().

bool clang::CodeGen::CodeGenPGO::haveRegionCounts ( ) const
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().

void clang::CodeGen::CodeGenPGO::setCurrentRegionCount ( uint64_t  Count)
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().

void clang::CodeGen::CodeGenPGO::setCurrentStmt ( const Stmt S)
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().


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