37#define DEBUG_TYPE "ip-regalloc"
39#define RUIP_NAME "Register Usage Information Propagation"
43class RegUsageInfoPropagation {
56 ->getRegInfo().getTargetRegisterInfo()
58 &&
"expected register mask size");
61 MO.setRegMask(RegMask.
data());
93char RegUsageInfoPropagationLegacy::
ID = 0;
100 return dyn_cast<const Function>(MO.getGlobal());
103 return M.getFunction(MO.getSymbolName());
109bool RegUsageInfoPropagationLegacy::runOnMachineFunction(
MachineFunction &MF) {
110 PhysicalRegisterUsageInfo *PRUI =
111 &getAnalysis<PhysicalRegisterUsageInfoWrapperLegacy>().getPRUI();
113 RegUsageInfoPropagation RUIP(PRUI);
122 .getCachedResult<PhysicalRegisterUsageAnalysis>(MFA);
123 assert(PRUI &&
"PhysicalRegisterUsageAnalysis not available");
124 RegUsageInfoPropagation(PRUI).run(MF);
132 <<
" ++++++++++++++++++++ \n");
147 <<
"Call Instruction Before Register Usage Info Propagation : \n"
150 auto UpdateRegMask = [&](
const Function &
F) {
154 setRegMask(
MI, RegMask);
159 if (
F->isDefinitionExact()) {
170 <<
"Call Instruction After Register Usage Info Propagation : \n"
176 dbgs() <<
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
182 return new RegUsageInfoPropagationLegacy();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static const Function * findCalledFunction(const Module &M, const MachineInstr &MI)
This pass is required to take advantage of the interprocedural register allocation infrastructure.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
FunctionPass class - This class is used to implement most global optimizations.
Module * getParent()
Get the module that this global value is contained inside of...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool hasCalls() const
Return true if the current function has any function calls.
bool hasTailCall() const
Returns true if the function contains a tail call.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
static unsigned getRegMaskSize(unsigned NumRegs)
Returns number of elements needed for a regmask array.
A Module instance is used to store all the information related to an LLVM module.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
ArrayRef< uint32_t > getRegUsageInfo(const Function &FP)
To query stored RegMask for given Function *, it will returns ane empty array if function is not know...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
A global registry used in conjunction with static constructors to make pluggable components (like tar...
StringRef - Represent a constant reference to a string, i.e.
Pass manager infrastructure for declaring and invalidating analyses.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI FunctionPass * createRegUsageInfoPropPass()
Return a MachineFunction pass that identifies call sites and propagates register usage information of...
LLVM_ABI void initializeRegUsageInfoPropagationLegacyPass(PassRegistry &)