diff options
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 92e9ab8..bdd19f4 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -17,7 +17,6 @@ #include "CGLoopInfo.h" #include "CGValue.h" #include "CodeGenModule.h" -#include "CodeGenPGO.h" #include "EHScopeStack.h" #include "VarBypassDetector.h" #include "clang/AST/CharUnits.h" @@ -90,6 +89,7 @@ class OSLogBufferLayout; namespace CodeGen { class CodeGenTypes; +class CodeGenPGO; class CGCallee; class CGFunctionInfo; class CGBlockInfo; @@ -1670,7 +1670,7 @@ private: llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond, Stmt::Likelihood LH); - CodeGenPGO PGO; + std::unique_ptr<CodeGenPGO> PGO; /// Bitmap used by MC/DC to track condition outcomes of a boolean expression. Address MCDCCondBitmapAddr = Address::invalid(); @@ -1683,12 +1683,9 @@ private: uint64_t LoopCount) const; public: - auto getIsCounterPair(const Stmt *S) const { return PGO.getIsCounterPair(S); } - - void markStmtAsUsed(bool Skipped, const Stmt *S) { - PGO.markStmtAsUsed(Skipped, S); - } - void markStmtMaybeUsed(const Stmt *S) { PGO.markStmtMaybeUsed(S); } + std::pair<bool, bool> getIsCounterPair(const Stmt *S) const; + void markStmtAsUsed(bool Skipped, const Stmt *S); + void markStmtMaybeUsed(const Stmt *S); /// Increment the profiler's counter for the given statement by \p StepV. /// If \p StepV is null, the default increment is 1. @@ -1702,13 +1699,7 @@ public: /// Allocate a temp value on the stack that MCDC can use to track condition /// results. - void maybeCreateMCDCCondBitmap() { - if (isMCDCCoverageEnabled()) { - PGO.emitMCDCParameters(Builder); - MCDCCondBitmapAddr = - CreateIRTemp(getContext().UnsignedIntTy, "mcdc.addr"); - } - } + void maybeCreateMCDCCondBitmap(); bool isBinaryLogicalOp(const Expr *E) const { const BinaryOperator *BOp = dyn_cast<BinaryOperator>(E->IgnoreParens()); @@ -1716,43 +1707,24 @@ public: } /// Zero-init the MCDC temp value. - void maybeResetMCDCCondBitmap(const Expr *E) { - if (isMCDCCoverageEnabled() && isBinaryLogicalOp(E)) { - PGO.emitMCDCCondBitmapReset(Builder, E, MCDCCondBitmapAddr); - PGO.setCurrentStmt(E); - } - } + void maybeResetMCDCCondBitmap(const Expr *E); /// Increment the profiler's counter for the given expression by \p StepV. /// If \p StepV is null, the default increment is 1. - void maybeUpdateMCDCTestVectorBitmap(const Expr *E) { - if (isMCDCCoverageEnabled() && isBinaryLogicalOp(E)) { - PGO.emitMCDCTestVectorBitmapUpdate(Builder, E, MCDCCondBitmapAddr, *this); - PGO.setCurrentStmt(E); - } - } + void maybeUpdateMCDCTestVectorBitmap(const Expr *E); /// Update the MCDC temp value with the condition's evaluated result. - void maybeUpdateMCDCCondBitmap(const Expr *E, llvm::Value *Val) { - if (isMCDCCoverageEnabled()) { - PGO.emitMCDCCondBitmapUpdate(Builder, E, MCDCCondBitmapAddr, Val, *this); - PGO.setCurrentStmt(E); - } - } + void maybeUpdateMCDCCondBitmap(const Expr *E, llvm::Value *Val); /// Get the profiler's count for the given statement. - uint64_t getProfileCount(const Stmt *S) { - return PGO.getStmtCount(S).value_or(0); - } + uint64_t getProfileCount(const Stmt *S); /// Set the profiler's current count. - void setCurrentProfileCount(uint64_t Count) { - PGO.setCurrentRegionCount(Count); - } + void setCurrentProfileCount(uint64_t Count); /// Get the profiler's current count. This is generally the count for the most /// recently incremented counter. - uint64_t getCurrentProfileCount() { return PGO.getCurrentRegionCount(); } + uint64_t getCurrentProfileCount(); /// See CGDebugInfo::addInstToCurrentSourceAtom. void addInstToCurrentSourceAtom(llvm::Instruction *KeyInstruction, |