summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenPGO.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.h')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.h73
1 files changed, 0 insertions, 73 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.h b/clang/lib/CodeGen/CodeGenPGO.h
index 392b1b978bf..d73d030e7b0 100644
--- a/clang/lib/CodeGen/CodeGenPGO.h
+++ b/clang/lib/CodeGen/CodeGenPGO.h
@@ -125,79 +125,6 @@ public:
}
};
-/// A counter for a particular region. This is the primary interface through
-/// which clients manage PGO counters and their values.
-class RegionCounter {
- CodeGenPGO *PGO;
- uint64_t Count;
- uint64_t ParentCount;
- uint64_t RegionCount;
- int64_t Adjust;
-
-public:
- RegionCounter(CodeGenPGO &PGO, const Stmt *S)
- : PGO(&PGO), Count(PGO.getRegionCount(S)),
- ParentCount(PGO.getCurrentRegionCount()), Adjust(0) {}
-
- /// 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.
- uint64_t getCount() const { return Count; }
-
- /// 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.
- uint64_t getAdjustedCount() const {
- return Count + Adjust;
- }
-
- /// 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.
- uint64_t getParentCount() const { return ParentCount; }
-
- void beginRegion(bool AddIncomingFallThrough=false) {
- RegionCount = Count;
- if (AddIncomingFallThrough)
- RegionCount += PGO->getCurrentRegionCount();
- PGO->setCurrentRegionCount(RegionCount);
- }
-
- /// For counters on boolean branches, begins tracking adjustments for the
- /// uncounted path.
- void beginElseRegion() {
- RegionCount = ParentCount - Count;
- PGO->setCurrentRegionCount(RegionCount);
- }
-
- /// Reset the current region count.
- void setCurrentRegionCount(uint64_t CurrentCount) {
- RegionCount = CurrentCount;
- PGO->setCurrentRegionCount(RegionCount);
- }
-
- /// 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.
- void adjustForControlFlow() {
- Adjust += PGO->getCurrentRegionCount() - RegionCount;
- // Reset the region count in case this is called again later.
- RegionCount = PGO->getCurrentRegionCount();
- }
-
- /// 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.
- void applyAdjustmentsToRegion(uint64_t LoopAdjust) {
- PGO->setCurrentRegionCount(ParentCount + Adjust + LoopAdjust);
- }
-};
-
} // end namespace CodeGen
} // end namespace clang
OpenPOWER on IntegriCloud