mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
commuteInstruction should propagate kill / dead info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ddee842062
commit
ff608a7a69
@ -60,7 +60,17 @@ MachineInstr *TargetInstrInfo::commuteInstruction(MachineInstr *MI) const {
|
|||||||
"This only knows how to commute register operands so far");
|
"This only knows how to commute register operands so far");
|
||||||
unsigned Reg1 = MI->getOperand(1).getReg();
|
unsigned Reg1 = MI->getOperand(1).getReg();
|
||||||
unsigned Reg2 = MI->getOperand(2).getReg();
|
unsigned Reg2 = MI->getOperand(2).getReg();
|
||||||
|
bool Reg1IsKill = MI->getOperand(1).isKill();
|
||||||
|
bool Reg2IsKill = MI->getOperand(2).isKill();
|
||||||
MI->getOperand(2).setReg(Reg1);
|
MI->getOperand(2).setReg(Reg1);
|
||||||
MI->getOperand(1).setReg(Reg2);
|
MI->getOperand(1).setReg(Reg2);
|
||||||
|
if (Reg1IsKill)
|
||||||
|
MI->getOperand(2).setIsKill();
|
||||||
|
else
|
||||||
|
MI->getOperand(2).unsetIsKill();
|
||||||
|
if (Reg2IsKill)
|
||||||
|
MI->getOperand(1).setIsKill();
|
||||||
|
else
|
||||||
|
MI->getOperand(1).unsetIsKill();
|
||||||
return MI;
|
return MI;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user