summaryrefslogtreecommitdiff
path: root/include/llvm/ProfileData/InstrProf.h
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-03-21 17:24:48 +0000
committerJustin Bogner <mail@justinbogner.com>2014-03-21 17:24:48 +0000
commitc0f3b725555df38fc4d9be6154af95dad83694f8 (patch)
tree9b55483376292140b20656648ed1254eebff2e83 /include/llvm/ProfileData/InstrProf.h
parent6c22b041da771c2cccc004d97fd49543f0ebf168 (diff)
downloadllvm-c0f3b725555df38fc4d9be6154af95dad83694f8.tar.gz
llvm-c0f3b725555df38fc4d9be6154af95dad83694f8.tar.bz2
llvm-c0f3b725555df38fc4d9be6154af95dad83694f8.tar.xz
ProfileData: Introduce the InstrProfReader interface and a text reader
This introduces the ProfileData library and updates llvm-profdata to use this library for reading profiles. InstrProfReader is an abstract base class that will be subclassed for both the raw instrprof data from compiler-rt and the efficient instrprof format that will be used for PGO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ProfileData/InstrProf.h')
-rw-r--r--include/llvm/ProfileData/InstrProf.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/llvm/ProfileData/InstrProf.h b/include/llvm/ProfileData/InstrProf.h
new file mode 100644
index 0000000000..21cc170065
--- /dev/null
+++ b/include/llvm/ProfileData/InstrProf.h
@@ -0,0 +1,52 @@
+//=-- InstrProf.h - Instrumented profiling format support ---------*- C++ -*-=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Instrumentation-based profiling data is generated by instrumented
+// binaries through library functions in compiler-rt, and read by the clang
+// frontend to feed PGO.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_PROFILEDATA_INSTRPROF_H__
+#define LLVM_PROFILEDATA_INSTRPROF_H__
+
+#include "llvm/Support/system_error.h"
+
+namespace llvm {
+
+const error_category &instrprof_category();
+
+struct instrprof_error {
+ enum ErrorType {
+ success = 0,
+ eof,
+ bad_magic,
+ unsupported_version,
+ too_large,
+ truncated,
+ malformed,
+ unknown_function
+ };
+ ErrorType V;
+
+ instrprof_error(ErrorType V) : V(V) {}
+ operator ErrorType() const { return V; }
+};
+
+inline error_code make_error_code(instrprof_error E) {
+ return error_code(static_cast<int>(E), instrprof_category());
+}
+
+template <> struct is_error_code_enum<instrprof_error> : std::true_type {};
+template <> struct is_error_code_enum<instrprof_error::ErrorType>
+ : std::true_type {};
+
+} // end namespace llvm
+
+#endif // LLVM_PROFILEDATA_INSTRPROF_H__