9#ifndef LLVM_ANALYSIS_CTXPROFANALYSIS_H
10#define LLVM_ANALYSIS_CTXPROFANALYSIS_H
36 const std::string Name;
38 FunctionInfo(
StringRef Name) : Name(Name) {}
40 std::optional<PGOCtxProfContext::CallTargetMapTy> Profiles;
43 DenseMap<GlobalValue::GUID, FunctionInfo> FuncInfo;
50 PGOContextualProfile() =
default;
56 operator bool()
const {
return Profiles.has_value(); }
63 return getDefinedFunctionGUID(
F) != 0;
68 return FuncInfo.find(getDefinedFunctionGUID(
F))->second.NextCounterIndex++;
73 return FuncInfo.find(getDefinedFunctionGUID(
F))->second.NextCallsiteIndex++;
83 return !PAC.preservedWhenStateless();
This file defines the DenseMap class.
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.
LLVM Basic Block Representation.
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 InstrProfIncrementInst * getBBInstrumentation(BasicBlock &BB)
Get the instruction instrumenting a BB, or nullptr if not present.
static InstrProfCallsite * getCallsiteInstrumentation(CallBase &CB)
Get the instruction instrumenting a callsite, or nullptr if that cannot be found.
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
This represents the llvm.instrprof.callsite intrinsic.
This represents the llvm.instrprof.increment 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 CtxProfFlatProfile flatten() const
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.