diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-02-13 02:46:49 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-13 02:46:49 +0000 |
commit | b554e533a5a1574c93aaf3cd28b808feff9f4008 (patch) | |
tree | f38e5bb414e8aa878dd234e6fd09604248a33c0e /lib/Target/PowerPC/PPCInstrInfo.cpp | |
parent | 92702b9b3a739cc844fc42b305f72b06e69eb27d (diff) | |
download | external_llvm-b554e533a5a1574c93aaf3cd28b808feff9f4008.zip external_llvm-b554e533a5a1574c93aaf3cd28b808feff9f4008.tar.gz external_llvm-b554e533a5a1574c93aaf3cd28b808feff9f4008.tar.bz2 |
commuteInstr() can now commute non-ssa machine instrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCInstrInfo.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index 81c1003..bc4d4b9 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -147,10 +147,20 @@ MachineInstr *PPCInstrInfo::commuteInstruction(MachineInstr *MI) const { // Op0 = (Op2 & ~M) | (Op1 & M) // Swap op1/op2 + unsigned Reg0 = MI->getOperand(0).getReg(); unsigned Reg1 = MI->getOperand(1).getReg(); unsigned Reg2 = MI->getOperand(2).getReg(); bool Reg1IsKill = MI->getOperand(1).isKill(); bool Reg2IsKill = MI->getOperand(2).isKill(); + // If machine instrs are no longer in two-address forms, update + // destination register as well. + if (Reg0 == Reg1) { + // Must be two address instruction! + assert(MI->getDesc().getOperandConstraint(0, TOI::TIED_TO) && + "Expecting a two-address instruction!"); + MI->getOperand(0).setReg(Reg2); + Reg2IsKill = false; + } MI->getOperand(2).setReg(Reg1); MI->getOperand(1).setReg(Reg2); MI->getOperand(2).setIsKill(Reg1IsKill); |