[llvm-commits] [llvm] r67588 - /llvm/trunk/lib/Target/X86/X86CallingConv.td

Dan Gohman gohman at apple.com
Mon Mar 23 18:04:34 PDT 2009


Author: djg
Date: Mon Mar 23 20:04:34 2009
New Revision: 67588

URL: http://llvm.org/viewvc/llvm-project?rev=67588&view=rev
Log:
I was convinced that it's ok to allow a second i8 return value
to be returned in DL. LLVM's multiple-return-value support is
not ABI-conforming; front-ends that wish to have code emitted
that conforms to an ABI are currently expected to make
arrangements for this on their own rather than assuming that
multiple-return-values will automatically do the right thing.
This commit doesn't fundamentally change this situation.

Modified:
    llvm/trunk/lib/Target/X86/X86CallingConv.td

Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=67588&r1=67587&r2=67588&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Mar 23 20:04:34 2009
@@ -22,13 +22,14 @@
 
 // Return-value conventions common to all X86 CC's.
 def RetCC_X86Common : CallingConv<[
-  // Scalar values are returned in AX first, then DX, except for i8 where
-  // the convention is to return values in AL and AH. However, using AL and
-  // AH is problematic -- a return of {i16,i8} would end up using AX and AH,
-  // and one value would clobber the other. C front-ends are currently expected
-  // to pack two i8 values into an i16 in the rare situations where this
-  // is necessary.
-  CCIfType<[i8] , CCAssignToReg<[AL]>>,
+  // Scalar values are returned in AX first, then DX.  For i8, the ABI
+  // requires the values to be in AL and AH, however this code uses AL and DL
+  // instead. This is because using AH for the second register conflicts with
+  // the way LLVM does multiple return values -- a return of {i16,i8} would end
+  // up in AX and AH, which overlap. Front-ends wishing to conform to the ABI
+  // for functions that return two i8 values are currently expected to pack the
+  // values into an i16 (which uses AX, and thus AL:AH).
+  CCIfType<[i8] , CCAssignToReg<[AL, DL]>>,
   CCIfType<[i16], CCAssignToReg<[AX, DX]>>,
   CCIfType<[i32], CCAssignToReg<[EAX, EDX]>>,
   CCIfType<[i64], CCAssignToReg<[RAX, RDX]>>,





More information about the llvm-commits mailing list