summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86CallingConv.td
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-09-04 22:59:58 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-09-04 22:59:58 +0000
commit4a03775777785ef758cff8c0699a6bf571a1f2b9 (patch)
treea3e8d527e079840bf5627f2e68f73f901728eb1e /lib/Target/X86/X86CallingConv.td
parentdeafefabae915cf20884fd829d2542f9626786e8 (diff)
downloadllvm-4a03775777785ef758cff8c0699a6bf571a1f2b9.tar.gz
llvm-4a03775777785ef758cff8c0699a6bf571a1f2b9.tar.bz2
llvm-4a03775777785ef758cff8c0699a6bf571a1f2b9.tar.xz
For whatever the reason, x86 CallingConv::Fast (i.e. fastcc) was not passing scalar arguments in registers. This patch defines a new fastcc CC which is slightly different from the FastCall CC. In addition to passing integer arguments in ECX and EDX, it also specify doubles are passed in 8-byte slots which are 8-byte aligned (instead of 4-byte aligned). This avoids a potential performance hazard where doubles span cacheline boundaries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86CallingConv.td')
-rw-r--r--lib/Target/X86/X86CallingConv.td17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td
index 32f53ab8b1..549eb9b9a2 100644
--- a/lib/Target/X86/X86CallingConv.td
+++ b/lib/Target/X86/X86CallingConv.td
@@ -341,3 +341,20 @@ def CC_X86_32_FastCall : CallingConv<[
// Otherwise, same as everything else.
CCDelegateTo<CC_X86_32_Common>
]>;
+
+def CC_X86_32_FastCC : CallingConv<[
+ // Promote i8/i16 arguments to i32.
+ CCIfType<[i8, i16], CCPromoteToType<i32>>,
+
+ // The 'nest' parameter, if any, is passed in EAX.
+ CCIfNest<CCAssignToReg<[EAX]>>,
+
+ // The first 2 integer arguments are passed in ECX/EDX
+ CCIfType<[i32], CCAssignToReg<[ECX, EDX]>>,
+
+ // Doubles get 8-byte slots that are 8-byte aligned.
+ CCIfType<[f64], CCAssignToStack<8, 8>>,
+
+ // Otherwise, same as everything else.
+ CCDelegateTo<CC_X86_32_Common>
+]>;