Go to the documentation of this file.
25 #define DEBUG_TYPE "pseudo-probe-inserter"
38 StringRef getPassName()
const override {
return "Pseudo Probe Inserter"; }
45 bool doInitialization(
Module &
M)
override {
62 auto Value =
DL->getDiscriminator();
65 .
addImm(getFuncGUID(MF.getFunction().getParent(),
DL))
101 auto *ProbeInstr = &*Cur;
115 if (
MI.isPseudoProbe())
116 ToBeRemoved.push_back(&
MI);
119 for (
auto *
MI : ToBeRemoved)
120 MI->eraseFromParent();
122 Changed |= !ToBeRemoved.empty();
131 auto *SP =
DL->getScope()->getSubprogram();
132 auto Name = SP->getLinkageName();
134 Name = SP->getName();
138 bool ShouldRun =
false;
144 "Insert pseudo probe annotations for value profiling",
152 return new PseudoProbeInserter();
static uint32_t extractProbeAttributes(uint32_t Value)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
INITIALIZE_PASS_BEGIN(PseudoProbeInserter, DEBUG_TYPE, "Insert pseudo probe annotations for value profiling", false, false) INITIALIZE_PASS_END(PseudoProbeInserter
virtual const TargetInstrInfo * getInstrInfo() const
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
static bool isPseudoProbeDiscriminator(unsigned Discriminator)
static uint32_t extractProbeType(uint32_t Value)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
@ PSEUDO_PROBE
Pseudo probe for AutoFDO, as a place holder in a basic block to improve the sample counts quality.
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstr * remove(MachineInstr *I)
Remove the unbundled instruction from the instruction list without deleting it.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Represent the analysis usage information of a pass.
constexpr const char * PseudoProbeDescMetadataName
const HexagonInstrInfo * TII
void initializePseudoProbeInserterPass(PassRegistry &)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Target-Independent Code Generator Pass Configuration Options.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
static uint32_t extractProbeIndex(uint32_t Value)
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
reverse_iterator rbegin()
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
this could be done in SelectionDAGISel along with other special for
Insert pseudo probe annotations for value profiling
void setPreservesAll()
Set by analyses that do not transform their input at all.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
FunctionPass * createPseudoProbeInserter()
This pass inserts pseudo probe annotation for callsite profiling.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
FunctionPass class - This class is used to implement most global optimizations.
LLVM Value Representation.