clang API Documentation

Public Member Functions
clang::CodeGen::RegionCounter Class Reference

#include <CodeGenPGO.h>

List of all members.

Public Member Functions

 RegionCounter (CodeGenPGO &PGO, const Stmt *S)
uint64_t getCount () const
uint64_t getAdjustedCount () const
uint64_t getParentCount () const
void beginRegion (CGBuilderTy &Builder, bool AddIncomingFallThrough=false)
void beginRegion (bool AddIncomingFallThrough=false)
void beginElseRegion ()
void setCurrentRegionCount (uint64_t CurrentCount)
 Reset the current region count.
void adjustForControlFlow ()
void applyAdjustmentsToRegion (uint64_t LoopAdjust)

Detailed Description

A counter for a particular region. This is the primary interface through which clients manage PGO counters and their values.

Definition at line 162 of file CodeGenPGO.h.


Constructor & Destructor Documentation

clang::CodeGen::RegionCounter::RegionCounter ( CodeGenPGO PGO,
const Stmt S 
) [inline]

Definition at line 175 of file CodeGenPGO.h.


Member Function Documentation

Adjust for non-local control flow after emitting a subexpression or substatement. This must be called to account for constructs such as gotos, labels, and returns, so that we can ensure that our region's count is correct in the code that follows.

Definition at line 231 of file CodeGenPGO.h.

References clang::CodeGen::CodeGenPGO::getCurrentRegionCount().

void clang::CodeGen::RegionCounter::applyAdjustmentsToRegion ( uint64_t  LoopAdjust) [inline]

Commit all adjustments to the current region. If the region is a loop, the LoopAdjust value should be the count of all the breaks and continues from the loop, to compensate for those counts being deducted from the adjustments for the body of the loop.

Definition at line 241 of file CodeGenPGO.h.

References clang::CodeGen::CodeGenPGO::setCurrentRegionCount().

For counters on boolean branches, begins tracking adjustments for the uncounted path.

Definition at line 216 of file CodeGenPGO.h.

References clang::CodeGen::CodeGenPGO::setCurrentRegionCount().

void clang::CodeGen::RegionCounter::beginRegion ( CGBuilderTy Builder,
bool  AddIncomingFallThrough = false 
) [inline]
void clang::CodeGen::RegionCounter::beginRegion ( bool  AddIncomingFallThrough = false) [inline]

Get the value of the counter with adjustments applied. Adjustments occur when control enters or leaves the region abnormally; i.e., if there is a jump to a label within the region, or if the function can return from within the region. The adjusted count, then, is the value of the counter at the end of the region.

Definition at line 190 of file CodeGenPGO.h.

uint64_t clang::CodeGen::RegionCounter::getCount ( ) const [inline]
uint64_t clang::CodeGen::RegionCounter::getParentCount ( ) const [inline]

Get the value of the counter in this region's parent, i.e., the region that was active when this region began. This is useful for deriving counts in implicitly counted regions, like the false case of a condition or the normal exits of a loop.

Definition at line 198 of file CodeGenPGO.h.

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

void clang::CodeGen::RegionCounter::setCurrentRegionCount ( uint64_t  CurrentCount) [inline]

Reset the current region count.

Definition at line 222 of file CodeGenPGO.h.

References clang::CodeGen::CodeGenPGO::setCurrentRegionCount().


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