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

Per-function PGO state. More...

#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/CodeGen/CodeGenPGO.h"

Public Member Functions

 CodeGenPGO (CodeGenModule &CGM)
 
bool haveRegionCounts () const
 Whether or not we have PGO region data for the current function. More...
 
uint64_t getCurrentRegionCount () const
 Return the counter value of the current region. More...
 
void setCurrentRegionCount (uint64_t Count)
 Set the counter value for the current region. More...
 
Optional< uint64_t > getStmtCount (const Stmt *S)
 Check if an execution count is known for a given statement. More...
 
void setCurrentStmt (const Stmt *S)
 If the execution count for the current statement is known, record that as the current count. More...
 
void assignRegionCounters (GlobalDecl GD, llvm::Function *Fn)
 Assign counters to regions and configure them for PGO of a given function. More...
 
void emitEmptyCounterMapping (const Decl *D, StringRef FuncName, llvm::GlobalValue::LinkageTypes Linkage)
 Emit a coverage mapping range with a counter zero for an unused declaration. More...
 
void valueProfile (CGBuilderTy &Builder, uint32_t ValueKind, llvm::Instruction *ValueSite, llvm::Value *ValuePtr)
 
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. More...
 

Detailed Description

Per-function PGO state.

Definition at line 29 of file CodeGenPGO.h.

Constructor & Destructor Documentation

◆ CodeGenPGO()

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

Definition at line 45 of file CodeGenPGO.h.

Member Function Documentation

◆ assignRegionCounters()

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 753 of file CodeGenPGO.cpp.

References clang::Ctor_Base, clang::Dtor_Base, clang::CodeGen::CoverageMappingGen::emitCounterMapping(), clang::Decl::getBody(), clang::GlobalDecl::getCtorType(), clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), clang::Decl::getLocation(), clang::Stmt::getLocStart(), clang::Decl::hasBody(), clang::CodeGen::CodeGenFunction::IsConstructorDelegationValid(), clang::Decl::isImplicit(), clang::SourceManager::isInMainFile(), clang::SourceManager::isInSystemHeader(), PGO_HASH_LATEST, and SM.

Referenced by clang::CodeGen::CodeGenFunction::GenerateCode().

◆ emitCounterIncrement()

void CodeGenPGO::emitCounterIncrement ( CGBuilderTy Builder,
const Stmt S,
llvm::Value StepV 
)

◆ emitEmptyCounterMapping()

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 842 of file CodeGenPGO.cpp.

References clang::CodeGen::CoverageMappingGen::emitEmptyMapping(), getRegionCount(), and haveRegionCounts().

◆ getCurrentRegionCount()

uint64_t clang::CodeGen::CodeGenPGO::getCurrentRegionCount ( ) const
inline

Return the counter value of the current region.

Definition at line 55 of file CodeGenPGO.h.

Referenced by clang::CodeGen::CodeGenFunction::getCurrentProfileCount().

◆ getRegionCount()

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

Referenced by emitEmptyCounterMapping().

◆ getStmtCount()

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 64 of file CodeGenPGO.h.

Referenced by clang::CodeGen::CodeGenFunction::getProfileCount().

◆ haveRegionCounts()

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 52 of file CodeGenPGO.h.

Referenced by emitEmptyCounterMapping(), and getRegionCount().

◆ setCurrentRegionCount()

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 60 of file CodeGenPGO.h.

Referenced by clang::CodeGen::CodeGenFunction::setCurrentProfileCount().

◆ 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 75 of file CodeGenPGO.h.

Referenced by clang::CodeGen::CodeGenFunction::incrementProfileCounter().

◆ valueProfile()

void CodeGenPGO::valueProfile ( CGBuilderTy Builder,
uint32_t  ValueKind,
llvm::Instruction *  ValueSite,
llvm::Value ValuePtr 
)

Definition at line 911 of file CodeGenPGO.cpp.


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