15#ifndef LLVM_TRANSFORMS_IPO_SAMPLEPROFILEPROBE_H
16#define LLVM_TRANSFORMS_IPO_SAMPLEPROFILEPROBE_H
22#include <unordered_map>
30class PassInstrumentationCallbacks;
35using namespace sampleprof;
36using BlockIdMap = std::unordered_map<BasicBlock *, uint32_t>;
40using ProbeFactorMap = std::unordered_map<std::pair<uint64_t, uint64_t>, float,
50 : FunctionGUID(GUID), FunctionHash(Hash) {}
68 constexpr static float DistributionFactorVariance = 0.02f;
77 bool shouldVerifyFunction(
const Function *
F);
78 void verifyProbeFactors(
const Function *
F,
106 Function *getFunction()
const {
return F; }
107 uint64_t getFunctionHash()
const {
return FunctionHash; }
110 void computeCFGHash();
111 void computeProbeIdForBlocks();
112 void computeProbeIdForCallsites();
118 std::string CurModuleUniqueId;
This file defines the DenseMap class.
Implements a lazy call graph analysis and related passes for the new pass manager.
Statically lint checks LLVM IR
Machine Check Debug Module
FunctionAnalysisManager FAM
const char LLVMTargetMachineRef TM
PassInstrumentationCallbacks PIC
This header defines various interfaces for pass management in LLVM.
A container for analyses that lazily runs them and caches their results.
LLVM Basic Block Representation.
An SCC of the call graph.
Represents a single loop in the control flow graph.
A Module instance is used to store all the information related to an LLVM module.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
A set of analyses that are preserved following a run of a transformation pass.
PseudoProbeDescriptor(uint64_t GUID, uint64_t Hash)
uint64_t getFunctionGUID() const
uint64_t getFunctionHash() const
bool profileIsValid(const Function &F, const FunctionSamples &Samples) const
bool moduleIsProbed(const Module &M) const
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
PseudoProbeUpdatePass()=default
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void runAfterPass(StringRef PassID, Any IR)
SampleProfileProbePass(TargetMachine *TM)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Sample profile pseudo prober.
void instrumentOneFunc(Function &F, TargetMachine *TM)
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
Representation of the samples collected for a function.
@ C
The default llvm calling convention, compatible with C.
@ BasicBlock
Various leaf nodes.
This is an optimization pass for GlobalISel generic memory operations.
std::unordered_map< BasicBlock *, uint32_t > BlockIdMap
std::unordered_map< Instruction *, uint32_t > InstructionIdMap
std::unordered_map< std::pair< uint64_t, uint64_t >, float, pair_hash< uint64_t, uint64_t > > ProbeFactorMap
A CRTP mix-in to automatically provide informational APIs needed for passes.