summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2013-12-16 19:53:31 +0000
committerJuergen Ributzka <juergen@apple.com>2013-12-16 19:53:31 +0000
commit1d86f6730f70de4234b1c09841eebf64c692625f (patch)
treecedd2abb76ec6f95fde2d797329dc0135bcfe646
parentb961a26cec1e7b7b96edc200ef8d09fc12c11088 (diff)
downloadllvm-1d86f6730f70de4234b1c09841eebf64c692625f.tar.gz
llvm-1d86f6730f70de4234b1c09841eebf64c692625f.tar.bz2
llvm-1d86f6730f70de4234b1c09841eebf64c692625f.tar.xz
[Stackmap] The first integer argument is passed in register for the WebKit_JS calling convention.
Pass the first integer argument (callee) in register to optimize inline caches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197416 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86CallingConv.td4
-rw-r--r--test/CodeGen/X86/patchpoint.ll10
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td
index 31c62c3f5e..ef8caa0290 100644
--- a/lib/Target/X86/X86CallingConv.td
+++ b/lib/Target/X86/X86CallingConv.td
@@ -357,6 +357,10 @@ def CC_X86_64_WebKit_JS : CallingConv<[
// Promote i8/i16 arguments to i32.
CCIfType<[i8, i16], CCPromoteToType<i32>>,
+ // Only the first integer argument is passed in register.
+ CCIfType<[i32], CCAssignToReg<[EDI]>>,
+ CCIfType<[i64], CCAssignToReg<[RDI]>>,
+
// Integer/FP values are always stored in stack slots that are 8 bytes in size
// and 8-byte aligned.
CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>
diff --git a/test/CodeGen/X86/patchpoint.ll b/test/CodeGen/X86/patchpoint.ll
index 0265dc76ba..ef30cf78bf 100644
--- a/test/CodeGen/X86/patchpoint.ll
+++ b/test/CodeGen/X86/patchpoint.ll
@@ -39,23 +39,23 @@ entry:
}
; Test the webkit_jscc calling convention.
-; Two arguments will be pushed on the stack.
+; One argument will be passed in register, the other will be pushed on the stack.
; Return value in $rax.
define void @jscall_patchpoint_codegen(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
entry:
; CHECK-LABEL: jscall_patchpoint_codegen:
; CHECK: Ltmp
-; CHECK: movq %r{{.+}}, 8(%rsp)
; CHECK: movq %r{{.+}}, (%rsp)
+; CHECK: movq %r{{.+}}, %rdi
; CHECK: Ltmp
; CHECK-NEXT: movabsq $-559038736, %r11
; CHECK-NEXT: callq *%r11
-; CHECK: movq %rax, 8(%rsp)
+; CHECK: movq %rax, (%rsp)
; CHECK: callq
%resolveCall2 = inttoptr i64 -559038736 to i8*
- %result = tail call webkit_jscc i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i64 5, i32 15, i8* %resolveCall2, i32 2, i64 %p1, i64 %p2)
+ %result = tail call webkit_jscc i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i64 5, i32 15, i8* %resolveCall2, i32 2, i64 %p4, i64 %p2)
%resolveCall3 = inttoptr i64 -559038737 to i8*
- tail call webkit_jscc void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 6, i32 15, i8* %resolveCall3, i32 2, i64 %p1, i64 %result)
+ tail call webkit_jscc void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 6, i32 15, i8* %resolveCall3, i32 2, i64 %p4, i64 %result)
ret void
}