mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-26 06:22:56 +02:00
f4084a2560
This consolidates the logic to read instrprof records into the on disk hash table's lookup trait and makes us copy the counter data instead of taking references to it as we read. This will simplify further changes to the format. Patch by Betul Buyukkurt. llvm-svn: 240206
64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
//=-- 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/ADT/StringRef.h"
|
|
#include <system_error>
|
|
#include <vector>
|
|
|
|
namespace llvm {
|
|
const std::error_category &instrprof_category();
|
|
|
|
enum class instrprof_error {
|
|
success = 0,
|
|
eof,
|
|
bad_magic,
|
|
bad_header,
|
|
unsupported_version,
|
|
unsupported_hash_type,
|
|
too_large,
|
|
truncated,
|
|
malformed,
|
|
unknown_function,
|
|
hash_mismatch,
|
|
count_mismatch,
|
|
counter_overflow
|
|
};
|
|
|
|
inline std::error_code make_error_code(instrprof_error E) {
|
|
return std::error_code(static_cast<int>(E), instrprof_category());
|
|
}
|
|
|
|
/// 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;
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
namespace std {
|
|
template <>
|
|
struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
|
|
}
|
|
|
|
#endif // LLVM_PROFILEDATA_INSTRPROF_H_
|