25 #define DEBUG_TYPE "dead-mi-elimination" 27 STATISTIC(NumDeletes,
"Number of dead instructions deleted");
57 "Remove dead machine instructions",
false,
false)
63 if (MI->isInlineAsm())
67 if (MI->getOpcode() == TargetOpcode::LOCAL_ESCAPE)
71 bool SawStore =
false;
72 if (!MI->isSafeToMove(
nullptr, SawStore) && !MI->isPHI())
76 for (
unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
96 bool DeadMachineInstructionElim::runOnMachineFunction(
MachineFunction &MF) {
100 bool AnyChanges =
false;
116 E = MBB.succ_end(); S !=
E; S++)
117 for (
const auto &LI : (*S)->liveins())
118 LivePhysRegs.
set(LI.PhysReg);
123 MIE = MBB.rend(); MII != MIE; ) {
128 LLVM_DEBUG(
dbgs() <<
"DeadMachineInstructionElim: DELETING: " << *MI);
149 LivePhysRegs.
reset(*SR);
164 LivePhysRegs.
set(*AI);
171 LivePhysRegs.
clear();
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool use_nodbg_empty(unsigned RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register...
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.
bool test(unsigned Idx) const
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
void clear()
clear - Removes all bits from the bitvector. Does not change capacity.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getNumOperands() const
Retuns the total number of operands.
MachineBasicBlock iterator that automatically skips over MIs that are inside bundles (i...
void eraseFromParentAndMarkDBGValuesForRemoval()
Unlink 'this' from the containing basic block and delete it.
char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
virtual const TargetInstrInfo * getInstrInfo() const
TargetInstrInfo - Interface to description of machine instruction set.
void clearBitsNotInMask(const uint32_t *Mask, unsigned MaskWords=~0u)
clearBitsNotInMask - Clear a bit in this vector for every '0' bit in Mask.
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void initializeDeadMachineInstructionElimPass(PassRegistry &)
MCRegAliasIterator enumerates all registers aliasing Reg.
Represent the analysis usage information of a pass.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
MCSubRegIterator enumerates all sub-registers of Reg.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
const BitVector & getReservedRegs() const
getReservedRegs - Returns a reference to the frozen set of reserved registers.
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.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
const MachineOperand & getOperand(unsigned i) const
reverse_iterator rbegin()
std::vector< MachineBasicBlock * >::iterator succ_iterator
INITIALIZE_PASS(DeadMachineInstructionElim, DEBUG_TYPE, "Remove dead machine instructions", false, false) bool DeadMachineInstructionElim
bool isReserved(unsigned PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.