30 #define DEBUG_TYPE "stackmaps"
34 cl::desc(
"Enable PatchPoint Liveness Analysis Pass"));
36 STATISTIC(NumStackMapFuncVisited,
"Number of functions visited");
37 STATISTIC(NumStackMapFuncSkipped,
"Number of functions skipped");
38 STATISTIC(NumBBsVisited,
"Number of basic blocks visited");
39 STATISTIC(NumBBsHaveNoStackmap,
"Number of basic blocks with no stackmap");
40 STATISTIC(NumStackMaps,
"Number of StackMaps visited");
84 "StackMap Liveness Analysis",
false,
false)
93 void StackMapLiveness::getAnalysisUsage(
AnalysisUsage &AU)
const {
108 ++NumStackMapFuncVisited;
112 ++NumStackMapFuncSkipped;
115 return calculateLiveness(MF);
120 bool HasChanged =
false;
122 for (
auto &MBB : MF) {
123 DEBUG(
dbgs() <<
"****** BB " << MBB.getName() <<
" ******\n");
125 LiveRegs.addLiveOuts(&MBB);
126 bool HasStackMap =
false;
129 for (
auto I = MBB.rbegin(), E = MBB.rend();
I != E; ++
I) {
131 addLiveOutSetToMI(MF, *
I);
136 DEBUG(
dbgs() <<
" " << LiveRegs <<
" " << *
I);
137 LiveRegs.stepBackward(*
I);
141 ++NumBBsHaveNoStackmap;
149 uint32_t *Mask = createRegisterMask(MF);
156 uint32_t *StackMapLiveness::createRegisterMask(
MachineFunction &MF)
const {
159 for (
auto Reg : LiveRegs)
160 Mask[
Reg / 32] |= 1U << (
Reg % 32);
163 TRI->adjustStackMapLiveOutMask(Mask);
static cl::opt< bool > EnablePatchPointLiveness("enable-patchpoint-liveness", cl::Hidden, cl::init(true), cl::desc("Enable PatchPoint Liveness Analysis Pass"))
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
STATISTIC(NumFunctions,"Total number of functions")
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Reg
All possible values of the reg field in the ModR/M byte.
static MachineOperand CreateRegLiveOut(const uint32_t *Mask)
void initializeStackMapLivenessPass(PassRegistry &)
initializer< Ty > init(const Ty &Val)
Patchable call instruction - this instruction represents a call to a constant address, followed by a series of NOPs.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Represent the analysis usage information of a pass.
uint32_t * allocateRegisterMask(unsigned NumRegister)
Allocate and initialize a register mask with NumRegister bits.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
MachineOperand class - Representation of each machine instruction operand.
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setPreservesAll()
Set by analyses that do not transform their input at all.
Representation of each machine instruction.
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
A set of live physical registers with functions to track liveness when walking backward/forward throu...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
INITIALIZE_PASS(StackMapLiveness,"stackmap-liveness","StackMap Liveness Analysis", false, false) StackMapLiveness
Default construct and initialize the pass.