32#define DEBUG_TYPE "insert-code-prefetch"
44 return "Code Prefetch Inserter Pass";
59char InsertCodePrefetch::ID = 0;
68 "BB Sections list not enabled!");
74 getAnalysis<BasicBlockSectionsProfileReaderWrapperPass>()
75 .getPrefetchTargetsForFunction(MF.getName());
77 for (
const auto &
Target : PrefetchTargets)
78 PrefetchTargetsByBBID[
Target.BBID].push_back(
Target.CallsiteIndex);
80 for (
auto &[K, V] : PrefetchTargetsByBBID) {
84 for (
auto &
MBB : MF) {
85 auto R = PrefetchTargetsByBBID.
find(*
MBB.getBBID());
86 if (R == PrefetchTargetsByBBID.
end())
88 MBB.setPrefetchTargetCallsiteIndexes(R->second);
93void InsertCodePrefetch::getAnalysisUsage(
AnalysisUsage &AU)
const {
95 AU.
addRequired<BasicBlockSectionsProfileReaderWrapperPass>();
100 return new InsertCodePrefetch();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
iterator find(const_arg_type_t< KeyT > Val)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
Target - Wrapper for Target specific information.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
auto unique(Range &&R, Predicate P)
LLVM_ABI void initializeInsertCodePrefetchPass(PassRegistry &)
void sort(IteratorTy Start, IteratorTy End)
bool hasInstrProfHashMismatch(MachineFunction &MF)
This checks if the source of this function has drifted since this binary was profiled previously.
LLVM_ABI MachineFunctionPass * createInsertCodePrefetchPass()