summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-04-15 21:22:35 +0000
committerJustin Bogner <mail@justinbogner.com>2014-04-15 21:22:35 +0000
commit859d2b24895e5bfaa52005a48a36236024175bfb (patch)
tree79554223b7d00d1a476b438c5958069506a8fbd2 /lib/CodeGen/CodeGenModule.h
parent206fe8c782ce766fccf35c5769c33df331fe9e6c (diff)
downloadclang-859d2b24895e5bfaa52005a48a36236024175bfb.tar.gz
clang-859d2b24895e5bfaa52005a48a36236024175bfb.tar.bz2
clang-859d2b24895e5bfaa52005a48a36236024175bfb.tar.xz
CodeGen: Emit warnings for out of date profile data during PGO
This adds a warning that triggers when profile data doesn't match for the source that's being compiled with -fprofile-instr-use=. This fires only once per translation unit, as warning on every mismatched function would be quite noisy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206322 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r--lib/CodeGen/CodeGenModule.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index 0d13bdcc2f..f6614dd44b 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -220,6 +220,15 @@ struct ARCEntrypoints {
llvm::Constant *clang_arc_use;
};
+/// This class records statistics on instrumentation based profiling.
+struct InstrProfStats {
+ InstrProfStats() : Visited(0), Missing(0), Mismatched(0) {}
+ bool isOutOfDate() { return Missing || Mismatched; }
+ uint32_t Visited;
+ uint32_t Missing;
+ uint32_t Mismatched;
+};
+
/// CodeGenModule - This class organizes the cross-function state that is used
/// while generating LLVM code.
class CodeGenModule : public CodeGenTypeCache {
@@ -258,6 +267,7 @@ class CodeGenModule : public CodeGenTypeCache {
llvm::MDNode *NoObjCARCExceptionsMetadata;
RREntrypoints *RRData;
PGOProfileData *PGOData;
+ InstrProfStats PGOStats;
// WeakRefReferences - A set of references that have only been seen via
// a weakref so far. This is used to remove the weak of the reference if we
@@ -483,6 +493,10 @@ public:
return *RRData;
}
+ InstrProfStats &getPGOStats() {
+ return PGOStats;
+ }
+
PGOProfileData *getPGOData() const {
return PGOData;
}