summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CodeGenPGO.h
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-03-12 21:06:31 +0000
committerJustin Bogner <mail@justinbogner.com>2014-03-12 21:06:31 +0000
commit07cdaf54b0678548b578063229ba37eb79200ee1 (patch)
treeca9009b7b0b019896be9117e568b13fdf347710c /lib/CodeGen/CodeGenPGO.h
parent7c9210c534a8fb77c17da943ea7c7871833b0699 (diff)
Revert "CodeGen: Use a binary format for instrumentation based profiling"
I've clearly done something wrong with how to get this to link correctly. Reverting for now. This reverts commit r203711. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenPGO.h')
-rw-r--r--lib/CodeGen/CodeGenPGO.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenPGO.h b/lib/CodeGen/CodeGenPGO.h
index 7c19414a0b..51d59cf9a9 100644
--- a/lib/CodeGen/CodeGenPGO.h
+++ b/lib/CodeGen/CodeGenPGO.h
@@ -26,6 +26,27 @@ namespace clang {
namespace CodeGen {
class RegionCounter;
+/// The raw counter data from an instrumented PGO binary
+class PGOProfileData {
+private:
+ /// The PGO data
+ std::unique_ptr<llvm::MemoryBuffer> DataBuffer;
+ /// Offsets into DataBuffer for each function's counters
+ llvm::StringMap<unsigned> DataOffsets;
+ /// Execution counts for each function.
+ llvm::StringMap<uint64_t> FunctionCounts;
+ /// The maximal execution count among all functions.
+ uint64_t MaxFunctionCount;
+ CodeGenModule &CGM;
+public:
+ PGOProfileData(CodeGenModule &CGM, std::string Path);
+ /// Fill Counts with the profile data for the given function name. Returns
+ /// false on success.
+ bool getFunctionCounts(StringRef FuncName, std::vector<uint64_t> &Counts);
+ /// Return the maximum of all known function counts.
+ uint64_t getMaximumFunctionCount() { return MaxFunctionCount; }
+};
+
/// Per-function PGO state. This class should generally not be used directly,
/// but instead through the CodeGenFunction and RegionCounter types.
class CodeGenPGO {
@@ -115,9 +136,8 @@ private:
void setFuncName(llvm::Function *Fn);
void mapRegionCounters(const Decl *D);
void computeRegionCounts(const Decl *D);
- void applyFunctionAttributes(llvm::ProfileDataReader *PGOReader,
- llvm::Function *Fn);
- void loadRegionCounts(llvm::ProfileDataReader *PGOReader);
+ void applyFunctionAttributes(PGOProfileData *PGOData, llvm::Function *Fn);
+ void loadRegionCounts(PGOProfileData *PGOData);
void emitCounterVariables();
/// Emit code to increment the counter at the given index