1 //=-- InstrProf.cpp - Instrumented profiling format support -----------------=//
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 // This file contains support for clang's instrumentation based PGO and
13 //===----------------------------------------------------------------------===//
15 #include "llvm/ProfileData/InstrProf.h"
16 #include "llvm/Support/ErrorHandling.h"
21 class InstrProfErrorCategoryType : public std::error_category {
22 const char *name() const LLVM_NOEXCEPT override { return "llvm.instrprof"; }
23 std::string message(int IE) const override {
24 instrprof_error E = static_cast<instrprof_error>(IE);
26 case instrprof_error::success:
28 case instrprof_error::eof:
30 case instrprof_error::bad_magic:
31 return "Invalid file format (bad magic)";
32 case instrprof_error::bad_header:
33 return "Invalid header";
34 case instrprof_error::unsupported_version:
35 return "Unsupported format version";
36 case instrprof_error::unsupported_hash_type:
37 return "Unsupported hash function";
38 case instrprof_error::too_large:
39 return "Too much profile data";
40 case instrprof_error::truncated:
41 return "Truncated profile data";
42 case instrprof_error::malformed:
43 return "Malformed profile data";
44 case instrprof_error::unknown_function:
45 return "No profile data available for function";
46 case instrprof_error::hash_mismatch:
47 return "Function hash mismatch";
48 case instrprof_error::count_mismatch:
49 return "Function count mismatch";
50 case instrprof_error::counter_overflow:
51 return "Counter overflow";
53 llvm_unreachable("A value of instrprof_error has no message.");
58 const std::error_category &llvm::instrprof_category() {
59 static InstrProfErrorCategoryType C;