diff options
author | Amir Ayupov <aaupov@fb.com> | 2023-01-20 19:27:38 -0800 |
---|---|---|
committer | Amir Ayupov <aaupov@fb.com> | 2023-01-20 19:52:14 -0800 |
commit | dbb7316e029b154d8fff0c8cf31212f07d7b7c8d (patch) | |
tree | 3a0ce24a9097a01a030ff1cd92922dfbe771b9f2 /bolt/include | |
parent | 255c3f11592bf320770108dc700aed47e57419f7 (diff) | |
download | llvm-dbb7316e029b154d8fff0c8cf31212f07d7b7c8d.tar.gz |
[BOLT][NFC] Move getLTOCommonName to Utils
Reuse getLTOCommonName in components other than Profile (to be used in Core)
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D142259
Diffstat (limited to 'bolt/include')
-rw-r--r-- | bolt/include/bolt/Profile/ProfileReaderBase.h | 26 | ||||
-rw-r--r-- | bolt/include/bolt/Utils/Utils.h | 26 |
2 files changed, 26 insertions, 26 deletions
diff --git a/bolt/include/bolt/Profile/ProfileReaderBase.h b/bolt/include/bolt/Profile/ProfileReaderBase.h index 7061d8ee219c..511718f3c0ec 100644 --- a/bolt/include/bolt/Profile/ProfileReaderBase.h +++ b/bolt/include/bolt/Profile/ProfileReaderBase.h @@ -23,32 +23,6 @@ class BinaryContext; class BinaryFunction; class BoltAddressTranslation; -/// LTO-generated function names take a form: -/// -/// <function_name>.lto_priv.<decimal_number>/... -/// or -/// <function_name>.constprop.<decimal_number>/... -/// -/// they can also be: -/// -/// <function_name>.lto_priv.<decimal_number1>.lto_priv.<decimal_number2>/... -/// -/// The <decimal_number> is a global counter used for the whole program. As a -/// result, a tiny change in a program may affect the naming of many LTO -/// functions. For us this means that if we do a precise name matching, then -/// a large set of functions could be left without a profile. -/// -/// To solve this issue, we try to match a function to any profile: -/// -/// <function_name>.(lto_priv|consprop).* -/// -/// The name before an asterisk above represents a common LTO name for a family -/// of functions. Later, out of all matching profiles we pick the one with the -/// best match. -/// -/// Return a common part of LTO name for a given \p Name. -std::optional<StringRef> getLTOCommonName(const StringRef Name); - class ProfileReaderBase { protected: /// Name of the file with profile. diff --git a/bolt/include/bolt/Utils/Utils.h b/bolt/include/bolt/Utils/Utils.h index 77ab11bab662..3886c5f8757c 100644 --- a/bolt/include/bolt/Utils/Utils.h +++ b/bolt/include/bolt/Utils/Utils.h @@ -41,6 +41,32 @@ std::string getEscapedName(const StringRef &Name); /// Return the unescaped name std::string getUnescapedName(const StringRef &Name); +/// LTO-generated function names take a form: +/// +/// <function_name>.lto_priv.<decimal_number>/... +/// or +/// <function_name>.constprop.<decimal_number>/... +/// +/// they can also be: +/// +/// <function_name>.lto_priv.<decimal_number1>.lto_priv.<decimal_number2>/... +/// +/// The <decimal_number> is a global counter used for the whole program. As a +/// result, a tiny change in a program may affect the naming of many LTO +/// functions. For us this means that if we do a precise name matching, then +/// a large set of functions could be left without a profile. +/// +/// To solve this issue, we try to match a function to any profile: +/// +/// <function_name>.(lto_priv|consprop).* +/// +/// The name before an asterisk above represents a common LTO name for a family +/// of functions. Later, out of all matching profiles we pick the one with the +/// best match. +/// +/// Return a common part of LTO name for a given \p Name. +std::optional<StringRef> getLTOCommonName(const StringRef Name); + // Determines which register a given DWARF expression is being assigned to. // If the expression is defining the CFA, return std::nullopt. std::optional<uint8_t> readDWARFExpressionTargetReg(StringRef ExprBytes); |