38#define DEBUG_TYPE "ip-regalloc"
40#define RUIP_NAME "Register Usage Information Propagation"
44class RegUsageInfoPropagation {
57 ->getRegInfo().getTargetRegisterInfo()
59 &&
"expected register mask size");
62 MO.setRegMask(RegMask.
data());
91char RegUsageInfoPropagationLegacy::ID = 0;
98 return dyn_cast<const Function>(MO.getGlobal());
101 return M.getFunction(MO.getSymbolName());
107bool RegUsageInfoPropagationLegacy::runOnMachineFunction(
MachineFunction &MF) {
108 PhysicalRegisterUsageInfo *PRUI =
109 &getAnalysis<PhysicalRegisterUsageInfoWrapperLegacy>().getPRUI();
111 RegUsageInfoPropagation RUIP(PRUI);
120 .getCachedResult<PhysicalRegisterUsageAnalysis>(MFA);
121 assert(PRUI &&
"PhysicalRegisterUsageAnalysis not available");
122 RegUsageInfoPropagation(PRUI).run(MF);
130 <<
" ++++++++++++++++++++ \n");
145 <<
"Call Instruction Before Register Usage Info Propagation : \n"
148 auto UpdateRegMask = [&](
const Function &
F) {
152 setRegMask(
MI, RegMask);
157 if (
F->isDefinitionExact()) {
168 <<
"Call Instruction After Register Usage Info Propagation : \n"
174 dbgs() <<
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
180 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.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
bool empty() const
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.
LLVM_ABI 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.
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Represent a constant reference to a string, i.e.
Pass manager infrastructure for declaring and invalidating analyses.
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...