[llvm-commits] [llvm] r47043 - in /llvm/trunk/lib: CodeGen/TargetInstrInfoImpl.cpp Target/PowerPC/PPCInstrInfo.cpp Target/X86/X86InstrInfo.cpp
Chris Lattner
clattner at apple.com
Tue Feb 12 21:59:38 PST 2008
On Feb 12, 2008, at 6:46 PM, Evan Cheng wrote:
> Author: evancheng
> Date: Tue Feb 12 20:46:49 2008
> New Revision: 47043
>
> URL: http://llvm.org/viewvc/llvm-project?rev=47043&view=rev
> Log:
> commuteInstr() can now commute non-ssa machine instrs.
>
> Modified:
> llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
> llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
> llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
>
> Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=47043&r1=47042&r2=47043&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original)
> +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Tue Feb 12
> 20:46:49 2008
> @@ -23,8 +23,17 @@
> "This only knows how to commute register operands so far");
> unsigned Reg1 = MI->getOperand(1).getReg();
> unsigned Reg2 = MI->getOperand(2).getReg();
> + MachineOperand &MO = MI->getOperand(0);
> + bool UpdateReg0 = MO.isReg() && MO.getReg() == Reg1;
> bool Reg1IsKill = MI->getOperand(1).isKill();
> bool Reg2IsKill = MI->getOperand(2).isKill();
> + if (UpdateReg0) {
Why not just use:
if (MO.isReg() && MO.getReg() == Reg1)
Further, does it even make sense for instructions to be marked
commutable if the first operand isn't a register? Why not just use:
if (MO.getReg() == Reg1)
Bonus points for making tblgen reject instructions marked commutable
that don't start with three register operands.
-Chris
More information about the llvm-commits
mailing list