[llvm-commits] [llvm] r102509 - /llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
Chris Lattner
clattner at apple.com
Wed Apr 28 12:42:38 PDT 2010
On Apr 28, 2010, at 11:28 AM, Jakob Stoklund Olesen wrote:
> Author: stoklund
> Date: Wed Apr 28 13:28:37 2010
> New Revision: 102509
>
> URL: http://llvm.org/viewvc/llvm-project?rev=102509&view=rev
> Log:
> Teach X86FloatingPoint that a register can be killed multiple times by the same
> instruction.
>
> This instruction would crash the pass:
>
> INLINEASM <es:foo $0 $1>, 9, %FP0<kill>, 9, %FP0<kill>, 14, %EFLAGS<earlyclobber,def,dead>
>
> Now it doesn't.
Great! Testcase? :)
-Chris
>
> Modified:
> llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=102509&r1=102508&r2=102509&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Wed Apr 28 13:28:37 2010
> @@ -1088,8 +1088,7 @@
> // 'f' constraint. These should be turned into the current ST(x) register
> // in the machine instr. Also, any kills should be explicitly popped after
> // the inline asm.
> - unsigned Kills[7];
> - unsigned NumKills = 0;
> + unsigned Kills = 0;
> for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
> MachineOperand &Op = MI->getOperand(i);
> if (!Op.isReg() || Op.getReg() < X86::FP0 || Op.getReg() > X86::FP6)
> @@ -1103,7 +1102,7 @@
> // asm. We just remember it for now, and pop them all off at the end in
> // a batch.
> if (Op.isKill())
> - Kills[NumKills++] = FPReg;
> + Kills |= 1U << FPReg;
> }
>
> // If this asm kills any FP registers (is the last use of them) we must
> @@ -1114,9 +1113,11 @@
> // Note: this might be a non-optimal pop sequence. We might be able to do
> // better by trying to pop in stack order or something.
> MachineBasicBlock::iterator InsertPt = MI;
> - while (NumKills)
> - freeStackSlotAfter(InsertPt, Kills[--NumKills]);
> -
> + while (Kills) {
> + unsigned FPReg = CountTrailingZeros_32(Kills);
> + freeStackSlotAfter(InsertPt, FPReg);
> + Kills &= ~(1U << FPReg);
> + }
> // Don't delete the inline asm!
> return;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list