[llvm-commits] Win64 pseudo instruction patch

Cameron Esfahani dirty at apple.com
Fri Aug 13 16:44:24 PDT 2010


New patch, based on svn 111057:



> 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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100813/1d04cb36/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pseudo2.patch
Type: application/octet-stream
Size: 20878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100813/1d04cb36/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100813/1d04cb36/attachment-0001.html>


More information about the llvm-commits mailing list