14 #define DEBUG_TYPE "codegen-dce"
26 STATISTIC(NumDeletes,
"Number of dead instructions deleted");
51 "Remove dead machine instructions",
false,
false)
57 if (MI->isInlineAsm())
62 if (!MI->isSafeToMove(
TII, 0, SawStore) && !MI->isPHI())
66 for (
unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
72 if (LivePhysRegs.test(Reg) ||
MRI->isReserved(Reg))
75 if (!
MRI->use_nodbg_empty(Reg))
86 bool DeadMachineInstructionElim::runOnMachineFunction(
MachineFunction &MF) {
87 bool AnyChanges =
false;
100 LivePhysRegs =
MRI->getReservedRegs();
108 LI != (*S)->livein_end();
LI++)
109 LivePhysRegs.set(*
LI);
114 MIE = MBB->
rend();
MII != MIE; ) {
119 DEBUG(
dbgs() <<
"DeadMachineInstructionElim: DELETING: " << *MI);
132 E =
MRI->use_end();
I!=E;
I=nextI) {
162 LivePhysRegs.reset(*SR);
166 LivePhysRegs.clearBitsNotInMask(MO.
getRegMask());
177 LivePhysRegs.set(*AI);
188 LivePhysRegs.clear();
MachineInstr * getParent()
static PassRegistry * getPassRegistry()
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
std::reverse_iterator< iterator > reverse_iterator
std::vector< unsigned >::const_iterator livein_iterator
static bool isVirtualRegister(unsigned Reg)
LoopInfoBase< BlockT, LoopT > * LI
const HexagonInstrInfo * TII
INITIALIZE_PASS(DeadMachineInstructionElim,"dead-mi-elimination","Remove dead machine instructions", false, false) bool DeadMachineInstructionElim bool SawStore
bool isReg() const
isReg - Tests if this is a MO_Register operand.
std::vector< MachineBasicBlock * >::iterator succ_iterator
ID
LLVM Calling Convention Representation.
unsigned getNumOperands() const
char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
reverse_iterator rbegin()
void initializeDeadMachineInstructionElimPass(PassRegistry &)
const MachineOperand & getOperand(unsigned i) const
ItTy next(ItTy it, Dist n)
succ_iterator succ_begin()
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
virtual const TargetInstrInfo * getInstrInfo() const
const uint32_t * getRegMask() const
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
static bool isPhysicalRegister(unsigned Reg)
MachineRegisterInfo & getRegInfo()
void setReg(unsigned Reg)
const TargetMachine & getTarget() const
virtual const TargetRegisterInfo * getRegisterInfo() const
unsigned getReg() const
getReg - Returns the register number.
std::reverse_iterator< iterator > reverse_iterator
const MCRegisterInfo & MRI
STATISTIC(NumDeletes,"Number of dead instructions deleted")
reverse_iterator rbegin()