mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Thumb2 size reduction fix for tied operands of tMUL.
The tied source operand of tMUL is the second source operand, not the first like every other two-address thumb instruction. Special case it in the size reduction pass to make sure we create the tMUL instruction properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151315 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -597,7 +597,19 @@ Thumb2SizeReduce::ReduceTo2Addr(MachineBasicBlock &MBB, MachineInstr *MI,
|
||||
|
||||
unsigned Reg0 = MI->getOperand(0).getReg();
|
||||
unsigned Reg1 = MI->getOperand(1).getReg();
|
||||
if (Reg0 != Reg1) {
|
||||
// t2MUL is "special". The tied source operand is second, not first.
|
||||
if (MI->getOpcode() == ARM::t2MUL) {
|
||||
if (Reg0 != MI->getOperand(2).getReg()) {
|
||||
// If the other operand also isn't the same as the destination, we
|
||||
// can't reduce.
|
||||
if (Reg1 != Reg0)
|
||||
return false;
|
||||
// Try to commute the operands to make it a 2-address instruction.
|
||||
MachineInstr *CommutedMI = TII->commuteInstruction(MI);
|
||||
if (!CommutedMI)
|
||||
return false;
|
||||
}
|
||||
} else if (Reg0 != Reg1) {
|
||||
// Try to commute the operands to make it a 2-address instruction.
|
||||
unsigned CommOpIdx1, CommOpIdx2;
|
||||
if (!TII->findCommutedOpIndices(MI, CommOpIdx1, CommOpIdx2) ||
|
||||
|
Reference in New Issue
Block a user