forked from GPUOpen-Drivers/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply D70800: Fix AArch64 AAPCS frame record chain
Original Commit Message: After the commit r368987 (rG643adb55769e) was landed, the frame record (FP and LR register) may be placed in the middle of a stack frame if a function has both callee-saved general-purpose registers and floating point registers. This will break the stack unwinders that simply walk through the frame records (based on the guarantee from AAPCS64 "The Frame Pointer" section). This commit fixes the problem by adding the frame record offset. Patch By: logan
- Loading branch information
Showing
4 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -disable-post-ra --frame-pointer=all < %s | FileCheck %s | ||
|
||
; The purpose of this test is to verify that frame pointer (x29) | ||
; is correctly setup in the presence of callee-saved floating | ||
; point registers. The frame pointer should point to the frame | ||
; record, which is located 16 bytes above the end of the CSR | ||
; space when a single FP CSR is in use. | ||
define void @test1(i32) #26 { | ||
entry: | ||
call void asm sideeffect "nop", "~{d8}"() #26 | ||
ret void | ||
} | ||
; CHECK-LABEL: test1: | ||
; CHECK: str d8, [sp, #-32]! | ||
; CHECK-NEXT: stp x29, x30, [sp, #16] | ||
; CHECK-NEXT: add x29, sp, #16 | ||
; CHECK: nop | ||
; CHECK: ldp x29, x30, [sp, #16] | ||
; CHECK-NEXT: ldr d8, [sp], #32 | ||
; CHECK-NEXT: ret | ||
|
||
attributes #26 = { nounwind } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# RUN: llc -mtriple=aarch64-linux-gnu -start-before prologepilog %s -o - | FileCheck %s | ||
|
||
--- | ||
name: TestFrameRecordLocation | ||
tracksRegLiveness: true | ||
frameInfo: | ||
isFrameAddressTaken: true | ||
body: | | ||
bb.0: | ||
$d8 = IMPLICIT_DEF | ||
$d9 = IMPLICIT_DEF | ||
$x19 = IMPLICIT_DEF | ||
RET_ReallyLR | ||
# CHECK-LABEL: TestFrameRecordLocation | ||
|
||
# CHECK: stp d9, d8, [sp, #-48]! | ||
# CHECK: stp x29, x30, [sp, #16] | ||
# CHECK: str x19, [sp, #32] | ||
|
||
# CHECK: add x29, sp, #16 | ||
|
||
# CHECK: .cfi_def_cfa w29, 32 | ||
# CHECK: .cfi_offset w19, -16 | ||
# CHECK: .cfi_offset w30, -24 | ||
# CHECK: .cfi_offset w29, -32 | ||
# CHECK: .cfi_offset b8, -40 | ||
# CHECK: .cfi_offset b9, -48 | ||
... |