mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 07:31:47 +00:00
52f83a9ab3
The main issue being fixed here is that APCS targets handling a "byval align N" parameter with N > 4 were miscounting what objects were where on the stack, leading to FrameLowering setting the frame pointer incorrectly and clobbering the stack. But byval handling had grown over many years, and had multiple layers of cruft trying to compensate for each other and calculate padding correctly. This only really needs to be done once, in the HandleByVal function. Elsewhere should just do what it's told by that call. I also stripped out unnecessary APCS/AAPCS distinctions (now that Clang emits byvals with the correct C ABI alignment), which simplified HandleByVal. rdar://20095672 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231959 91177308-0d34-0410-b5e6-96231b3b80d8
31 lines
731 B
LLVM
31 lines
731 B
LLVM
; RUN: llc < %s -mtriple=armv7-linux-gnueabi | FileCheck %s
|
|
|
|
%struct.s = type { [4 x i32] }
|
|
@v = constant %struct.s zeroinitializer;
|
|
|
|
declare void @f(%struct.s* %p);
|
|
|
|
; CHECK-LABEL: t:
|
|
define void @t(i32 %a, %struct.s* byval %s) nounwind {
|
|
entry:
|
|
|
|
; Here we need to only check proper start address of restored %s argument.
|
|
; CHECK: sub sp, sp, #12
|
|
; CHECK: push {r11, lr}
|
|
; CHECK: sub sp, sp, #4
|
|
; CHECK: add r0, sp, #12
|
|
; CHECK: stm r0, {r1, r2, r3}
|
|
; CHECK: add r0, sp, #12
|
|
; CHECK-NEXT: bl f
|
|
call void @f(%struct.s* %s)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: caller:
|
|
define void @caller() {
|
|
|
|
; CHECK: ldm r0, {r1, r2, r3}
|
|
call void @t(i32 0, %struct.s* @v);
|
|
ret void
|
|
}
|