2014-03-21 17:24:48 +00:00
|
|
|
//=-- 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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-03-21 18:46:29 +00:00
|
|
|
#ifndef LLVM_PROFILEDATA_INSTRPROF_H_
|
|
|
|
#define LLVM_PROFILEDATA_INSTRPROF_H_
|
2014-03-21 17:24:48 +00:00
|
|
|
|
2015-06-22 23:58:05 +00:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
#include <cstdint>
|
2014-06-12 17:38:55 +00:00
|
|
|
#include <system_error>
|
2015-06-22 23:58:05 +00:00
|
|
|
#include <vector>
|
2014-03-21 17:24:48 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2014-06-12 01:45:43 +00:00
|
|
|
const std::error_category &instrprof_category();
|
2014-03-21 17:24:48 +00:00
|
|
|
|
2014-06-03 05:12:33 +00:00
|
|
|
enum class instrprof_error {
|
2014-03-21 17:24:48 +00:00
|
|
|
success = 0,
|
|
|
|
eof,
|
|
|
|
bad_magic,
|
2014-03-21 20:42:28 +00:00
|
|
|
bad_header,
|
2014-03-21 17:24:48 +00:00
|
|
|
unsupported_version,
|
2014-04-18 21:48:40 +00:00
|
|
|
unsupported_hash_type,
|
2014-03-21 17:24:48 +00:00
|
|
|
too_large,
|
|
|
|
truncated,
|
|
|
|
malformed,
|
2014-03-21 17:46:22 +00:00
|
|
|
unknown_function,
|
|
|
|
hash_mismatch,
|
|
|
|
count_mismatch,
|
|
|
|
counter_overflow
|
2014-03-21 17:24:48 +00:00
|
|
|
};
|
|
|
|
|
2014-06-12 21:46:39 +00:00
|
|
|
inline std::error_code make_error_code(instrprof_error E) {
|
|
|
|
return std::error_code(static_cast<int>(E), instrprof_category());
|
2014-03-21 17:24:48 +00:00
|
|
|
}
|
|
|
|
|
2015-06-22 23:58:05 +00:00
|
|
|
/// Profiling information for a single function.
|
|
|
|
struct InstrProfRecord {
|
|
|
|
InstrProfRecord() {}
|
|
|
|
InstrProfRecord(StringRef Name, uint64_t Hash, std::vector<uint64_t> Counts)
|
|
|
|
: Name(Name), Hash(Hash), Counts(std::move(Counts)) {}
|
|
|
|
StringRef Name;
|
|
|
|
uint64_t Hash;
|
|
|
|
std::vector<uint64_t> Counts;
|
|
|
|
};
|
|
|
|
|
2014-03-21 17:24:48 +00:00
|
|
|
} // end namespace llvm
|
|
|
|
|
2014-06-11 19:05:50 +00:00
|
|
|
namespace std {
|
|
|
|
template <>
|
|
|
|
struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
|
|
|
|
}
|
|
|
|
|
2014-03-21 18:46:29 +00:00
|
|
|
#endif // LLVM_PROFILEDATA_INSTRPROF_H_
|