LLVM  3.7.0
InstrProf.h
Go to the documentation of this file.
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 "llvm/ADT/StringRef.h"
20 #include <cstdint>
21 #include <system_error>
22 #include <vector>
23 
24 namespace llvm {
26 
27 enum class instrprof_error {
28  success = 0,
29  eof,
30  bad_magic,
31  bad_header,
34  too_large,
35  truncated,
36  malformed,
41 };
42 
43 inline std::error_code make_error_code(instrprof_error E) {
44  return std::error_code(static_cast<int>(E), instrprof_category());
45 }
46 
47 /// Profiling information for a single function.
50  InstrProfRecord(StringRef Name, uint64_t Hash, std::vector<uint64_t> Counts)
51  : Name(Name), Hash(Hash), Counts(std::move(Counts)) {}
53  uint64_t Hash;
54  std::vector<uint64_t> Counts;
55 };
56 
57 } // end namespace llvm
58 
59 namespace std {
60 template <>
61 struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
62 }
63 
64 #endif // LLVM_PROFILEDATA_INSTRPROF_H_
InstrProfRecord(StringRef Name, uint64_t Hash, std::vector< uint64_t > Counts)
Definition: InstrProf.h:50
const std::error_category & instrprof_category()
Definition: InstrProf.cpp:61
std::error_code make_error_code(BitcodeError E)
Definition: ReaderWriter.h:150
static ManagedStatic< _object_error_category > error_category
std::vector< uint64_t > Counts
Definition: InstrProf.h:54
Profiling information for a single function.
Definition: InstrProf.h:48
instrprof_error
Definition: InstrProf.h:27
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40