#include "X86.h"
#include "X86InstrBuilder.h"
#include "X86InstrInfo.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/ProfileData/SampleProf.h"
#include "llvm/ProfileData/SampleProfReader.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/IPO/SampleProfile.h"
#include <optional>
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<bool> EnableDiscriminateMemops(
DEBUG_TYPE, cl::init(false),
cl::desc("Generate unique debug info for each instruction with a memory "
"operand. Should be enabled for profile-driven cache prefetching, "
"both in the build of the binary being profiled, as well as in "
"the build of the binary consuming the profile."),
cl::Hidden);
static cl::opt<bool> BypassPrefetchInstructions(
"x86-bypass-prefetch-instructions", cl::init(true),
cl::desc("When discriminating instructions with memory operands, ignore "
"prefetch instructions. This ensures the other memory operand "
"instructions have the same identifiers after inserting "
"prefetches, allowing for successive insertions."),
cl::Hidden);
namespace {
Location;
Location diToLocation(const DILocation *Loc) { … }
void updateDebugInfo(MachineInstr *MI, const DILocation *Loc) { … }
class X86DiscriminateMemOps : public MachineFunctionPass { … };
bool IsPrefetchOpcode(unsigned Opcode) { … }
}
char X86DiscriminateMemOps::ID = …;
X86DiscriminateMemOps::X86DiscriminateMemOps() : … { … }
bool X86DiscriminateMemOps::runOnMachineFunction(MachineFunction &MF) { … }
FunctionPass *llvm::createX86DiscriminateMemOpsPass() { … }