29 #define DEBUG_TYPE "stackmaps"
33 cl::desc(
"Enable PatchPoint Liveness Analysis Pass"));
35 STATISTIC(NumStackMapFuncVisited,
"Number of functions visited");
36 STATISTIC(NumStackMapFuncSkipped,
"Number of functions skipped");
37 STATISTIC(NumBBsVisited,
"Number of basic blocks visited");
38 STATISTIC(NumBBsHaveNoStackmap,
"Number of basic blocks with no stackmap");
39 STATISTIC(NumStackMaps,
"Number of StackMaps visited");
88 "StackMap Liveness Analysis",
false,
false)
97 void StackMapLiveness::getAnalysisUsage(
AnalysisUsage &AU)
const {
112 ++NumStackMapFuncVisited;
116 ++NumStackMapFuncSkipped;
119 return calculateLiveness(MF);
124 bool HasChanged =
false;
126 for (
auto &
MBB : MF) {
130 LiveRegs.addLiveOutsNoPristines(
MBB);
131 bool HasStackMap =
false;
135 if (
I->getOpcode() == TargetOpcode::PATCHPOINT) {
136 addLiveOutSetToMI(MF, *
I);
141 DEBUG(
dbgs() <<
" " << LiveRegs <<
" " << *
I);
142 LiveRegs.stepBackward(*
I);
146 ++NumBBsHaveNoStackmap;
164 for (
auto Reg : LiveRegs)
165 Mask[
Reg / 32] |= 1U << (
Reg % 32);
168 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)
reverse_iterator rbegin()
void initializeStackMapLivenessPass(PassRegistry &)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
initializer< Ty > init(const Ty &Val)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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.
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.
StringRef getName() const
Return the name of the corresponding LLVM basic block, or "(null)".
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineFunctionProperties & set(Property P)
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...
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
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.
Properties which a MachineFunction may have at a given point in time.