[llvm] r206663 - ProfileData: Don't forward declare ComputeHash and make it static inline

Justin Bogner mail at justinbogner.com
Fri Apr 18 15:00:22 PDT 2014


Author: bogner
Date: Fri Apr 18 17:00:22 2014
New Revision: 206663

URL: http://llvm.org/viewvc/llvm-project?rev=206663&view=rev
Log:
ProfileData: Don't forward declare ComputeHash and make it static inline

Modified:
    llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
    llvm/trunk/lib/ProfileData/InstrProfIndexed.h
    llvm/trunk/lib/ProfileData/InstrProfReader.cpp

Modified: llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfReader.h?rev=206663&r1=206662&r2=206663&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfReader.h Fri Apr 18 17:00:22 2014
@@ -198,7 +198,6 @@ typedef RawInstrProfReader<uint64_t> Raw
 
 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) {

Modified: llvm/trunk/lib/ProfileData/InstrProfIndexed.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfIndexed.h?rev=206663&r1=206662&r2=206663&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProfIndexed.h (original)
+++ llvm/trunk/lib/ProfileData/InstrProfIndexed.h Fri Apr 18 17:00:22 2014
@@ -36,7 +36,7 @@ static inline uint64_t MD5Hash(StringRef
   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);

Modified: llvm/trunk/lib/ProfileData/InstrProfReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=206663&r1=206662&r2=206663&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProfReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProfReader.cpp Fri Apr 18 17:00:22 2014
@@ -243,6 +243,11 @@ template class RawInstrProfReader<uint32
 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;





More information about the llvm-commits mailing list