summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProfIndexed.h
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-10-18 01:02:29 +0000
committerXinliang David Li <davidxl@google.com>2015-10-18 01:02:29 +0000
commitdab183ed40249328531acd424b5c512f86eca77d (patch)
tree06dda7b4eb6d82a69c6bc316acd30d7f28b13a6a /llvm/lib/ProfileData/InstrProfIndexed.h
parentb8d27aab7d67b214ccfd68d12b8f187adcb103de (diff)
downloadbcm5719-llvm-dab183ed40249328531acd424b5c512f86eca77d.tar.gz
bcm5719-llvm-dab183ed40249328531acd424b5c512f86eca77d.zip
Minor Instr PGO code restructuring
1. Key constant values (version, magic) and data structures related to raw and indexed profile format are moved into one centralized file: InstrProf.h. 2. Utility function such as MD5Hash computation is also moved to the common header to allow sharing with other components in the future. 3. A header data structure is introduced for Indexed format so that the reader and writer can always be in sync. 4. Added some comments to document different places where multiple definition of the data structure must be kept in sync (reader/writer, runtime, lowering etc). No functional change is intended. Differential Revision: http://reviews.llvm.org/D13758 llvm-svn: 250638
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfIndexed.h')
-rw-r--r--llvm/lib/ProfileData/InstrProfIndexed.h56
1 files changed, 0 insertions, 56 deletions
diff --git a/llvm/lib/ProfileData/InstrProfIndexed.h b/llvm/lib/ProfileData/InstrProfIndexed.h
deleted file mode 100644
index fe0b04ed008..00000000000
--- a/llvm/lib/ProfileData/InstrProfIndexed.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//=-- InstrProfIndexed.h - Indexed profiling format support -------*- C++ -*-=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Shared header for the instrumented profile data reader and writer.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIB_PROFILEDATA_INSTRPROFINDEXED_H
-#define LLVM_LIB_PROFILEDATA_INSTRPROFINDEXED_H
-
-#include "llvm/Support/Endian.h"
-#include "llvm/Support/ErrorHandling.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);
- // Return the least significant 8 bytes. Our MD5 implementation returns the
- // result in little endian, so we may need to swap bytes.
- 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; // "\xfflprofi\x81"
-const uint64_t Version = 3;
-const HashT HashType = HashT::MD5;
-}
-
-} // end namespace llvm
-
-#endif
OpenPOWER on IntegriCloud