llvm/bolt/lib/Profile/DataReader.cpp

//===- bolt/Profile/DataReader.cpp - Perf data reader ---------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//

#include "bolt/Profile/DataReader.h"
#include "bolt/Core/BinaryFunction.h"
#include "bolt/Passes/MCF.h"
#include "bolt/Utils/Utils.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Errc.h"

#undef  DEBUG_TYPE
#define DEBUG_TYPE

usingnamespacellvm;

namespace opts {

extern cl::OptionCategory BoltCategory;
extern llvm::cl::opt<unsigned> Verbosity;

static cl::opt<bool>
DumpData("dump-data",
  cl::desc("dump parsed bolt data for debugging"),
  cl::Hidden,
  cl::cat(BoltCategory));

} // namespace opts

namespace llvm {
namespace bolt {

namespace {

/// Return true if the function name can change across compilations.
bool hasVolatileName(const BinaryFunction &BF) {}

/// Return standard escaped name of the function possibly renamed by BOLT.
std::string normalizeName(StringRef NameRef) {}

} // anonymous namespace

raw_ostream &operator<<(raw_ostream &OS, const Location &Loc) {}

void FuncBranchData::appendFrom(const FuncBranchData &FBD, uint64_t Offset) {}

uint64_t FuncBranchData::getNumExecutedBranches() const {}

void SampleInfo::mergeWith(const SampleInfo &SI) {}

void SampleInfo::print(raw_ostream &OS) const {}

uint64_t FuncSampleData::getSamples(uint64_t Start, uint64_t End) const {}

void FuncSampleData::bumpCount(uint64_t Offset, uint64_t Count) {}

void FuncBranchData::bumpBranchCount(uint64_t OffsetFrom, uint64_t OffsetTo,
                                     uint64_t Count, uint64_t Mispreds) {}

void FuncBranchData::bumpCallCount(uint64_t OffsetFrom, const Location &To,
                                   uint64_t Count, uint64_t Mispreds) {}

void FuncBranchData::bumpEntryCount(const Location &From, uint64_t OffsetTo,
                                    uint64_t Count, uint64_t Mispreds) {}

void BranchInfo::mergeWith(const BranchInfo &BI) {}

void BranchInfo::print(raw_ostream &OS) const {}

ErrorOr<const BranchInfo &> FuncBranchData::getBranch(uint64_t From,
                                                      uint64_t To) const {}

ErrorOr<const BranchInfo &>
FuncBranchData::getDirectCallBranch(uint64_t From) const {}

void MemInfo::print(raw_ostream &OS) const {}

void MemInfo::prettyPrint(raw_ostream &OS) const {}

void FuncMemData::update(const Location &Offset, const Location &Addr) {}

Error DataReader::preprocessProfile(BinaryContext &BC) {}

Error DataReader::readProfilePreCFG(BinaryContext &BC) {}

Error DataReader::readProfile(BinaryContext &BC) {}

std::error_code DataReader::parseInput() {}

void DataReader::readProfile(BinaryFunction &BF) {}

void DataReader::matchProfileData(BinaryFunction &BF) {}

void DataReader::matchProfileMemData(BinaryFunction &BF) {}

bool DataReader::fetchProfileForOtherEntryPoints(BinaryFunction &BF) {}

float DataReader::evaluateProfileData(BinaryFunction &BF,
                                      const FuncBranchData &BranchData) const {}

void DataReader::readSampleData(BinaryFunction &BF) {}

void DataReader::convertBranchData(BinaryFunction &BF) const {}

bool DataReader::recordBranch(BinaryFunction &BF, uint64_t From, uint64_t To,
                              uint64_t Count, uint64_t Mispreds) const {}

void DataReader::reportError(StringRef ErrorMsg) {}

bool DataReader::expectAndConsumeFS() {}

void DataReader::consumeAllRemainingFS() {}

bool DataReader::checkAndConsumeNewLine() {}

ErrorOr<StringRef> DataReader::parseString(char EndChar, bool EndNl) {}

ErrorOr<int64_t> DataReader::parseNumberField(char EndChar, bool EndNl) {}

ErrorOr<uint64_t> DataReader::parseHexField(char EndChar, bool EndNl) {}

ErrorOr<Location> DataReader::parseLocation(char EndChar, bool EndNl,
                                            bool ExpectMemLoc) {}

ErrorOr<BranchInfo> DataReader::parseBranchInfo() {}

ErrorOr<MemInfo> DataReader::parseMemInfo() {}

ErrorOr<SampleInfo> DataReader::parseSampleInfo() {}

ErrorOr<bool> DataReader::maybeParseNoLBRFlag() {}

ErrorOr<bool> DataReader::maybeParseBATFlag() {}

bool DataReader::hasBranchData() {}

bool DataReader::hasMemData() {}

std::error_code DataReader::parseInNoLBRMode() {}

std::error_code DataReader::parse() {}

void DataReader::buildLTONameMaps() {}

template <typename MapTy>
static typename MapTy::mapped_type *
fetchMapEntry(MapTy &Map, const std::vector<MCSymbol *> &Symbols) {}

template <typename MapTy>
static typename MapTy::mapped_type *
fetchMapEntry(MapTy &Map, const std::vector<StringRef> &FuncNames) {}

template <typename MapTy>
static std::vector<typename MapTy::mapped_type *>
fetchMapEntriesRegex(MapTy &Map,
                     const StringMap<std::vector<typename MapTy::mapped_type *>>
                         &LTOCommonNameMap,
                     const std::vector<StringRef> &FuncNames) {}

bool DataReader::mayHaveProfileData(const BinaryFunction &Function) {}

FuncBranchData *
DataReader::getBranchDataForNames(const std::vector<StringRef> &FuncNames) {}

FuncBranchData *
DataReader::getBranchDataForSymbols(const std::vector<MCSymbol *> &Symbols) {}

FuncMemData *
DataReader::getMemDataForNames(const std::vector<StringRef> &FuncNames) {}

FuncSampleData *
DataReader::getFuncSampleData(const std::vector<StringRef> &FuncNames) {}

std::vector<FuncBranchData *> DataReader::getBranchDataForNamesRegex(
    const std::vector<StringRef> &FuncNames) {}

std::vector<FuncMemData *>
DataReader::getMemDataForNamesRegex(const std::vector<StringRef> &FuncNames) {}

bool DataReader::hasLocalsWithFileName() const {}

void DataReader::dump() const {}

} // namespace bolt
} // namespace llvm