9#ifndef LLVM_ANALYSIS_CTXPROFANALYSIS_H
10#define LLVM_ANALYSIS_CTXPROFANALYSIS_H
28 const std::string Name;
30 FunctionInfo(
StringRef Name) : Name(Name) {}
32 std::optional<PGOCtxProfContext::CallTargetMapTy> Profiles;
35 DenseMap<GlobalValue::GUID, FunctionInfo> FuncInfo;
42 PGOContextualProfile() =
default;
48 operator bool()
const {
return Profiles.has_value(); }
55 return getDefinedFunctionGUID(
F) != 0;
60 return FuncInfo.find(getDefinedFunctionGUID(
F))->second.NextCounterIndex++;
65 return FuncInfo.find(getDefinedFunctionGUID(
F))->second.NextCallsiteIndex++;
73 return !PAC.preservedWhenStateless();
Reader for contextual iFDO profile, which comes in bitstream format.
ModuleAnalysisManager MAM
This header defines various interfaces for pass management in LLVM.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
Assign a GUID to functions as metadata.
static uint64_t getGUID(const Function &F)
static const char * GUIDMetadataName
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
Assign a GUID if one is not already assign, as a function metadata named GUIDMetadataName.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
CtxProfAnalysisPrinterPass(raw_ostream &OS)
PGOContextualProfile run(Module &M, ModuleAnalysisManager &MAM)
static InstrProfCallsite * getCallsiteInstrumentation(CallBase &CB)
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
This represents the llvm.instrprof.callsite intrinsic.
A Module instance is used to store all the information related to an LLVM module.
The instrumented contextual profile, produced by the CtxProfAnalysis.
PGOContextualProfile(PGOContextualProfile &&)=default
const PGOCtxProfContext::CallTargetMapTy & profiles() const
bool invalidate(Module &, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)
uint32_t allocateNextCounterIndex(const Function &F)
PGOContextualProfile(const PGOContextualProfile &)=delete
uint32_t allocateNextCallsiteIndex(const Function &F)
bool isFunctionKnown(const Function &F) const
std::map< GlobalValue::GUID, PGOCtxProfContext > CallTargetMapTy
A set of analyses that are preserved following a run of a transformation pass.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A CRTP mix-in to automatically provide informational APIs needed for passes.