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

Per-function PGO state. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CodeGenPGO.h"

Public Member Functions

 CodeGenPGO (CodeGenModule &CGModule)
 
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) const
 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 setValueProfilingFlag (llvm::Module &M)
 
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 27 of file CodeGenPGO.h.

Constructor & Destructor Documentation

◆ CodeGenPGO()

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

Definition at line 43 of file CodeGenPGO.h.

Member Function Documentation

◆ assignRegionCounters()

void CodeGenPGO::assignRegionCounters ( GlobalDecl  GD,
llvm::Function *  Fn 
)

◆ emitCounterIncrement()

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

Definition at line 950 of file CodeGenPGO.cpp.

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

Referenced by clang::CodeGen::CodeGenModule::EmitDeferredUnusedCoverageMappings().

◆ getCurrentRegionCount()

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

Return the counter value of the current region.

Definition at line 53 of file CodeGenPGO.h.

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

◆ getStmtCount()

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

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

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

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

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

◆ setValueProfilingFlag()

void CodeGenPGO::setValueProfilingFlag ( llvm::Module &  M)

◆ valueProfile()

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

Definition at line 981 of file CodeGenPGO.cpp.

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


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