Rename some function arguments in MachineBasicBlock.cpp/h by turning the first letter...
[oota-llvm.git] / include / llvm / ProfileData / InstrProf.h
index e2291ef2a9b3fe8275677612a3d52a08a45f0691..77055ba8726826d678bb70208695f34987a6756e 100644 (file)
 #ifndef LLVM_PROFILEDATA_INSTRPROF_H_
 #define LLVM_PROFILEDATA_INSTRPROF_H_
 
-#include "llvm/Support/system_error.h"
+#include "llvm/ADT/StringRef.h"
+#include <cstdint>
+#include <system_error>
+#include <vector>
 
 namespace llvm {
+const std::error_category &instrprof_category();
 
-const error_category &instrprof_category();
-
-struct instrprof_error {
-  enum ErrorType {
+enum class instrprof_error {
     success = 0,
     eof,
     bad_magic,
+    bad_header,
     unsupported_version,
+    unsupported_hash_type,
     too_large,
     truncated,
     malformed,
@@ -35,21 +38,27 @@ struct instrprof_error {
     hash_mismatch,
     count_mismatch,
     counter_overflow
-  };
-  ErrorType V;
-
-  instrprof_error(ErrorType V) : V(V) {}
-  operator ErrorType() const { return V; }
 };
 
-inline error_code make_error_code(instrprof_error E) {
-  return error_code(static_cast<int>(E), instrprof_category());
+inline std::error_code make_error_code(instrprof_error E) {
+  return std::error_code(static_cast<int>(E), instrprof_category());
 }
 
-template <> struct is_error_code_enum<instrprof_error> : std::true_type {};
-template <> struct is_error_code_enum<instrprof_error::ErrorType>
-  : std::true_type {};
+/// 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_