clang  3.8.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
 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 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 ( GlobalDecl  GD,
llvm::Function *  Fn 
)
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 105 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 I, and 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: