#include "llvm/ProfileData/SampleProf.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/PseudoProbe.h"
#include "llvm/ProfileData/SampleProfReader.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
#include <system_error>
usingnamespacellvm;
usingnamespacesampleprof;
static cl::opt<uint64_t> ProfileSymbolListCutOff(
"profile-symbol-list-cutoff", cl::Hidden, cl::init(-1),
cl::desc("Cutoff value about how many symbols in profile symbol list "
"will be used. This is very useful for performance debugging"));
static cl::opt<bool> GenerateMergedBaseProfiles(
"generate-merged-base-profiles",
cl::desc("When generating nested context-sensitive profiles, always "
"generate extra base profile for function with all its context "
"profiles merged into it."));
namespace llvm {
namespace sampleprof {
bool FunctionSamples::ProfileIsProbeBased = …;
bool FunctionSamples::ProfileIsCS = …;
bool FunctionSamples::ProfileIsPreInlined = …;
bool FunctionSamples::UseMD5 = …;
bool FunctionSamples::HasUniqSuffix = …;
bool FunctionSamples::ProfileIsFS = …;
}
}
namespace {
class SampleProfErrorCategoryType : public std::error_category { … };
}
const std::error_category &llvm::sampleprof_category() { … }
void LineLocation::print(raw_ostream &OS) const { … }
raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
const LineLocation &Loc) { … }
sampleprof_error SampleRecord::merge(const SampleRecord &Other,
uint64_t Weight) { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void LineLocation::dump() const { print(dbgs()); }
#endif
void SampleRecord::print(raw_ostream &OS, unsigned Indent) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void SampleRecord::dump() const { print(dbgs(), 0); }
#endif
raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
const SampleRecord &Sample) { … }
void FunctionSamples::print(raw_ostream &OS, unsigned Indent) const { … }
raw_ostream &llvm::sampleprof::operator<<(raw_ostream &OS,
const FunctionSamples &FS) { … }
void sampleprof::sortFuncProfiles(
const SampleProfileMap &ProfileMap,
std::vector<NameFunctionSamples> &SortedProfiles) { … }
unsigned FunctionSamples::getOffset(const DILocation *DIL) { … }
LineLocation FunctionSamples::getCallSiteIdentifier(const DILocation *DIL,
bool ProfileIsFS) { … }
const FunctionSamples *FunctionSamples::findFunctionSamples(
const DILocation *DIL, SampleProfileReaderItaniumRemapper *Remapper,
const HashKeyMap<std::unordered_map, FunctionId, FunctionId>
*FuncNameToProfNameMap) const { … }
void FunctionSamples::findAllNames(DenseSet<FunctionId> &NameSet) const { … }
const FunctionSamples *FunctionSamples::findFunctionSamplesAt(
const LineLocation &Loc, StringRef CalleeName,
SampleProfileReaderItaniumRemapper *Remapper,
const HashKeyMap<std::unordered_map, FunctionId, FunctionId>
*FuncNameToProfNameMap) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void FunctionSamples::dump() const { print(dbgs(), 0); }
#endif
std::error_code ProfileSymbolList::read(const uint8_t *Data,
uint64_t ListSize) { … }
void SampleContextTrimmer::trimAndMergeColdContextProfiles(
uint64_t ColdCountThreshold, bool TrimColdContext, bool MergeColdContext,
uint32_t ColdContextFrameLength, bool TrimBaseProfileOnly) { … }
std::error_code ProfileSymbolList::write(raw_ostream &OS) { … }
void ProfileSymbolList::dump(raw_ostream &OS) const { … }
ProfileConverter::FrameNode *
ProfileConverter::FrameNode::getOrCreateChildFrame(const LineLocation &CallSite,
FunctionId CalleeName) { … }
ProfileConverter::ProfileConverter(SampleProfileMap &Profiles)
: … { … }
ProfileConverter::FrameNode *
ProfileConverter::getOrCreateContextPath(const SampleContext &Context) { … }
void ProfileConverter::convertCSProfiles(ProfileConverter::FrameNode &Node) { … }
void ProfileConverter::convertCSProfiles() { … }