mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 07:31:53 +00:00
029ad727ae
The x86 ret instruction has a 16 bit immediate indicating how many bytes to pop off of the stack beyond the return address. There is a problem when extremely large structs are passed by value: we might not be able to fit the number of bytes to pop into the return instruction. To fix this, expand RET_FLAG a little later and use a special sequence to clean the stack: pop %ecx ; return address is now in %ecx add $n, %esp ; clean the stack push %ecx ; bring the return address back on the stack ret ; pop the return address and jmp to it's value git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262755 91177308-0d34-0410-b5e6-96231b3b80d8
23 lines
598 B
LLVM
23 lines
598 B
LLVM
; RUN: llc < %s | FileCheck %s
|
|
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
|
|
target triple = "i386-pc-windows-msvc"
|
|
|
|
define x86_fastcallcc i32 @test1(i32 inreg %V, [65533 x i8]* byval %p_arg) {
|
|
ret i32 %V
|
|
}
|
|
; CHECK-LABEL: @test1@65540:
|
|
; CHECK: movl %ecx, %eax
|
|
; CHECK-NEXT: popl %ecx
|
|
; CHECK-NEXT: addl $65536, %esp
|
|
; CHECK-NEXT: pushl %ecx
|
|
; CHECK-NEXT: retl
|
|
|
|
define x86_stdcallcc void @test2([65533 x i8]* byval %p_arg) {
|
|
ret void
|
|
}
|
|
; CHECK-LABEL: _test2@65536:
|
|
; CHECK: popl %ecx
|
|
; CHECK-NEXT: addl $65536, %esp
|
|
; CHECK-NEXT: pushl %ecx
|
|
; CHECK-NEXT: retl
|