diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-03-12 21:06:31 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-03-12 21:06:31 +0000 |
commit | d66a17d0a3eb4fc862d8715416367be67f008a62 (patch) | |
tree | 4ec402fff2268689e165818922c8510c7304af32 /clang/lib/CodeGen/CodeGenPGO.h | |
parent | ff9a0582673a6f1e73d5ac60d03e43fb7038ea50 (diff) | |
download | bcm5719-llvm-d66a17d0a3eb4fc862d8715416367be67f008a62.tar.gz bcm5719-llvm-d66a17d0a3eb4fc862d8715416367be67f008a62.zip |
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.
llvm-svn: 203712
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.h b/clang/lib/CodeGen/CodeGenPGO.h index 7c19414a0bd..51d59cf9a9b 100644 --- a/clang/lib/CodeGen/CodeGenPGO.h +++ b/clang/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 |