diff options
author | Mingming Liu <mingmingl@google.com> | 2023-11-09 10:47:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 10:47:44 -0800 |
commit | bb642f8b941293b24ccd7895358f08abc63a9051 (patch) | |
tree | e8f68adbc60dc73f5e1194c2b1ba3e795ab16b4c /llvm/include | |
parent | 90a9e9f638073f46a36e0fda44948bc74da5f641 (diff) | |
download | llvm-bb642f8b941293b24ccd7895358f08abc63a9051.zip llvm-bb642f8b941293b24ccd7895358f08abc63a9051.tar.gz llvm-bb642f8b941293b24ccd7895358f08abc63a9051.tar.bz2 |
[NFC][InstrProf]Refactor readPGOFuncNameStrings (#71566)
Refactor this function to take a callback for each decoded string, rename it and change it to a static function in cpp. Move its (sole) caller definition from header to cpp.
- This is a split of patch https://github.com/llvm/llvm-project/pull/66825; to minimize the diff created in a big PR.
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/ProfileData/InstrProf.h | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index 6b9d375..3bc677d 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -242,11 +242,6 @@ Error collectGlobalObjectNameStrings(ArrayRef<std::string> NameStrs, Error collectPGOFuncNameStrings(ArrayRef<GlobalVariable *> NameVars, std::string &Result, bool doCompression = true); -/// \c NameStrings is a string composed of one of more sub-strings encoded in -/// the format described above. The substrings are separated by 0 or more zero -/// bytes. This method decodes the string and populates the \c Symtab. -Error readPGOFuncNameStrings(StringRef NameStrings, InstrProfSymtab &Symtab); - /// Check if INSTR_PROF_RAW_VERSION_VAR is defined. This global is only being /// set in IR PGO compilation. bool isIRPGOFlagSet(const Module *M); @@ -469,14 +464,14 @@ public: /// until before it is used. See also \c create(StringRef) method. Error create(object::SectionRef &Section); - /// This interface is used by reader of CoverageMapping test - /// format. - inline Error create(StringRef D, uint64_t BaseAddr); - /// \c NameStrings is a string composed of one of more sub-strings /// encoded in the format described in \c collectPGOFuncNameStrings. /// This method is a wrapper to \c readPGOFuncNameStrings method. - inline Error create(StringRef NameStrings); + Error create(StringRef NameStrings); + + /// This interface is used by reader of CoverageMapping test + /// format. + inline Error create(StringRef D, uint64_t BaseAddr); /// A wrapper interface to populate the PGO symtab with functions /// decls from module \c M. This interface is used by transformation @@ -547,10 +542,6 @@ Error InstrProfSymtab::create(StringRef D, uint64_t BaseAddr) { return Error::success(); } -Error InstrProfSymtab::create(StringRef NameStrings) { - return readPGOFuncNameStrings(NameStrings, *this); -} - template <typename NameIterRange> Error InstrProfSymtab::create(const NameIterRange &IterRange) { for (auto Name : IterRange) |