<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div></div><div><br><blockquote type="cite"><span class="Apple-style-span" style="font-family: Times; "><pre>Hello, Cameron

><i> 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.
</i>><i>
</i>><i> Also, updated a little bit of the coff-dump.py tool to dump the AMD64 relocations.  Updated COFF.h to list the AMD64 relocations.
</i>><i>
</i>><i> Still a bit more to do before Win64 COFFs work...
</i>Please next time submit unrelated changes (e.g. MC changes vs tail
call stuff changes) as separate patches for the sake of easier review.

><i>+  bool AfterFPPop = Opc == X86::TAILJMPm64 || Opc == X86::TAILJMPm ||
</i>><i>+                    Opc == X86::WINTAILJMPm64;
</i>Is it possible to factor out the predicates of such sort into some
external predicate function? Something like "IsTAILJUMPMemOpcode()" or
whatever?

</pre></span></blockquote><div>Done.  I've created some helper routines to manage the different flavors of the TAILJUMP AND TCRETURN pseudo opcodes.</div><br><blockquote type="cite"><span class="Apple-style-span" style="font-family: Times; "><pre>><i>-  } else if (Subtarget->isTargetWin64()) {
</i>><i>-    // We need to always allocate 32 bytes as register spill area.
</i>><i>-    // FIXME: We might reuse these 32 bytes for leaf functions.
</i>><i>-    StackSize += 32;
</i>><i>-    MFI->setStackSize(StackSize);
</i>><i>   }
</i>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.

</pre></span></blockquote><div>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.</div><br><blockquote type="cite"><span class="Apple-style-span" style="font-family: Times; "><pre>><i>-             RetOpcode == X86::TCRETURNmi64) {
</i>><i>-    bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64;
</i>><i>+             RetOpcode == X86::TCRETURNmi64 ||
</i>><i>+             RetOpcode == X86::WINTCRETURNri64 || RetOpcode == X86::WINTCRETURNdi64 ||
</i>><i>+             RetOpcode == X86::WINTCRETURNmi64) {
</i>><i>+    bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64 ||
</i>><i>+                 RetOpcode == X86::WINTCRETURNmi64;
</i>Same as above.

><i> +      if (RetOpcode == X86::TCRETURNdi)
</i>><i> +        Opcode = X86::TAILJMPd;
</i>><i> +      else
</i>><i> +        Opcode = (IsWin64 ? X86::WINTAILJMPd64 : X86::TAILJMPd64);
</i>Also deserves some helper for such mapping? E.g. "TailCallIMapImmOpcode" ?

</pre></span></blockquote><div>This should be resolved with the new helper routines.</div><br><blockquote type="cite"><span class="Apple-style-span" style="font-family: Times; "><pre>-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University</pre></span></blockquote><div><div>On Aug 12, 2010, at 6:47 PM, Cameron Esfahani wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">New patch, based on SVN revision 110995:<br><br><span><pseudo.patch></span><br></span></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>Cameron Esfahani</div><div><a href="mailto:dirty@apple.com">dirty@apple.com</a></div><div><br class="khtml-block-placeholder"></div><div>"All that is necessary for the triumph of evil is that good men do nothing."</div><div><br class="khtml-block-placeholder"></div><div>Edmund Burke</div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span>
</div>
<br></div></body></html>