#include "bolt/Profile/YAMLProfileReader.h"
#include "bolt/Core/BinaryBasicBlock.h"
#include "bolt/Core/BinaryFunction.h"
#include "bolt/Passes/MCF.h"
#include "bolt/Profile/ProfileYAMLMapping.h"
#include "bolt/Utils/NameResolver.h"
#include "bolt/Utils/Utils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/edit_distance.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Support/CommandLine.h"
usingnamespacellvm;
namespace opts {
extern cl::opt<unsigned> Verbosity;
extern cl::OptionCategory BoltOptCategory;
extern cl::opt<bool> InferStaleProfile;
extern cl::opt<bool> Lite;
cl::opt<unsigned> NameSimilarityFunctionMatchingThreshold(
"name-similarity-function-matching-threshold",
cl::desc("Match functions using namespace and edit distance"), cl::init(0),
cl::Hidden, cl::cat(BoltOptCategory));
static llvm::cl::opt<bool>
IgnoreHash("profile-ignore-hash",
cl::desc("ignore hash while reading function profile"),
cl::Hidden, cl::cat(BoltOptCategory));
llvm::cl::opt<bool>
MatchProfileWithFunctionHash("match-profile-with-function-hash",
cl::desc("Match profile with function hash"),
cl::Hidden, cl::cat(BoltOptCategory));
llvm::cl::opt<bool>
MatchWithCallGraph("match-with-call-graph",
cl::desc("Match functions with call graph"), cl::Hidden,
cl::cat(BoltOptCategory));
llvm::cl::opt<bool> ProfileUseDFS("profile-use-dfs",
cl::desc("use DFS order for YAML profile"),
cl::Hidden, cl::cat(BoltOptCategory));
}
namespace llvm {
namespace bolt {
YAMLProfileReader::CallGraphMatcher::CallGraphMatcher(
BinaryContext &BC, yaml::bolt::BinaryProfile &YamlBP,
ProfileLookupMap &IdToYAMLBF) { … }
void YAMLProfileReader::CallGraphMatcher::constructBFCG(
BinaryContext &BC, yaml::bolt::BinaryProfile &YamlBP) { … }
void YAMLProfileReader::CallGraphMatcher::computeBFNeighborHashes(
BinaryContext &BC) { … }
void YAMLProfileReader::CallGraphMatcher::constructYAMLFCG(
yaml::bolt::BinaryProfile &YamlBP, ProfileLookupMap &IdToYAMLBF) { … }
bool YAMLProfileReader::isYAML(const StringRef Filename) { … }
void YAMLProfileReader::buildNameMaps(BinaryContext &BC) { … }
bool YAMLProfileReader::hasLocalsWithFileName() const { … }
bool YAMLProfileReader::parseFunctionProfile(
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) { … }
Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) { … }
bool YAMLProfileReader::profileMatches(
const yaml::bolt::BinaryFunctionProfile &Profile, const BinaryFunction &BF) { … }
bool YAMLProfileReader::mayHaveProfileData(const BinaryFunction &BF) { … }
size_t YAMLProfileReader::matchWithExactName() { … }
size_t YAMLProfileReader::matchWithHash(BinaryContext &BC) { … }
size_t YAMLProfileReader::matchWithLTOCommonName() { … }
size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { … }
size_t YAMLProfileReader::matchWithNameSimilarity(BinaryContext &BC) { … }
Error YAMLProfileReader::readProfile(BinaryContext &BC) { … }
bool YAMLProfileReader::usesEvent(StringRef Name) const { … }
}
}