34 #define DEBUG_TYPE "ip-regalloc"
37 "Number of functions optimized for callee saved registers");
52 return "Register Usage Information Collector Pass";
66 "Register Usage Information Collector",
false,
false)
75 void RegUsageInfoCollector::getAnalysisUsage(
AnalysisUsage &AU)
const {
86 DEBUG(
dbgs() <<
" -------------------- " << getPassName()
87 <<
" -------------------- \n");
90 std::vector<uint32_t> RegMask;
95 unsigned RegMaskSize = (TRI->
getNumRegs() + 31) / 32;
96 RegMask.resize(RegMaskSize, 0xFFFFFFFF);
104 DEBUG(
dbgs() <<
"Clobbered Registers: ");
106 for (
unsigned PReg = 1, PRegE = TRI->
getNumRegs(); PReg < PRegE; ++PReg)
108 RegMask[PReg / 32] &= ~(1u << PReg % 32);
114 for (
unsigned i = 0;
i < RegMaskSize; ++
i)
115 RegMask[
i] = RegMask[
i] | CallPreservedMask[
i];
119 <<
" function optimized for not having CSR.\n");
122 for (
unsigned PReg = 1, PRegE = TRI->
getNumRegs(); PReg < PRegE; ++PReg)
126 DEBUG(
dbgs() <<
" \n----------------------------------------\n");
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
STATISTIC(NumFunctions,"Total number of functions")
A global registry used in conjunction with static constructors to make pluggable components (like tar...
void storeUpdateRegUsageInfo(const Function *FP, std::vector< uint32_t > RegMask)
To store RegMask for given Function *.
void initializeRegUsageInfoCollectorPass(PassRegistry &)
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
void setTargetMachine(const TargetMachine *TM_)
To set TargetMachine *, which is used to print analysis when command line option -print-regusage is u...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
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...
FunctionPass * createRegUsageInfoCollector()
This pass is executed POST-RA to collect which physical registers are preserved by given machine func...
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
unsigned const MachineRegisterInfo * MRI
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
FunctionPass class - This class is used to implement most global optimizations.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Promote Memory to Register
Register Usage Information false
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
virtual const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const
Return a mask of call-preserved registers for the given calling convention on the current function...
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
static bool isSafeForNoCSROpt(const Function *F)
Check if given function is safe for not having callee saved registers.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
INITIALIZE_PASS_BEGIN(RegUsageInfoCollector,"RegUsageInfoCollector","Register Usage Information Collector", false, false) INITIALIZE_PASS_END(RegUsageInfoCollector
bool isPhysRegModified(unsigned PhysReg, bool SkipNoReturnDef=false) const
Return true if the specified register is modified in this function.
This pass is required to take advantage of the interprocedural register allocation infrastructure...
Primary interface to the complete machine description for the target machine.
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Register Usage Information Collector