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

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Oct 12 13:11:19 PDT 2012


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





More information about the llvm-commits mailing list