summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenPGO.h
diff options
context:
space:
mode:
authorBetul Buyukkurt <betulb@codeaurora.org>2016-01-23 22:50:44 +0000
committerBetul Buyukkurt <betulb@codeaurora.org>2016-01-23 22:50:44 +0000
commit518276a5fec86b3dfc84635fc0a0ec77ab21e04a (patch)
tree9c098331fe5c86da7720a571b67e46571f7a85be /clang/lib/CodeGen/CodeGenPGO.h
parent0af37b21c8ed7381315edbf3658fc451185a6708 (diff)
downloadbcm5719-llvm-518276a5fec86b3dfc84635fc0a0ec77ab21e04a.tar.gz
bcm5719-llvm-518276a5fec86b3dfc84635fc0a0ec77ab21e04a.zip
Clang changes for value profiling
Differential Revision: http://reviews.llvm.org/D8940 llvm-svn: 258650
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.h')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.h b/clang/lib/CodeGen/CodeGenPGO.h
index 6bf29ecaa7c..a181cb958c7 100644
--- a/clang/lib/CodeGen/CodeGenPGO.h
+++ b/clang/lib/CodeGen/CodeGenPGO.h
@@ -19,6 +19,7 @@
#include "CodeGenTypes.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/MemoryBuffer.h"
#include <memory>
@@ -32,10 +33,12 @@ private:
std::string FuncName;
llvm::GlobalVariable *FuncNameVar;
+ unsigned NumValueSites[llvm::IPVK_Last + 1];
unsigned NumRegionCounters;
uint64_t FunctionHash;
std::unique_ptr<llvm::DenseMap<const Stmt *, unsigned>> RegionCounterMap;
std::unique_ptr<llvm::DenseMap<const Stmt *, uint64_t>> StmtCountMap;
+ std::unique_ptr<llvm::InstrProfRecord> ProfRecord;
std::vector<uint64_t> RegionCounts;
uint64_t CurrentRegionCount;
/// \brief A flag that is set to true when this function doesn't need
@@ -44,8 +47,8 @@ private:
public:
CodeGenPGO(CodeGenModule &CGM)
- : CGM(CGM), NumRegionCounters(0), FunctionHash(0), CurrentRegionCount(0),
- SkipCoverageMapping(false) {}
+ : CGM(CGM), NumValueSites{0}, NumRegionCounters(0),
+ FunctionHash(0), CurrentRegionCount(0), SkipCoverageMapping(false) {}
/// Whether or not we have PGO region data for the current function. This is
/// false both when we have no data at all and when our data has been
@@ -87,6 +90,9 @@ public:
/// for an unused declaration.
void emitEmptyCounterMapping(const Decl *D, StringRef FuncName,
llvm::GlobalValue::LinkageTypes Linkage);
+ // Insert instrumentation or attach profile metadata at value sites
+ void valueProfile(CGBuilderTy &Builder, uint32_t ValueKind,
+ llvm::Instruction *ValueSite, llvm::Value *ValuePtr);
private:
void setFuncName(llvm::Function *Fn);
void setFuncName(StringRef Name, llvm::GlobalValue::LinkageTypes Linkage);
OpenPOWER on IntegriCloud