
Skip inserting regular CFI instructions if using WinCFI. This is based a fair amount on the corresponding ARM64 implementation, but instead of trying to insert the SEH opcodes one by one where we generate other prolog/epilog instructions, we try to walk over the whole prolog/epilog range and insert them. This is done because in many cases, the exact number of instructions inserted is abstracted away deeper. For some cases, we manually insert specific SEH opcodes directly where instructions are generated, where the automatic mapping of instructions to SEH opcodes doesn't hold up (e.g. for __chkstk stack probes). Skip Thumb2SizeReduction for SEH prologs/epilogs, and force tail calls to wide instructions (just like on MachO), to make sure that the unwind info actually matches the width of the final instructions, without heuristics about what later passes will do. Mark SEH instructions as scheduling boundaries, to make sure that they aren't reordered away from the instruction they describe by PostRAScheduler. Mark the SEH instructions with the NoMerge flag, to avoid doing tail merging of functions that have multiple epilogs that all end with the same sequence of "b <other>; .seh_nop_w, .seh_endepilogue". Differential Revision: https://reviews.llvm.org/D125648
60 lines
1.6 KiB
LLVM
60 lines
1.6 KiB
LLVM
;; Check that epilogues aren't tail merged.
|
|
|
|
;; Check that this produces the expected assembly output
|
|
; RUN: llc -mtriple=thumbv7-windows -o - %s -verify-machineinstrs | FileCheck %s
|
|
;; Also try to write an object file, which verifies that the SEH opcodes
|
|
;; match the actual prologue/epilogue length.
|
|
; RUN: llc -mtriple=thumbv7-windows -filetype=obj -o %t.obj %s -verify-machineinstrs
|
|
|
|
; CHECK-LABEL: d:
|
|
; CHECK: .seh_proc d
|
|
|
|
; CHECK: push.w {r11, lr}
|
|
; CHECK-NEXT: .seh_save_regs_w {r11, lr}
|
|
; CHECK-NEXT: .seh_endprologue
|
|
|
|
; CHECK: .seh_startepilogue
|
|
; CHECK-NEXT: pop.w {r11, lr}
|
|
; CHECK-NEXT: .seh_save_regs_w {r11, lr}
|
|
; CHECK-NEXT: b.w b
|
|
; CHECK-NEXT: .seh_nop_w
|
|
; CHECK-NEXT: .seh_endepilogue
|
|
|
|
; CHECK: .seh_startepilogue
|
|
; CHECK-NEXT: pop.w {r11, lr}
|
|
; CHECK-NEXT: .seh_save_regs_w {r11, lr}
|
|
; CHECK-NEXT: b.w c
|
|
; CHECK-NEXT: .seh_nop_w
|
|
; CHECK-NEXT: .seh_endepilogue
|
|
; CHECK-NEXT: .seh_endproc
|
|
|
|
@a = global i32 0, align 4
|
|
|
|
define arm_aapcs_vfpcc void @d() optsize uwtable "frame-pointer"="none" {
|
|
entry:
|
|
%0 = load i32, ptr @a, align 4
|
|
switch i32 %0, label %if.then1 [
|
|
i32 10, label %if.then
|
|
i32 0, label %if.end2
|
|
]
|
|
|
|
if.then:
|
|
tail call arm_aapcs_vfpcc void @b()
|
|
br label %return
|
|
|
|
if.then1:
|
|
tail call arm_aapcs_vfpcc void @b()
|
|
br label %if.end2
|
|
|
|
if.end2:
|
|
tail call arm_aapcs_vfpcc void @c()
|
|
br label %return
|
|
|
|
return:
|
|
ret void
|
|
}
|
|
|
|
declare arm_aapcs_vfpcc void @b(...)
|
|
|
|
declare arm_aapcs_vfpcc void @c(...)
|