mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-11 10:25:41 +00:00
Move copyKillDeadInfo out-of-line. Add findRegisterUseOperand().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32273 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -386,25 +386,13 @@ public:
|
|||||||
delete removeFromParent();
|
delete removeFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// findRegisterUseOperand() - Returns the MachineOperand that is a use of
|
||||||
|
/// the specific register or NULL if it is not found.
|
||||||
|
MachineOperand *findRegisterUseOperand(unsigned Reg);
|
||||||
|
|
||||||
/// copyKillDeadInfo - Copies kill / dead operand properties from MI.
|
/// copyKillDeadInfo - Copies kill / dead operand properties from MI.
|
||||||
///
|
///
|
||||||
void copyKillDeadInfo(const MachineInstr *MI) {
|
void copyKillDeadInfo(const MachineInstr *MI);
|
||||||
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
|
||||||
const MachineOperand &MO = MI->getOperand(i);
|
|
||||||
if (MO.isReg() && (MO.isKill() || MO.isDead())) {
|
|
||||||
for (unsigned j = 0, ee = getNumOperands(); j != ee; ++j) {
|
|
||||||
MachineOperand &MOp = getOperand(j);
|
|
||||||
if (MOp.isIdenticalTo(MO)) {
|
|
||||||
if (MO.isKill())
|
|
||||||
MOp.setIsKill();
|
|
||||||
else
|
|
||||||
MOp.setIsDead();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Debugging support
|
// Debugging support
|
||||||
|
@@ -169,6 +169,37 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// findRegisterUseOperand() - Returns the MachineOperand that is a use of
|
||||||
|
/// the specific register or NULL if it is not found.
|
||||||
|
MachineOperand *MachineInstr::findRegisterUseOperand(unsigned Reg) {
|
||||||
|
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
||||||
|
MachineOperand &MO = getOperand(i);
|
||||||
|
if (MO.isReg() && MO.isUse() && MO.getReg() == Reg)
|
||||||
|
return &MO;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// copyKillDeadInfo - Copies kill / dead operand properties from MI.
|
||||||
|
///
|
||||||
|
void MachineInstr::copyKillDeadInfo(const MachineInstr *MI) {
|
||||||
|
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
|
||||||
|
const MachineOperand &MO = MI->getOperand(i);
|
||||||
|
if (!MO.isReg() || (!MO.isKill() && !MO.isDead()))
|
||||||
|
continue;
|
||||||
|
for (unsigned j = 0, ee = getNumOperands(); j != ee; ++j) {
|
||||||
|
MachineOperand &MOp = getOperand(j);
|
||||||
|
if (!MOp.isIdenticalTo(MO))
|
||||||
|
continue;
|
||||||
|
if (MO.isKill())
|
||||||
|
MOp.setIsKill();
|
||||||
|
else
|
||||||
|
MOp.setIsDead();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MachineInstr::dump() const {
|
void MachineInstr::dump() const {
|
||||||
llvm_cerr << " " << *this;
|
llvm_cerr << " " << *this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user