clang  3.9.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)
 
 NumRegionCounters (0)
 
 FunctionHash (0)
 
 CurrentRegionCount (0)
 
 SkipCoverageMapping (false)
 
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)
 
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 31 of file CodeGenPGO.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file CodeGenPGO.h.

Member Function Documentation

void CodeGenPGO::assignRegionCounters ( GlobalDecl  GD,
llvm::Function *  Fn 
)
clang::CodeGen::CodeGenPGO::CurrentRegionCount ( )
void CodeGenPGO::emitCounterIncrement ( CGBuilderTy Builder,
const Stmt S 
)
void CodeGenPGO::emitEmptyCounterMapping ( const Decl D,
StringRef  FuncName,
llvm::GlobalValue::LinkageTypes  Linkage 
)
clang::CodeGen::CodeGenPGO::FunctionHash ( )
uint64_t clang::CodeGen::CodeGenPGO::getCurrentRegionCount ( ) const
inline

Return the counter value of the current region.

Definition at line 60 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 113 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 69 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 57 of file CodeGenPGO.h.

Referenced by clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), getRegionCount(), and valueProfile().

clang::CodeGen::CodeGenPGO::NumRegionCounters ( )
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 65 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 80 of file CodeGenPGO.h.

References clang::LangAS::Count, getStmtCount(), and setCurrentRegionCount().

Referenced by clang::CodeGen::CodeGenFunction::EmitStmt(), and clang::CodeGen::CodeGenFunction::EvaluateExprAsBool().

clang::CodeGen::CodeGenPGO::SkipCoverageMapping ( false  )
inline

Definition at line 52 of file CodeGenPGO.h.

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

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