200 lines · plain
1# RUN: llvm-mc -triple=i686-windows-msvc -filetype=obj < %s | llvm-readobj --codeview - | FileCheck %s2 3# Test for .cv_fpo_stackalign. We should generate FPO data that restores CSRs4# at each instruction, and in the last FrameData we should use the '@'5# alignment operator to define $T0, the vframe value.6 7# Based on this C code:8# void usevals(int, int, double*);9# int realign_with_csrs() {10# int a = getval();11# int b = getval();12# double __declspec(align(8)) force_alignment = 0.42;13# usevals(a, b, &force_alignment);14# return a + b;15# }16 17# CHECK: Subsection [18# CHECK: SubSectionType: Symbols (0xF1)19# CHECK: Compile3Sym {20# CHECK: Kind: S_COMPILE3 (0x113C)21# CHECK: }22# CHECK: ]23# CHECK: Subsection [24# CHECK: SubSectionType: FrameData (0xF5)25# CHECK: FrameData {26# CHECK: FrameFunc [27# CHECK: $T0 .raSearch =28# CHECK: $eip $T0 ^ =29# CHECK: $esp $T0 4 + =30# CHECK: ]31# CHECK: }32# CHECK: FrameData {33# CHECK: FrameFunc [34# CHECK: $T0 .raSearch =35# CHECK: $eip $T0 ^ =36# CHECK: $esp $T0 4 + =37# CHECK: $ebp $T0 4 - ^ =38# CHECK: ]39# CHECK: }40# CHECK: FrameData {41# CHECK: FrameFunc [42# CHECK: $T0 $ebp 4 + =43# CHECK: $eip $T0 ^ =44# CHECK: $esp $T0 4 + =45# CHECK: $ebp $T0 4 - ^ =46# CHECK: ]47# CHECK: }48# CHECK: FrameData {49# CHECK: FrameFunc [50# CHECK: $T0 $ebp 4 + =51# CHECK: $eip $T0 ^ =52# CHECK: $esp $T0 4 + =53# CHECK: $ebp $T0 4 - ^ =54# CHECK: $edi $T0 8 - ^ =55# CHECK: ]56# CHECK: }57# CHECK: FrameData {58# CHECK: FrameFunc [59# CHECK: $T0 $ebp 4 + =60# CHECK: $eip $T0 ^ =61# CHECK: $esp $T0 4 + =62# CHECK: $ebp $T0 4 - ^ =63# CHECK: $edi $T0 8 - ^ =64# CHECK: $esi $T0 12 - ^ =65# CHECK: ]66# CHECK: }67# CHECK: FrameData {68# CHECK: FrameFunc [69# CHECK: $T1 $ebp 4 + =70# CHECK: $T0 $T1 12 - 8 @ =71# CHECK: $eip $T1 ^ =72# CHECK: $esp $T1 4 + =73# CHECK: $ebp $T1 4 - ^ =74# CHECK: $edi $T1 8 - ^ =75# CHECK: $esi $T1 12 - ^ =76# CHECK: ]77# CHECK: }78# CHECK: ]79# CHECK: Subsection [80# CHECK: SubSectionType: Symbols (0xF1)81# CHECK: ]82# CHECK: Subsection [83# CHECK: SubSectionType: FileChecksums (0xF4)84# CHECK: ]85# CHECK: Subsection [86# CHECK: SubSectionType: StringTable (0xF3)87# CHECK: ]88 89 .text90 .def _realign_with_csrs; .scl 2; .type 32; .endef91 .globl _realign_with_csrs # -- Begin function realign_with_csrs92_realign_with_csrs: # @realign_with_csrs93Lfunc_begin0:94 .cv_func_id 095 .cv_file 1 "C:\\src\\llvm-project\\build\\t.c" "2A4F9B6BBBF7845521201755D1B14ACC" 196 .cv_loc 0 1 4 0 # t.c:4:097 .cv_fpo_proc _realign_with_csrs 098# %bb.0: # %entry99 pushl %ebp100 .cv_fpo_pushreg %ebp101 movl %esp, %ebp102 .cv_fpo_setframe %ebp103Ltmp0:104 pushl %edi105 .cv_fpo_pushreg %edi106 pushl %esi107 .cv_fpo_pushreg %esi108 andl $-8, %esp109 .cv_fpo_stackalign 8110 subl $8, %esp111 .cv_fpo_stackalloc 8112 .cv_fpo_endprologue113 .cv_loc 0 1 5 0 # t.c:5:0114 calll _getval115 movl %eax, %esi116 .cv_loc 0 1 6 0 # t.c:6:0117 calll _getval118 movl %eax, %edi119 movl %esp, %eax120 .cv_loc 0 1 7 0 # t.c:7:0121 movl $1071309127, 4(%esp) # imm = 0x3FDAE147122 movl $-1374389535, (%esp) # imm = 0xAE147AE1123 .cv_loc 0 1 8 0 # t.c:8:0124 pushl %eax125 pushl %edi126 pushl %esi127 calll _usevals128 addl $12, %esp129 .cv_loc 0 1 9 0 # t.c:9:0130 addl %esi, %edi131 movl %edi, %eax132 leal -8(%ebp), %esp133 popl %esi134 popl %edi135 popl %ebp136 retl137Ltmp1:138 .cv_fpo_endproc139Lfunc_end0:140 # -- End function141 .section .debug$S,"dr"142 .p2align 2143 .long 4 # Debug section magic144 .long 241145 .long Ltmp3-Ltmp2 # Subsection size146Ltmp2:147 .short Ltmp5-Ltmp4 # Record length148Ltmp4:149 .short 4412 # Record kind: S_COMPILE3150 .long 0 # Flags and language151 .short 7 # CPUType152 .short 8 # Frontend version153 .short 0154 .short 0155 .short 0156 .short 8000 # Backend version157 .short 0158 .short 0159 .short 0160 .asciz "clang version 8.0.0 " # Null-terminated compiler version string161Ltmp5:162Ltmp3:163 .p2align 2164 .cv_fpo_data _realign_with_csrs165 .long 241 # Symbol subsection for realign_with_csrs166 .long Ltmp7-Ltmp6 # Subsection size167Ltmp6:168 .short Ltmp9-Ltmp8 # Record length169Ltmp8:170 .short 4423 # Record kind: S_GPROC32_ID171 .long 0 # PtrParent172 .long 0 # PtrEnd173 .long 0 # PtrNext174 .long Lfunc_end0-_realign_with_csrs # Code size175 .long 0 # Offset after prologue176 .long 0 # Offset before epilogue177 .long 0 # Function type index178 .secrel32 _realign_with_csrs # Function section relative address179 .secidx _realign_with_csrs # Function section index180 .byte 0 # Flags181 .asciz "realign_with_csrs" # Function name182Ltmp9:183 .short Ltmp11-Ltmp10 # Record length184Ltmp10:185 .short 4114 # Record kind: S_FRAMEPROC186 .long 12 # FrameSize187 .long 0 # Padding188 .long 0 # Offset of padding189 .long 8 # Bytes of callee saved registers190 .long 0 # Exception handler offset191 .short 0 # Exception handler section192 .long 1196032 # Flags (defines frame register)193Ltmp11:194 .short 2 # Record length195 .short 4431 # Record kind: S_PROC_ID_END196Ltmp7:197 .p2align 2198 .cv_filechecksums # File index to string table offset subsection199 .cv_stringtable # String table200