10 #define DEBUG_TYPE "processimplicitdefs"
54 "Process Implicit Definitions",
false,
false)
58 void ProcessImplicitDefs::getAnalysisUsage(
AnalysisUsage &AU)
const {
64 bool ProcessImplicitDefs::canTurnIntoImplicitDef(
MachineInstr *
MI) {
71 if (MO->isReg() && MO->isUse() && MO->readsReg())
76 void ProcessImplicitDefs::processImplicitDef(
MachineInstr *MI) {
84 MRI->use_nodbg_begin(Reg),
85 UE =
MRI->use_nodbg_end(); UI != UE; ++UI) {
89 if (!canTurnIntoImplicitDef(UserMI))
91 DEBUG(
dbgs() <<
"Converting to IMPLICIT_DEF: " << *UserMI);
93 WorkList.insert(UserMI);
104 for (++UserMI; UserMI != UserE; ++UserMI) {
105 for (
MIOperands MO(UserMI); MO.isValid(); ++MO) {
108 unsigned UserReg = MO->
getReg();
110 !TRI->regsOverlap(Reg, UserReg))
123 DEBUG(
dbgs() <<
"Physreg user: " << *UserMI);
132 DEBUG(
dbgs() <<
"Keeping physreg: " << *MI);
139 DEBUG(
dbgs() <<
"********** PROCESS IMPLICIT DEFS **********\n"
140 <<
"********** Function: " << MF.
getName() <<
'\n');
142 bool Changed =
false;
147 assert(
MRI->isSSA() &&
"ProcessImplicitDefs only works on SSA form.");
148 assert(WorkList.empty() &&
"Inconsistent worklist state");
154 MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI)
155 if (MBBI->isImplicitDef())
156 WorkList.insert(MBBI);
158 if (WorkList.empty())
161 DEBUG(
dbgs() <<
"BB#" << MFI->getNumber() <<
" has " << WorkList.size()
162 <<
" implicit defs.\n");
166 do processImplicitDef(WorkList.pop_back_val());
167 while (!WorkList.empty());
MachineInstr * getParent()
static PassRegistry * getPassRegistry()
instr_iterator instr_end()
void setIsUndef(bool Val=true)
static bool isVirtualRegister(unsigned Reg)
char & ProcessImplicitDefsID
ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
Instructions::iterator instr_iterator
INITIALIZE_PASS_BEGIN(ProcessImplicitDefs,"processimpdefs","Process Implicit Definitions", false, false) INITIALIZE_PASS_END(ProcessImplicitDefs
const HexagonInstrInfo * TII
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
ID
LLVM Calling Convention Representation.
unsigned getNumOperands() const
void RemoveOperand(unsigned i)
Process Implicit Definitions
const MachineBasicBlock * getParent() const
bool isInsertSubreg() const
const MachineOperand & getOperand(unsigned i) const
void initializeProcessImplicitDefsPass(PassRegistry &)
virtual const TargetInstrInfo * getInstrInfo() const
A SetVector that performs no allocations if smaller than a certain size.
void setDesc(const MCInstrDesc &tid)
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
A collection of legacy interfaces for querying information about the current executing process...
static bool isPhysicalRegister(unsigned Reg)
MachineRegisterInfo & getRegInfo()
virtual void getAnalysisUsage(AnalysisUsage &AU) const
IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
const TargetMachine & getTarget() const
virtual const TargetRegisterInfo * getRegisterInfo() const
unsigned getReg() const
getReg - Returns the register number.
bool isValid() const
isValid - Returns true until all the operands have been visited.
BasicBlockListType::iterator iterator
const MCRegisterInfo & MRI
StringRef getName() const
bool isRegSequence() const