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. 5--- | 6 define void @foo() { 7 ret void 8 } 9... 10--- 11# CHECK: bb.3: 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 16name: foo 17alignment: 16 18tracksRegLiveness: true 19liveins: 20 - { reg: '$edi' } 21frameInfo: 22 stackSize: 16 23 offsetAdjustment: -16 24 maxAlignment: 16 25 hasCalls: true 26 maxCallFrameSize: 0 27 cvBytesOfCalleeSavedRegisters: 8 28fixedStack: 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 } 34machineFunctionInfo: {} 35body: | 36 bb.0: 37 successors: %bb.2(0x40000000), %bb.1(0x40000000) 38 liveins: $edi, $r12, $r13, $r14 39 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 53 JMP_1 %bb.1 54 55 bb.1: 56 successors: %bb.3(0x80000000) 57 58 renamable $r12 = IMPLICIT_DEF 59 renamable $r13 = IMPLICIT_DEF 60 renamable $r14 = IMPLICIT_DEF 61 JMP_1 %bb.3 62 63 bb.2: 64 liveins: $rcx 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 75 RET 0, killed $rax 76 77 bb.3: 78 successors: %bb.4(0x80000000) 79 80 renamable $rdi = IMPLICIT_DEF 81 renamable $rsi = IMPLICIT_DEF 82 83 bb.4: 84 liveins: $rcx 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 95 RET 0, killed $rax 96 97... 98