eafb76886c83e8ff4697846e388213dedf9aa7cc
[oota-llvm.git] / include / llvm / ProfileData / InstrProf.h
1 //=-- InstrProf.h - Instrumented profiling format support ---------*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Instrumentation-based profiling data is generated by instrumented
11 // binaries through library functions in compiler-rt, and read by the clang
12 // frontend to feed PGO.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_PROFILEDATA_INSTRPROF_H_
17 #define LLVM_PROFILEDATA_INSTRPROF_H_
18
19 #include <system_error>
20
21 namespace llvm {
22 const std::error_category &instrprof_category();
23
24 enum class instrprof_error {
25     success = 0,
26     eof,
27     bad_magic,
28     bad_header,
29     unsupported_version,
30     unsupported_hash_type,
31     too_large,
32     truncated,
33     malformed,
34     unknown_function,
35     hash_mismatch,
36     count_mismatch,
37     counter_overflow
38 };
39
40 inline std::error_code make_error_code(instrprof_error E) {
41   return std::error_code(static_cast<int>(E), instrprof_category());
42 }
43
44 } // end namespace llvm
45
46 namespace std {
47 template <>
48 struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
49 }
50
51 #endif // LLVM_PROFILEDATA_INSTRPROF_H_