17#ifndef LLVM_PROFILEDATA_DATAACCESSPROF_H_
18#define LLVM_PROFILEDATA_DATAACCESSPROF_H_
110 if (std::holds_alternative<StringRef>(SymHandleRef)) {
111 SymHandle = std::get<StringRef>(SymHandleRef).str();
113 SymHandle = std::get<uint64_t>(SymHandleRef);
115 for (
auto Loc : LocRefs)
116 Locations.emplace_back(Loc.FileName, Loc.Line);
150 LLVM_ABI std::optional<DataAccessProfRecord>
180 return Records.getArrayRef();
183 return KnownColdSymbols.getArrayRef();
189 return Records.empty() && KnownColdSymbols.empty() &&
190 KnownColdHashes.
empty();
199 Error deserializeSymbolsAndFilenames(
const unsigned char *&
Ptr,
201 const uint64_t NumColdKnownSymbols);
205 Error deserializeRecords(
const unsigned char *&
Ptr);
This file defines the BumpPtrAllocator interface.
This file defines DenseMapInfo traits for DenseMap<std::variant<Ts...>>.
This file implements a map that provides insertion order iteration.
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Allocate memory in an ever growing pool, as if by bump-pointer.
Lightweight error class with error context and mandatory checking.
typename VectorType::value_type value_type
ArrayRef< value_type > getArrayRef() const
Returns an array reference of the underlying vector.
A vector that has set insertion semantics.
ArrayRef< value_type > getArrayRef() const
bool empty() const
Determine if the SetVector is empty or not.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Encapsulates the data access profile data and the methods to operate on it.
LLVM_ABI Error addKnownSymbolWithoutSamples(SymbolHandleRef SymbolID)
Add a symbol that's seen in the profiled binary without samples.
ArrayRef< StringToIndexMap::value_type > getStrToIndexMapRef() const
The following methods return array reference for various internal data structures.
LLVM_ABI Error serialize(ProfOStream &OS) const
Serialize profile data to the output stream.
LLVM_ABI std::optional< DataAccessProfRecord > getProfileRecord(const SymbolHandleRef SymID) const
Returns a profile record for SymbolID, or std::nullopt if there isn't a record.
ArrayRef< MapVector< SymbolHandleRef, internal::DataAccessProfRecordRef >::value_type > getRecords() const
LLVM_ABI Error deserialize(const unsigned char *&Ptr)
Deserialize this class from the given buffer.
ArrayRef< StringRef > getKnownColdSymbols() const
LLVM_ABI bool isKnownColdSymbol(const SymbolHandleRef SymID) const
Returns true if SymID is seen in profiled binaries and cold.
LLVM_ABI Error setDataAccessProfile(SymbolHandleRef SymbolID, uint64_t AccessCount)
Methods to set symbolized data access profile.
ArrayRef< uint64_t > getKnownColdHashes() const
llvm::MapVector< StringRef, uint64_t > StringToIndexMap
std::variant< StringRef, uint64_t > SymbolHandleRef
std::variant< std::string, uint64_t > SymbolHandle
This is an optimization pass for GlobalISel generic memory operations.
The data access profiles for a symbol.
DataAccessProfRecord(SymbolHandleRef SymHandleRef, uint64_t AccessCount, ArrayRef< internal::SourceLocationRef > LocRefs)
SmallVector< SourceLocation > Locations
DataAccessProfRecord()=default
The location of data in the source code. Used by profile lookup API.
uint32_t Line
The line number in the source code.
SourceLocation(StringRef FileNameRef, uint32_t Line)
std::string FileName
The filename where the data is located.
llvm::SmallVector< SourceLocationRef, 0 > Locations
DataAccessProfRecordRef(uint64_t SymbolID, uint64_t AccessCount, bool IsStringLiteral)
SourceLocationRef(StringRef FileNameRef, uint32_t Line)