-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AsmPrinterDwarf] Add support for .cfi_restore directive
As of today we only use .cfi_offset to specify the offset of a CSR, but we never use .cfi_restore when the CSR is restored. If we want to perform a more advanced type of shrink-wrapping, we need to use .cfi_restore in order to switch the CFI state between blocks. This patch only aims at adding support for the directive. Differential Revision: https://reviews.llvm.org/D36114 llvm-svn: 317199
- Loading branch information
Showing
10 changed files
with
148 additions
and
31 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
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
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,37 @@ | ||
# RUN: llc -mtriple=aarch64-- -start-after prologepilog -o - %s | FileCheck %s | ||
--- | ||
name: fun | ||
# CHECK: .cfi_startproc | ||
tracksRegLiveness: true | ||
frameInfo: | ||
stackSize: 16 | ||
maxAlignment: 8 | ||
hasCalls: true | ||
stack: | ||
- { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: 0, | ||
callee-saved-register: '%lr' } | ||
- { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: 0, | ||
callee-saved-register: '%fp' } | ||
body: | | ||
bb.0: | ||
liveins: %fp, %lr | ||
%sp = frame-setup SUBXri %sp, 16, 0 | ||
frame-setup STRXui killed %fp, %sp, 0 :: (store 8 into %stack.1) | ||
frame-setup CFI_INSTRUCTION offset %w29, -16 | ||
; CHECK: .cfi_offset w29, -16 | ||
frame-setup STRXui killed %lr, %sp, 1 :: (store 8 into %stack.0) | ||
frame-setup CFI_INSTRUCTION offset %w30, -8 | ||
; CHECK: .cfi_offset w30, -8 | ||
%fp = frame-setup ADDXri %sp, 0, 0 | ||
frame-setup CFI_INSTRUCTION def_cfa %w29, 16 | ||
%lr = LDRXui %sp, 1 :: (load 8 from %stack.0) | ||
CFI_INSTRUCTION restore %w30 | ||
; CHECK: .cfi_restore w30 | ||
%fp = LDRXui %sp, 0 :: (load 8 from %stack.1) | ||
CFI_INSTRUCTION restore %w29 | ||
; CHECK: .cfi_restore w29 | ||
%sp = ADDXri %sp, 16, 0 | ||
RET_ReallyLR | ||
; CHECK: .cfi_endproc | ||
... |
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass none -o - %s | FileCheck %s | ||
# This test ensures that the MIR parser parses the cfi directives correctly. | ||
|
||
--- | | ||
|
||
declare void @foo() | ||
|
||
define void @trivial_fp_func() { | ||
entry: | ||
call void @foo() | ||
ret void | ||
} | ||
|
||
define void @trivial_fp_func_restore() { | ||
entry: | ||
call void @foo() | ||
ret void | ||
} | ||
|
||
... | ||
--- | ||
name: trivial_fp_func | ||
# CHECK-LABEL: name: trivial_fp_func | ||
body: | | ||
bb.0.entry: | ||
liveins: %lr, %fp, %lr, %fp | ||
%sp = frame-setup STPXpre killed %fp, killed %lr, %sp, -2 | ||
%fp = frame-setup ADDXri %sp, 0, 0 | ||
; CHECK: CFI_INSTRUCTION def_cfa %w29, 16 | ||
frame-setup CFI_INSTRUCTION def_cfa %w29, 16 | ||
frame-setup CFI_INSTRUCTION offset %w30, -8 | ||
frame-setup CFI_INSTRUCTION offset %w29, -16 | ||
BL @foo, csr_aarch64_aapcs, implicit-def dead %lr, implicit %sp, implicit-def %sp | ||
%sp, %fp, %lr = LDPXpost %sp, 2 | ||
RET_ReallyLR | ||
... | ||
--- | ||
name: trivial_fp_func_restore | ||
# CHECK-LABEL: name: trivial_fp_func_restore | ||
body: | | ||
bb.0.entry: | ||
liveins: %lr, %fp | ||
%sp = frame-setup STPXpre killed %fp, killed %lr, %sp, -2 | ||
%fp = frame-setup ADDXri %sp, 0, 0 | ||
frame-setup CFI_INSTRUCTION def_cfa %w29, 16 | ||
frame-setup CFI_INSTRUCTION offset %w30, -8 | ||
; CHECK: CFI_INSTRUCTION offset %w30, -8 | ||
frame-setup CFI_INSTRUCTION offset %w29, -16 | ||
; CHECK: CFI_INSTRUCTION offset %w29, -16 | ||
BL @foo, csr_aarch64_aapcs, implicit-def dead %lr, implicit %sp, implicit-def %sp | ||
%sp, %fp, %lr = LDPXpost %sp, 2 | ||
CFI_INSTRUCTION restore %w30 | ||
; CHECK: CFI_INSTRUCTION restore %w30 | ||
CFI_INSTRUCTION restore %w29 | ||
; CHECK: CFI_INSTRUCTION restore %w29 | ||
RET_ReallyLR | ||
... |
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,26 @@ | ||
// RUN: llvm-mc -triple aarch64-- -o - %s | FileCheck %s | ||
|
||
fun: | ||
.cfi_startproc | ||
// CHECK: .cfi_startproc | ||
stp x29, x30, [sp, #-16]! | ||
.Lcfi0: | ||
.cfi_offset w29, -16 | ||
// CHECK: .cfi_offset w29, -16 | ||
.Lcfi1: | ||
.cfi_offset w30, -8 | ||
// CHECK: .cfi_offset w30, -8 | ||
mov x29, sp | ||
.Lcfi2: | ||
.cfi_def_cfa w29, 16 | ||
// CHECK: .cfi_def_cfa w29, 16 | ||
.Lcfi3: | ||
.cfi_restore w30 | ||
// CHECK: .cfi_restore w30 | ||
ldr x29, [sp], #16 | ||
.Lcfi4: | ||
.cfi_restore w29 | ||
// CHECK: .cfi_restore w29 | ||
ret | ||
.cfi_endproc | ||
// CHECK: .cfi_endproc |