Go to the documentation of this file.
15 #ifndef LLVM_TRANSFORMS_IPO_SAMPLECONTEXTTRACKER_H
16 #define LLVM_TRANSFORMS_IPO_SAMPLECONTEXTTRACKER_H
39 : ParentContext(Parent), FuncName(FName), FuncSamples(FSamples),
40 CallSiteLoc(CallLoc){};
46 bool AllowCreate =
true);
51 bool DeleteNode =
true);
67 std::map<uint64_t, ContextTrieNode> AllChildContext;
76 FunctionSamples *FuncSamples;
79 Optional<uint32_t> FuncSize;
82 LineLocation CallSiteLoc;
98 if (A->getTotalSamples() ==
B->getTotalSamples())
99 return A->getContext() <
B->getContext();
100 return A->getTotalSamples() >
B->getTotalSamples();
115 std::vector<const FunctionSamples *>
128 bool MergeContext =
true);
172 #endif // LLVM_TRANSFORMS_IPO_SAMPLECONTEXTTRACKER_H
FunctionSamples * getCalleeContextSamplesFor(const CallBase &Inst, StringRef CalleeName)
This is an optimization pass for GlobalISel generic memory operations.
StringRef getFuncNameFor(ContextTrieNode *Node) const
StringRef getFuncName() const
void setParentContext(ContextTrieNode *Parent)
std::unordered_map< SampleContext, FunctionSamples, SampleContext::Hash > SampleProfileMap
void markContextSamplesInlined(const FunctionSamples *InlinedSamples)
ContextTrieNode * getContextFor(const SampleContext &Context)
ContextTrieNode * getHottestChildContext(const LineLocation &CallSite)
LineLocation getCallSiteLoc() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void setFunctionSamples(FunctionSamples *FSamples)
std::set< FunctionSamples *, ProfileComparer > ContextSamplesTy
ContextTrieNode(ContextTrieNode *Parent=nullptr, StringRef FName=StringRef(), FunctionSamples *FSamples=nullptr, LineLocation CallLoc={0, 0})
ContextTrieNode * getParentContext() const
ContextTrieNode & moveToChildContext(const LineLocation &CallSite, ContextTrieNode &&NodeToMove, uint32_t ContextFramesToRemove, bool DeleteNode=true)
Representation of the samples collected for a function.
SampleContextTracker(SampleProfileMap &Profiles, const DenseMap< uint64_t, StringRef > *GUIDToFuncNameMap)
void promoteMergeContextSamplesTree(const Instruction &Inst, StringRef CalleeName)
Represents the relative location of an instruction.
ContextSamplesTy & getAllContextSamplesFor(const Function &Func)
ContextTrieNode * getChildContext(const LineLocation &CallSite, StringRef ChildName)
std::map< uint64_t, ContextTrieNode > & getAllChildContext()
ContextTrieNode * getOrCreateChildContext(const LineLocation &CallSite, StringRef ChildName, bool AllowCreate=true)
StringRef - Represent a constant reference to a string, i.e.
FunctionSamples * getFunctionSamples() const
Optional< uint32_t > getFunctionSize() const
ContextTrieNode & getRootContext()
FunctionSamples * getBaseSamplesFor(const Function &Func, bool MergeContext=true)
void addFunctionSize(uint32_t FSize)
FunctionSamples * getContextSamplesFor(const DILocation *DIL)
void removeChildContext(const LineLocation &CallSite, StringRef ChildName)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
bool operator()(FunctionSamples *A, FunctionSamples *B) const
std::vector< const FunctionSamples * > getIndirectCalleeContextSamplesFor(const DILocation *DIL)