[llvm-commits] [PATCH][Review Request]Alternative Calling Convention

Demikhovsky, Elena elena.demikhovsky at intel.com
Sun Oct 14 06:00:16 PDT 2012


Hi Jacob,

Thank you for the review.

I removed CALL_ALT_SIMD, changed CalleeSavedRegs and added a test for prolog-epilog.
I specified CSR_64_Alt_SIMD_AVX and CSR_64_Alt_SIMD separately, 
otherwise, if I specify YMM only,  
I see correct code on AVX and the both YMM and XMM spill/fill on SSE architecture.

I attached the new patch.

- Elena

-----Original Message-----
From: Jakob Stoklund Olesen [mailto:stoklund at 2pi.dk] 
Sent: Friday, October 12, 2012 22:11
To: Demikhovsky, Elena
Cc: Commit Messages and Patches for LLVM
Subject: Re: [llvm-commits] [PATCH][Review Request]Alternative Calling Convention


On Oct 11, 2012, at 7:56 AM, "Demikhovsky, Elena" <elena.demikhovsky at intel.com> wrote:
> 
> In this patch I’m introducing an alternative calling convention.
> 
> We  have an external library for OpenCL built-ins. The library is 
> compiled in non-standard way and has special calling conventions for passing parameters and preserving registers. It is done for code optimization.
> We’d like to commit these changes to LLVM.

+//Standard C conventions
+def CSR_32_Alt_SIMD    : CalleeSavedRegs<(add ESI, EDI, EBX, EBP)>;

Isn't this the same as CSR_32? You don't need to add a second definition.

+// Standard C + YMM6-15

Instead of the comment, just use the code to say that this is an extension of CSR_64:
  
  (add CSR_64, (sequence "YMM...

See ARMCallingConv.td.

+def CSR_Win64_Alt_SIMD : CalleeSavedRegs<(add RBX, RBP, RDI, RSI, R12, R13, 
+                                              R14, R15,
+                                         (sequence "XMM%u", 6, 15), 
+                                         (sequence "YMM%u", 6, 15))>;

This will cause ymm AND xmm registers to be saved in the prolog. I don't think that's what you want.

Please add a test case where an x86_alt_simd_cc function needs to spill vector registers in the prolog.

+  let Defs = [RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11,
+              FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, ST1,
+              MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
+              XMM0, XMM1, XMM2, XMM3, XMM4, XMM5,
+              YMM0, YMM1, YMM2, YMM3, YMM4, YMM5,
+              EFLAGS] in
+  def CALL_WIN64_ALT_SIMDr : I<0xFF, MRM2r, (outs), (ins GR64:$dst),

Please don't add new call instructions to support calling conventions. The TRI::getCallPreservedMask() function takes care of all that now.

/jakob

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alt_cc.diff
Type: application/octet-stream
Size: 17713 bytes
Desc: alt_cc.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121014/9feb31e7/attachment.obj>


More information about the llvm-commits mailing list