//===- bolt/Profile/DataReader.h - Perf data reader -------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This family of functions reads profile data written by the perf2bolt // utility and stores it in memory for llvm-bolt consumption. // //===----------------------------------------------------------------------===// #ifndef BOLT_PROFILE_DATA_READER_H #define BOLT_PROFILE_DATA_READER_H #include "bolt/Profile/ProfileReaderBase.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include <map> #include <unordered_map> #include <vector> namespace llvm { class MCSymbol; namespace bolt { class BinaryFunction; struct LBREntry { … }; inline raw_ostream &operator<<(raw_ostream &OS, const LBREntry &LBR) { … } struct Location { … }; BranchContext; struct BranchInfo { … }; struct FuncBranchData { … }; /// MemInfo represents a single memory load from an address \p Addr at an \p /// Offset within a function. \p Count represents how many times a particular /// address was seen. struct MemInfo { … }; /// Helper class to store memory load events recorded in the address space of /// a given function, analogous to FuncBranchData but for memory load events /// instead of branches. struct FuncMemData { … }; /// Similar to BranchInfo, but instead of recording from-to address (an edge), /// it records the address of a perf event and the number of times samples hit /// this address. struct SampleInfo { … }; /// Helper class to store samples recorded in the address space of a given /// function, analogous to FuncBranchData but for samples instead of branches. struct FuncSampleData { … }; /// DataReader Class /// class DataReader : public ProfileReaderBase { … }; } // namespace bolt /// DenseMapInfo allows us to use the DenseMap LLVM data structure to store /// Locations template <> struct DenseMapInfo<bolt::Location> { … }; } // namespace llvm #endif