InstrProfIndexed.h [plain text]
#ifndef LLVM_PROFILEDATA_INSTRPROF_INDEXED_H_
#define LLVM_PROFILEDATA_INSTRPROF_INDEXED_H_
#include "llvm/Support/MD5.h"
namespace llvm {
namespace IndexedInstrProf {
enum class HashT : uint32_t {
MD5,
Last = MD5
};
static inline uint64_t MD5Hash(StringRef Str) {
MD5 Hash;
Hash.update(Str);
llvm::MD5::MD5Result Result;
Hash.final(Result);
using namespace llvm::support;
return endian::read<uint64_t, little, unaligned>(Result);
}
static inline uint64_t ComputeHash(HashT Type, StringRef K) {
switch (Type) {
case HashT::MD5:
return IndexedInstrProf::MD5Hash(K);
}
llvm_unreachable("Unhandled hash type");
}
const uint64_t Magic = 0x8169666f72706cff; const uint64_t Version = 1;
const HashT HashType = HashT::MD5;
}
}
#endif // LLVM_PROFILEDATA_INSTRPROF_INDEXED_H_