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 {
110 << MF.
getName() <<
" **********\n");
112 ++NumStackMapFuncVisited;
116 ++NumStackMapFuncSkipped;
119 return calculateLiveness(MF);
124 bool HasChanged =
false;
126 for (
auto &MBB : MF) {
127 LLVM_DEBUG(
dbgs() <<
"****** BB " << MBB.getName() <<
" ******\n");
130 LiveRegs.addLiveOutsNoPristines(MBB);
131 bool HasStackMap =
false;
134 for (
auto I = MBB.rbegin(),
E = MBB.rend();
I !=
E; ++
I) {
135 if (
I->getOpcode() == TargetOpcode::PATCHPOINT) {
136 addLiveOutSetToMI(MF, *
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...
This class represents lattice values for constants.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
static MachineOperand CreateRegLiveOut(const uint32_t *Mask)
INITIALIZE_PASS(StackMapLiveness, "stackmap-liveness", "StackMap Liveness Analysis", false, false) StackMapLiveness
Default construct and initialize the pass.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void initializeStackMapLivenessPass(PassRegistry &)
initializer< Ty > init(const Ty &Val)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Represent the analysis usage information of a pass.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
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.
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
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.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
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.
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
Properties which a MachineFunction may have at a given point in time.