diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-03-12 22:00:57 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-03-12 22:00:57 +0000 |
commit | efa9416a21d7cac98996b92a805321ad061f54c0 (patch) | |
tree | a69da4d26ec90b29ec8aa9fea0a40cfb6c13474e /include | |
parent | 4a0593ccd38cf01419e957e3947ed24cb3e06a07 (diff) | |
download | llvm-efa9416a21d7cac98996b92a805321ad061f54c0.tar.gz llvm-efa9416a21d7cac98996b92a805321ad061f54c0.tar.bz2 llvm-efa9416a21d7cac98996b92a805321ad061f54c0.tar.xz |
Back out Profile library and dependent commits
Chandler voiced some concern with checking this in without some
discussion first. Reverting for now.
This reverts r203703, r203704, r203708, and 203709.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Profile/ProfileData.h | 56 | ||||
-rw-r--r-- | include/llvm/Profile/ProfileDataReader.h | 91 | ||||
-rw-r--r-- | include/llvm/Profile/ProfileDataWriter.h | 47 | ||||
-rw-r--r-- | include/llvm/Support/LineIterator.h | 1 |
4 files changed, 0 insertions, 195 deletions
diff --git a/include/llvm/Profile/ProfileData.h b/include/llvm/Profile/ProfileData.h deleted file mode 100644 index 72cc840e80..0000000000 --- a/include/llvm/Profile/ProfileData.h +++ /dev/null @@ -1,56 +0,0 @@ -//=-- ProfileData.h - Instrumented 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. -// -//===----------------------------------------------------------------------===// -// -// This file contains support for instrumentation based PGO and coverage. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_PROFILE_PROFILEDATA_H__ -#define LLVM_PROFILE_PROFILEDATA_H__ - -#include "llvm/Support/DataTypes.h" -#include "llvm/Support/system_error.h" - -#include <vector> - -namespace llvm { - -const char PROFILEDATA_MAGIC[4] = {'L', 'P', 'R', 'F'}; -const uint32_t PROFILEDATA_VERSION = 1; -const uint32_t PROFILEDATA_HEADER_SIZE = 24; - -const error_category &profiledata_category(); - -struct profiledata_error { - enum ErrorType { - success = 0, - bad_magic, - unsupported_version, - too_large, - truncated, - malformed, - unknown_function - }; - ErrorType V; - - profiledata_error(ErrorType V) : V(V) {} - operator ErrorType() const { return V; } -}; - -inline error_code make_error_code(profiledata_error E) { - return error_code(static_cast<int>(E), profiledata_category()); -} - -template <> struct is_error_code_enum<profiledata_error> : std::true_type {}; -template <> struct is_error_code_enum<profiledata_error::ErrorType> - : std::true_type {}; - -} // end namespace llvm - -#endif // LLVM_PROFILE_PROFILEDATA_H__ diff --git a/include/llvm/Profile/ProfileDataReader.h b/include/llvm/Profile/ProfileDataReader.h deleted file mode 100644 index 0f771f23fd..0000000000 --- a/include/llvm/Profile/ProfileDataReader.h +++ /dev/null @@ -1,91 +0,0 @@ -//=-- ProfileDataReader.h - Instrumented profiling reader ---------*- C++ -*-=// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains support for reading profiling data for instrumentation -// based PGO and coverage. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_PROFILE_PROFILEDATA_READER_H__ -#define LLVM_PROFILE_PROFILEDATA_READER_H__ - -#include "llvm/ADT/StringMap.h" -#include "llvm/Support/Compiler.h" -#include "llvm/Support/DataTypes.h" -#include "llvm/Support/ErrorOr.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/raw_ostream.h" - -#include <vector> - -namespace llvm { - -class ProfileDataCursor; - -/// Reader for the profile data that is used for instrumentation based PGO. -class ProfileDataReader { -private: - /// The profile data file contents. - std::unique_ptr<MemoryBuffer> DataBuffer; - /// Offsets into DataBuffer for each function's counters. - StringMap<uint32_t> DataOffsets; - /// The maximal execution count among all functions. - uint64_t MaxFunctionCount; - - ProfileDataReader(const ProfileDataReader &) LLVM_DELETED_FUNCTION; - ProfileDataReader &operator=(const ProfileDataReader &) LLVM_DELETED_FUNCTION; -protected: - ProfileDataReader(std::unique_ptr<MemoryBuffer> &DataBuffer) - : DataBuffer(DataBuffer.release()) {} - - /// Populate internal state using the profile data's index - error_code readIndex(); -public: - - class name_iterator { - typedef StringMap<unsigned>::const_iterator IterTy; - IterTy Ix; - public: - explicit name_iterator(const IterTy &Ix) : Ix(Ix) {} - - StringRef operator*() const { return Ix->getKey(); } - - bool operator==(const name_iterator &RHS) const { return Ix == RHS.Ix; } - bool operator!=(const name_iterator &RHS) const { return Ix != RHS.Ix; } - - inline name_iterator& operator++() { ++Ix; return *this; } - }; - - /// Iterators over the names of indexed items - name_iterator begin() const { - return name_iterator(DataOffsets.begin()); - } - name_iterator end() const { - return name_iterator(DataOffsets.end()); - } - -private: - error_code findFunctionCounts(StringRef FuncName, uint64_t &FunctionHash, - ProfileDataCursor &Cursor); -public: - /// The number of profiled functions - size_t numProfiledFunctions() { return DataOffsets.size(); } - /// Fill Counts with the profile data for the given function name. - error_code getFunctionCounts(StringRef FuncName, uint64_t &FunctionHash, - std::vector<uint64_t> &Counts); - /// Return the maximum of all known function counts. - uint64_t getMaximumFunctionCount() { return MaxFunctionCount; } - - static error_code create(std::string Path, - std::unique_ptr<ProfileDataReader> &Result); -}; - -} // end namespace llvm - -#endif // LLVM_PROFILE_PROFILEDATA_READER_H__ diff --git a/include/llvm/Profile/ProfileDataWriter.h b/include/llvm/Profile/ProfileDataWriter.h deleted file mode 100644 index 3498d2eca3..0000000000 --- a/include/llvm/Profile/ProfileDataWriter.h +++ /dev/null @@ -1,47 +0,0 @@ -//=-- ProfileDataWriter.h - Instrumented profiling writer ---------*- C++ -*-=// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file contains support for writing profiling data for instrumentation -// based PGO and coverage. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_PROFILE_PROFILEDATA_WRITER_H__ -#define LLVM_PROFILE_PROFILEDATA_WRITER_H__ - -#include "llvm/ADT/StringMap.h" -#include "llvm/Profile/ProfileData.h" -#include "llvm/Support/DataTypes.h" -#include "llvm/Support/raw_ostream.h" - -#include <vector> - -namespace llvm { - -/// Writer for instrumentation based profile data -class ProfileDataWriter { - StringMap<size_t> FunctionOffsets; - std::vector<uint64_t> FunctionData; - uint32_t DataStart; - uint64_t MaxFunctionCount; - - void write32(raw_ostream &OS, uint32_t Value); - void write64(raw_ostream &OS, uint64_t Value); -public: - ProfileDataWriter() - : DataStart(PROFILEDATA_HEADER_SIZE), MaxFunctionCount(0) {} - - void addFunctionCounts(StringRef FuncName, uint64_t FunctionHash, - uint64_t NumCounters, const uint64_t *Counters); - void write(raw_ostream &OS); -}; - -} // end namespace llvm - -#endif // LLVM_PROFILE_PROFILEDATA_WRITER_H__ diff --git a/include/llvm/Support/LineIterator.h b/include/llvm/Support/LineIterator.h index 92a9cc5c57..861c19881f 100644 --- a/include/llvm/Support/LineIterator.h +++ b/include/llvm/Support/LineIterator.h @@ -56,7 +56,6 @@ public: /// \brief Get the current line as a \c StringRef. StringRef operator*() const { return CurrentLine; } - const StringRef *operator->() const { return &CurrentLine; } friend bool operator==(const line_iterator &LHS, const line_iterator &RHS) { return LHS.Buffer == RHS.Buffer && |