[llvm-commits] Win64 pseudo instruction patch
Cameron Esfahani
dirty at apple.com
Mon Aug 16 15:16:07 PDT 2010
Any new comments?
On Aug 13, 2010, at 4:44 PM, Cameron Esfahani wrote:
> New patch, based on svn 111057:
>
> <pseudo2.patch>
>
>> Hello, Cameron
>>
>> > Attached is a patch which fixes some more of the Win64 ABI code gen. Added support for the Windows 64 pseudo instructions like WINTAILJMPd64 and WINCALL64pcrel32.
>> >
>> > Also, updated a little bit of the coff-dump.py tool to dump the AMD64 relocations. Updated COFF.h to list the AMD64 relocations.
>> >
>> > Still a bit more to do before Win64 COFFs work...
>> Please next time submit unrelated changes (e.g. MC changes vs tail
>> call stuff changes) as separate patches for the sake of easier review.
>>
>> >+ bool AfterFPPop = Opc == X86::TAILJMPm64 || Opc == X86::TAILJMPm ||
>> >+ Opc == X86::WINTAILJMPm64;
>> Is it possible to factor out the predicates of such sort into some
>> external predicate function? Something like "IsTAILJUMPMemOpcode()" or
>> whatever?
>>
> Done. I've created some helper routines to manage the different flavors of the TAILJUMP AND TCRETURN pseudo opcodes.
>
>> >- } else if (Subtarget->isTargetWin64()) {
>> >- // We need to always allocate 32 bytes as register spill area.
>> >- // FIXME: We might reuse these 32 bytes for leaf functions.
>> >- StackSize += 32;
>> >- MFI->setStackSize(StackSize);
>> > }
>> As I already mentioned, this part is invalid. Consider the following
>> case: you have two functions A and B with A calling B. B does regs
>> dump into register save area. Since you haven't allocated the space on
>> stack for register save area then B will clobber 16 bytes on local
>> frame of A. This is definitely not what you will want.
>>
> Ok, I've backed this out. There were some weird things I saw when generating Win64 code, which is why I took it out in the first place. I'll try and figure it out in the future.
>
>> >- RetOpcode == X86::TCRETURNmi64) {
>> >- bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64;
>> >+ RetOpcode == X86::TCRETURNmi64 ||
>> >+ RetOpcode == X86::WINTCRETURNri64 || RetOpcode == X86::WINTCRETURNdi64 ||
>> >+ RetOpcode == X86::WINTCRETURNmi64) {
>> >+ bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64 ||
>> >+ RetOpcode == X86::WINTCRETURNmi64;
>> Same as above.
>>
>> > + if (RetOpcode == X86::TCRETURNdi)
>> > + Opcode = X86::TAILJMPd;
>> > + else
>> > + Opcode = (IsWin64 ? X86::WINTAILJMPd64 : X86::TAILJMPd64);
>> Also deserves some helper for such mapping? E.g. "TailCallIMapImmOpcode" ?
>>
> This should be resolved with the new helper routines.
>
>> --
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
> On Aug 12, 2010, at 6:47 PM, Cameron Esfahani wrote:
>
>> New patch, based on SVN revision 110995:
>>
>> <pseudo.patch>
>
> Cameron Esfahani
> dirty at apple.com
>
> "All that is necessary for the triumph of evil is that good men do nothing."
>
> Edmund Burke
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Cameron Esfahani
dirty at apple.com
"It is the spirit and not the form of law that keeps justice alive."
Earl Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100816/59099861/attachment.html>
More information about the llvm-commits
mailing list