1- // ===-- InsertCodePrefetch.cpp ---=========-----------------------------===//
1+ // ===-- InsertCodePrefetch.cpp ---=========-------------------------------- ===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
77// ===----------------------------------------------------------------------===//
88//
99// / \file
10- // / Prefetch insertion pass implementation .
10+ // / Code Prefetch Insertion Pass .
1111// ===----------------------------------------------------------------------===//
12- // / Prefetch insertion pass.
12+ // / This pass inserts code prefetch instructions according to the prefetch
13+ // / directives in the basic block section profile. The target of a prefetch can
14+ // / be the beginning of any dynamic basic block, that is the beginning of a
15+ // / machine basic block, or immediately after a callsite. A global symbol will
16+ // / be emitted at the position of the target so it can be addressed from the
17+ // / prefetch instruction.
1318// ===----------------------------------------------------------------------===//
1419
1520#include " llvm/ADT/SmallVector.h"
2025#include " llvm/CodeGen/MachineBasicBlock.h"
2126#include " llvm/CodeGen/MachineFunction.h"
2227#include " llvm/CodeGen/MachineFunctionPass.h"
23- #include " llvm/CodeGen/MachineOperand.h"
2428#include " llvm/CodeGen/Passes.h"
25- #include " llvm/CodeGen/TargetInstrInfo.h"
2629#include " llvm/InitializePasses.h"
27- #include " llvm/MC/MCContext.h"
28- #include " llvm/Target/TargetMachine.h"
2930
3031using namespace llvm ;
31- #define DEBUG_TYPE " prefetchinsertion "
32+ #define DEBUG_TYPE " insert-code-prefetch "
3233
3334namespace {
3435class InsertCodePrefetch : public MachineFunctionPass {
@@ -40,13 +41,12 @@ class InsertCodePrefetch : public MachineFunctionPass {
4041 }
4142
4243 StringRef getPassName () const override {
43- return " X86 Cide Prefetch Inserter Pass" ;
44+ return " Code Prefetch Inserter Pass" ;
4445 }
4546
4647 void getAnalysisUsage (AnalysisUsage &AU) const override ;
4748
48- // / Identify basic blocks that need separate sections and prepare to emit them
49- // / accordingly.
49+ // Sets prefetch targets based on the bb section profile.
5050 bool runOnMachineFunction (MachineFunction &MF) override ;
5151};
5252
@@ -57,10 +57,10 @@ class InsertCodePrefetch : public MachineFunctionPass {
5757// ===----------------------------------------------------------------------===//
5858
5959char InsertCodePrefetch::ID = 0 ;
60- INITIALIZE_PASS_BEGIN (InsertCodePrefetch, DEBUG_TYPE, " Reads prefetch" , true ,
60+ INITIALIZE_PASS_BEGIN (InsertCodePrefetch, DEBUG_TYPE, " Code prefetch insertion " , true ,
6161 false )
6262INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReaderWrapperPass)
63- INITIALIZE_PASS_END(InsertCodePrefetch, DEBUG_TYPE, " Reads prefetch" , true ,
63+ INITIALIZE_PASS_END(InsertCodePrefetch, DEBUG_TYPE, " Code prefetch insertion " , true ,
6464 false )
6565
6666bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
0 commit comments