clang API Documentation
#include <CodeGenPGO.h>
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) |
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.
clang::CodeGen::RegionCounter::RegionCounter | ( | CodeGenPGO & | PGO, |
const Stmt * | S | ||
) | [inline] |
Definition at line 175 of file CodeGenPGO.h.
void clang::CodeGen::RegionCounter::adjustForControlFlow | ( | ) | [inline] |
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().
void clang::CodeGen::RegionCounter::beginElseRegion | ( | ) | [inline] |
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] |
Activate the counter by emitting an increment and starting to track adjustments. If AddIncomingFallThrough is true, the current region count will be added to the counter for the purposes of tracking the region.
Definition at line 203 of file CodeGenPGO.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitBlockWithFallThrough(), clang::CodeGen::CodeGenFunction::CGCapturedStmtInfo::EmitBody(), clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(), clang::CodeGen::CodeGenFunction::EmitConditionalOperatorLValue(), clang::CodeGen::CodeGenFunction::EmitConstructorBody(), clang::CodeGen::CodeGenFunction::EmitDestructorBody(), clang::CodeGen::CodeGenFunction::EmitForStmt(), clang::CodeGen::CodeGenFunction::EmitFunctionBody(), clang::CodeGen::CodeGenFunction::EmitLabel(), clang::CodeGen::CodeGenFunction::EmitObjCForCollectionStmt(), clang::CodeGen::CodeGenFunction::EmitOMPSimdDirective(), clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), clang::CodeGen::CodeGenFunction::EmitWhileStmt(), clang::CodeGen::CodeGenFunction::ExitCXXTryStmt(), clang::CodeGen::CodeGenFunction::GenerateBlockFunction(), and clang::CodeGen::CodeGenFunction::GenerateObjCMethod().
void clang::CodeGen::RegionCounter::beginRegion | ( | bool | AddIncomingFallThrough = false | ) | [inline] |
Definition at line 207 of file CodeGenPGO.h.
References clang::CodeGen::CodeGenPGO::getCurrentRegionCount(), and clang::CodeGen::CodeGenPGO::setCurrentRegionCount().
uint64_t clang::CodeGen::RegionCounter::getAdjustedCount | ( | ) | const [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] |
Get the value of the counter. In most cases this is the number of times the region of the counter was entered, but for switch labels it's the number of direct jumps to that label.
Definition at line 183 of file CodeGenPGO.h.
Referenced by clang::CodeGen::CodeGenPGO::createLoopWeights(), clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(), clang::CodeGen::CodeGenFunction::EmitCaseStmt(), clang::CodeGen::CodeGenFunction::EmitCaseStmtRange(), clang::CodeGen::CodeGenFunction::EmitConditionalOperatorLValue(), clang::CodeGen::CodeGenFunction::EmitObjCForCollectionStmt(), clang::CodeGen::CodeGenFunction::EmitOMPSimdDirective(), and clang::CodeGen::CodeGenFunction::EmitSwitchStmt().
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().