From 1d86f6730f70de4234b1c09841eebf64c692625f Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Mon, 16 Dec 2013 19:53:31 +0000 Subject: [PATCH] [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 --- lib/Target/X86/X86CallingConv.td | 4 ++++ test/CodeGen/X86/patchpoint.ll | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td index 31c62c3f5e2..ef8caa0290e 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>, + // 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 0265dc76ba4..ef30cf78bf2 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 }