ProfileData: Don't forward declare ComputeHash and make it static inline
authorJustin Bogner <mail@justinbogner.com>
Fri, 18 Apr 2014 22:00:22 +0000 (22:00 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 18 Apr 2014 22:00:22 +0000 (22:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206663 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ProfileData/InstrProfReader.h
lib/ProfileData/InstrProfIndexed.h
lib/ProfileData/InstrProfReader.cpp

index a9793cf28f20b0a9ca8078064fbb01ee318d8300..5b0c6257a631e8c80f076ce7b16b4d04511a1abf 100644 (file)
@@ -198,7 +198,6 @@ typedef RawInstrProfReader<uint64_t> RawInstrProfReader64;
 
 namespace IndexedInstrProf {
 enum class HashT : uint32_t;
-uint64_t ComputeHash(HashT Type, StringRef K);
 }
 
 /// Trait for lookups into the on-disk hash table for the binary instrprof
@@ -218,9 +217,7 @@ public:
   static bool EqualKey(StringRef A, StringRef B) { return A == B; }
   static StringRef GetInternalKey(StringRef K) { return K; }
 
-  hash_value_type ComputeHash(StringRef K) {
-    return IndexedInstrProf::ComputeHash(HashType, K);
-  }
+  hash_value_type ComputeHash(StringRef K);
 
   static std::pair<offset_type, offset_type>
   ReadKeyDataLength(const unsigned char *&D) {
index 87eb4c3a0272963adc16e817c5d6672fab1258cb..ede5368ca2c2ffa1ead9207eddf2d7afae451ee9 100644 (file)
@@ -36,7 +36,7 @@ static inline uint64_t MD5Hash(StringRef Str) {
   return endian::read<uint64_t, little, unaligned>(Result);
 }
 
-uint64_t ComputeHash(HashT Type, StringRef K) {
+static inline uint64_t ComputeHash(HashT Type, StringRef K) {
   switch (Type) {
   case HashT::MD5:
     return IndexedInstrProf::MD5Hash(K);
index c8d2c2781c7d55d1ef7a03a55115bed4c1ea9676..4f110a5712243d736c2ebd660bf1b90e7a9998ef 100644 (file)
@@ -243,6 +243,11 @@ template class RawInstrProfReader<uint32_t>;
 template class RawInstrProfReader<uint64_t>;
 }
 
+InstrProfLookupTrait::hash_value_type
+InstrProfLookupTrait::ComputeHash(StringRef K) {
+  return IndexedInstrProf::ComputeHash(HashType, K);
+}
+
 bool IndexedInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) {
   if (DataBuffer.getBufferSize() < 8)
     return false;