================ @@ -43,6 +43,57 @@ class YAMLProfileReader : public ProfileReaderBase { using ProfileLookupMap = DenseMap<uint32_t, yaml::bolt::BinaryFunctionProfile *>; + /// A class for matching binary functions in functions in the YAML profile. + /// First, a call graph is constructed for both profiled and binary functions. + /// Then functions are hashed based on the names of their callee/caller + /// functions. Finally, functions are matched based on these neighbor hashes. + class CallGraphMatcher { + public: + /// Constructs the call graphs for binary and profiled functions and + /// computes neighbor hashes for binary functions. + CallGraphMatcher(BinaryContext &BC, yaml::bolt::BinaryProfile &YamlBP, + ProfileLookupMap &IdToYAMLBF); + + /// Returns the YamlBFs adjacent to the parameter YamlBF in the call graph. + std::set<yaml::bolt::BinaryFunctionProfile *> * + getAdjacentYamlBFs(yaml::bolt::BinaryFunctionProfile &YamlBF) { + auto It = YamlBFAdjacencyMap.find(&YamlBF); + return It == YamlBFAdjacencyMap.end() ? nullptr : &It->second; + } + + /// Returns the binary functions with the parameter neighbor hash. + std::vector<BinaryFunction *> * ---------------- aaupov wrote:
Same here https://github.com/llvm/llvm-project/pull/98125 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits