1 # RUN: llc -o - %s -mtriple=x86_64-- -verify-cfiinstrs \
2 # RUN: -run-pass=cfi-instr-inserter 2>&1 | FileCheck %s
3 # Test that CFI inserter inserts .cfi_offset/.cfi_register/.cfi_rel_offset
4 # properly for callee saved registers.
12 # CHECK: CFI_INSTRUCTION offset $rbp, -16
13 # CHECK-NEXT: CFI_INSTRUCTION offset $r12, -24
14 # CHECK-NEXT: CFI_INSTRUCTION register $r13, $rcx
15 # CHECK-NEXT: CFI_INSTRUCTION offset $r14, -40
18 tracksRegLiveness: true
27 cvBytesOfCalleeSavedRegisters: 8
29 - { id: 0, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$r14' }
30 - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$r12' }
31 - { id: 2, type: spill-slot, offset: -16, size: 8, alignment: 16 }
32 - { id: 3, type: spill-slot, offset: -16, size: 8, alignment: 16 }
33 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8 }
34 machineFunctionInfo: {}
37 successors: %bb.2(0x40000000), %bb.1(0x40000000)
38 liveins: $edi, $r12, $r13, $r14
40 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
41 CFI_INSTRUCTION def_cfa_offset 16
42 CFI_INSTRUCTION offset $rbp, -16
43 $rbp = frame-setup MOV64rr $rsp
44 CFI_INSTRUCTION def_cfa_register $rbp
45 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
46 $rcx = frame-setup COPY $r13
47 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
48 CFI_INSTRUCTION offset $r12, -24
49 CFI_INSTRUCTION register $r13, $rcx
50 CFI_INSTRUCTION rel_offset $r14, -24
51 TEST8rr renamable $dil, renamable $dil, implicit-def $eflags, implicit killed $edi
52 JCC_1 %bb.2, 4, implicit killed $eflags
56 successors: %bb.3(0x80000000)
58 renamable $r12 = IMPLICIT_DEF
59 renamable $r13 = IMPLICIT_DEF
60 renamable $r14 = IMPLICIT_DEF
65 dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $rax
66 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
67 $r13 = frame-destroy COPY $rcx
68 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
69 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
70 CFI_INSTRUCTION restore $rbp
71 CFI_INSTRUCTION restore $r12
72 CFI_INSTRUCTION restore $r13
73 CFI_INSTRUCTION restore $r14
74 CFI_INSTRUCTION def_cfa $rsp, 8
78 successors: %bb.4(0x80000000)
80 renamable $rdi = IMPLICIT_DEF
81 renamable $rsi = IMPLICIT_DEF
85 dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $rax
86 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
87 $r13 = frame-destroy COPY $rcx
88 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
89 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
90 CFI_INSTRUCTION restore $rbp
91 CFI_INSTRUCTION restore $r12
92 CFI_INSTRUCTION restore $r13
93 CFI_INSTRUCTION restore $r14
94 CFI_INSTRUCTION def_cfa $rsp, 8