mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
Use CloneMachineInstr to make a new MI in commuteInstruction to make the code tolerant of instructions with more than two input operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163000 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bf4043768c
commit
89b2ff0b5c
@ -99,17 +99,8 @@ MachineInstr *TargetInstrInfoImpl::commuteInstruction(MachineInstr *MI,
|
||||
|
||||
if (NewMI) {
|
||||
// Create a new instruction.
|
||||
bool Reg0IsDead = HasDef ? MI->getOperand(0).isDead() : false;
|
||||
MachineFunction &MF = *MI->getParent()->getParent();
|
||||
if (HasDef)
|
||||
return BuildMI(MF, MI->getDebugLoc(), MI->getDesc())
|
||||
.addReg(Reg0, RegState::Define | getDeadRegState(Reg0IsDead), SubReg0)
|
||||
.addReg(Reg2, getKillRegState(Reg2IsKill), SubReg2)
|
||||
.addReg(Reg1, getKillRegState(Reg1IsKill), SubReg1);
|
||||
else
|
||||
return BuildMI(MF, MI->getDebugLoc(), MI->getDesc())
|
||||
.addReg(Reg2, getKillRegState(Reg2IsKill), SubReg2)
|
||||
.addReg(Reg1, getKillRegState(Reg1IsKill), SubReg1);
|
||||
MI = MF.CloneMachineInstr(MI);
|
||||
}
|
||||
|
||||
if (HasDef) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user