diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-11-02 12:00:58 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-11-02 12:00:58 +0000 |
commit | 4352a046c591aec0915c4f16d54d03b1d00c1efa (patch) | |
tree | 52b09d6e31d27dcdf6e4036cdafce6ee069e9a1c /test/CodeGen/MIR | |
parent | 1e702fd9054b0c7b66e16c5e3d67ed75f44b3a22 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/MIR')
-rw-r--r-- | test/CodeGen/MIR/AArch64/cfi-def-cfa.mir | 31 | ||||
-rw-r--r-- | test/CodeGen/MIR/AArch64/cfi.mir | 59 |
2 files changed, 59 insertions, 31 deletions
diff --git a/test/CodeGen/MIR/AArch64/cfi-def-cfa.mir b/test/CodeGen/MIR/AArch64/cfi-def-cfa.mir deleted file mode 100644 index a946b9f9f4a..00000000000 --- a/test/CodeGen/MIR/AArch64/cfi-def-cfa.mir +++ /dev/null @@ -1,31 +0,0 @@ -# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass none -o - %s | FileCheck %s -# This test ensures that the MIR parser parses the def_cfa operands -# correctly. - ---- | - - declare void @foo() - - define void @trivial_fp_func() { - entry: - call void @foo() - ret void - } - -... ---- -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 -... diff --git a/test/CodeGen/MIR/AArch64/cfi.mir b/test/CodeGen/MIR/AArch64/cfi.mir new file mode 100644 index 00000000000..8d9a2772afa --- /dev/null +++ b/test/CodeGen/MIR/AArch64/cfi.mir @@ -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 +... |