15#ifndef LLVM_PROFILEDATA_CTXINSTRPROFILEREADER_H
16#define LLVM_PROFILEDATA_CTXINSTRPROFILEREADER_H
25class PGOContextualProfile;
26class PGOCtxProfContext;
43 friend class ::llvm::PGOCtxProfContext;
44 friend class ::llvm::PGOContextualProfile;
51 Next->Previous = Previous;
53 Previous->Next = Next;
61 Previous =
Other.Previous;
65 Other.Next->Previous =
this;
67 Other.Previous->Next =
this;
71 Other.Previous =
nullptr;
73 IndexNode() =
default;
120 "Functions are expected to have at their entry BB instrumented, so "
121 "there should always be at least 1 counter.");
136 "CSId was expected to be newly created as result of e.g. inlining");
142 return Callsites.find(
I) != Callsites.end();
147 return Callsites.find(
I)->second;
152 return Callsites.find(
I)->second;
158 template <
class TSetOfGUIDs>
161 for (
const auto &[
_, Callsite] : Callsites)
162 for (
const auto &[
_, Callee] : Callsite)
163 Callee.getContainedGuids(Guids);
171 Error readMetadata();
176 readContext(
bool ExpectIndex);
177 bool canReadContext();
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static StringRef substr(StringRef Str, uint64_t Len)
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
The instrumented contextual profile, produced by the CtxProfAnalysis.
A node (context) in the loaded contextual profile, suitable for mutation during IPO passes.
CallTargetMapTy & callsite(uint32_t I)
SmallVectorImpl< uint64_t > & counters()
bool hasCallsite(uint32_t I) const
void resizeCounters(uint32_t Size)
GlobalValue::GUID guid() const
void ingestAllContexts(uint32_t CSId, CallTargetMapTy &&Other)
void getContainedGuids(TSetOfGUIDs &Guids) const
Insert this node's GUID as well as the GUIDs of the transitive closure of child nodes,...
PGOCtxProfContext & operator=(const PGOCtxProfContext &)=delete
const CallTargetMapTy & callsite(uint32_t I) const
PGOCtxProfContext & operator=(PGOCtxProfContext &&)=delete
uint64_t getEntrycount() const
const SmallVectorImpl< uint64_t > & counters() const
std::map< uint32_t, CallTargetMapTy > CallsiteMapTy
void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other)
CallsiteMapTy & callsites()
PGOCtxProfContext(const PGOCtxProfContext &)=delete
PGOCtxProfContext(PGOCtxProfContext &&)=default
std::map< GlobalValue::GUID, PGOCtxProfContext > CallTargetMapTy
const CallsiteMapTy & callsites() const
Expected< std::map< GlobalValue::GUID, PGOCtxProfContext > > loadContexts()
PGOCtxProfileReader(StringRef Buffer)
Write one or more ContextNodes to the provided raw_fd_stream.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
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.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.