23 #define DEBUG_TYPE "processimpdefs" 55 "Process Implicit Definitions",
false,
false)
57 void ProcessImplicitDefs::getAnalysisUsage(
AnalysisUsage &AU)
const {
63 bool ProcessImplicitDefs::canTurnIntoImplicitDef(
MachineInstr *
MI) {
70 if (MO.isReg() && MO.isUse() && MO.readsReg())
75 void ProcessImplicitDefs::processImplicitDef(
MachineInstr *MI) {
85 if (!canTurnIntoImplicitDef(UserMI))
88 UserMI->
setDesc(
TII->get(TargetOpcode::IMPLICIT_DEF));
89 WorkList.insert(UserMI);
100 for (++UserMI; UserMI != UserE; ++UserMI) {
104 unsigned UserReg = MO.getReg();
106 !
TRI->regsOverlap(Reg, UserReg))
135 LLVM_DEBUG(
dbgs() <<
"********** PROCESS IMPLICIT DEFS **********\n" 136 <<
"********** Function: " << MF.
getName() <<
'\n');
138 bool Changed =
false;
143 assert(
MRI->isSSA() &&
"ProcessImplicitDefs only works on SSA form.");
144 assert(WorkList.empty() &&
"Inconsistent worklist state");
150 MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI)
151 if (MBBI->isImplicitDef())
152 WorkList.insert(&*MBBI);
154 if (WorkList.empty())
158 <<
" implicit defs.\n");
162 do processImplicitDef(WorkList.pop_back_val());
163 while (!WorkList.empty());
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
instr_iterator instr_end()
This class represents lattice values for constants.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
unsigned getReg() const
getReg - Returns the register number.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool isRegSequence() const
unsigned const TargetRegisterInfo * TRI
char & ProcessImplicitDefsID
ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
iterator_range< mop_iterator > operands()
bool isCopyLike() const
Return true if the instruction behaves like a copy.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
unsigned getNumOperands() const
Retuns the total number of operands.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
virtual const TargetInstrInfo * getInstrInfo() const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
TargetInstrInfo - Interface to description of machine instruction set.
unsigned const MachineRegisterInfo * MRI
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.
INITIALIZE_PASS(ProcessImplicitDefs, DEBUG_TYPE, "Process Implicit Definitions", false, false) void ProcessImplicitDefs
Represent the analysis usage information of a pass.
void initializeProcessImplicitDefsPass(PassRegistry &)
self_iterator getIterator()
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
A SetVector that performs no allocations if smaller than a certain size.
Iterator for intrusive lists based on ilist_node.
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
MachineOperand class - Representation of each machine instruction operand.
bool isInsertSubreg() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void RemoveOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
const MachineOperand & getOperand(unsigned i) const