mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Teach regular and fast isel to set dead flags on unused implicit defs
on calls and similar instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1461,6 +1461,25 @@ void MachineInstr::addRegisterDefined(unsigned IncomingReg,
|
||||
true /*IsImp*/));
|
||||
}
|
||||
|
||||
void MachineInstr::setPhysRegsDeadExcept(const SmallVectorImpl<unsigned> &UsedRegs,
|
||||
const TargetRegisterInfo &TRI) {
|
||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
||||
MachineOperand &MO = getOperand(i);
|
||||
if (!MO.isReg() || !MO.isDef()) continue;
|
||||
unsigned Reg = MO.getReg();
|
||||
if (Reg == 0) continue;
|
||||
bool Dead = true;
|
||||
for (SmallVectorImpl<unsigned>::const_iterator I = UsedRegs.begin(),
|
||||
E = UsedRegs.end(); I != E; ++I)
|
||||
if (TRI.regsOverlap(*I, Reg)) {
|
||||
Dead = false;
|
||||
break;
|
||||
}
|
||||
// If there are no uses, including partial uses, the def is dead.
|
||||
if (Dead) MO.setIsDead();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned
|
||||
MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
|
||||
unsigned Hash = MI->getOpcode() * 37;
|
||||
|
Reference in New Issue
Block a user