1 //=-- InstrProf.h - Instrumented profiling format support ---------*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_PROFILEDATA_INSTRPROF_H_
17 #define LLVM_PROFILEDATA_INSTRPROF_H_
19 #include "llvm/ADT/StringRef.h"
20 #include <system_error>
24 const std::error_category &instrprof_category();
26 enum class instrprof_error {
32 unsupported_hash_type,
42 inline std::error_code make_error_code(instrprof_error E) {
43 return std::error_code(static_cast<int>(E), instrprof_category());
46 /// Profiling information for a single function.
47 struct InstrProfRecord {
49 InstrProfRecord(StringRef Name, uint64_t Hash, std::vector<uint64_t> &Counts)
50 : Name(Name), Hash(Hash), Counts(std::move(Counts)) {}
53 std::vector<uint64_t> Counts;
56 } // end namespace llvm
60 struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
63 #endif // LLVM_PROFILEDATA_INSTRPROF_H_