Home | History | Annotate | Download | only in COFF
      1 ; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -O0 < %s | FileCheck --check-prefix=X86 %s
      2 ; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 < %s | llvm-mc -triple=i686-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview | FileCheck --check-prefix=OBJ32 %s
      3 ; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -O0 < %s | FileCheck --check-prefix=X64 %s
      4 ; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -o - -O0 < %s | llvm-mc -triple=x86_64-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview | FileCheck --check-prefix=OBJ64 %s
      5 
      6 ; This LL file was generated by running clang on the following code:
      7 ; D:\asm.c:
      8 ;  1 void g(void);
      9 ;  2
     10 ;  3 void f(void) {
     11 ;  4   __asm align 4;
     12 ;  5   g();
     13 ;  6 }
     14 
     15 ; X86-LABEL: _f:
     16 ; X86:      # BB
     17 ; X86-NEXT: [[ASM_LINE:^L.*]]:{{$}}
     18 ; X86:      [[CALL_LINE:^L.*]]:{{$}}
     19 ; X86:      calll   _g
     20 ; X86-NEXT: [[RETURN_STMT:.*]]:
     21 ; X86:      ret
     22 ; X86-NEXT: [[END_OF_F:^L.*]]:
     23 ;
     24 ; X86-LABEL: .section        .debug$S,"dr"
     25 ; X86-NEXT: .long   4
     26 ; Symbol subsection
     27 ; X86-NEXT: .long   241
     28 ; X86-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]]
     29 ; X86-NEXT: [[F1_START]]:
     30 ; X86-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]]
     31 ; X86-NEXT: [[PROC_SEGMENT_START]]:
     32 ; X86-NEXT: .short  4423
     33 ; X86-NEXT: .zero   12
     34 ; X86-NEXT: .long [[END_OF_F]]-_f
     35 ; X86-NEXT: .zero   12
     36 ; X86-NEXT: .secrel32 _f
     37 ; X86-NEXT: .secidx _f
     38 ; X86-NEXT: .byte   0
     39 ; X86-NEXT: .byte   102
     40 ; X86-NEXT: .byte   0
     41 ; X86-NEXT: [[PROC_SEGMENT_END]]:
     42 ; X86-NEXT: .short  2
     43 ; X86-NEXT: .short  4431
     44 ; X86-NEXT: [[F1_END]]:
     45 ; Padding
     46 ; X86-NEXT: .zero   3
     47 ; Line table
     48 ; X86-NEXT: .long   242
     49 ; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
     50 ; X86-NEXT: [[F2_START]]:
     51 ; X86-NEXT: .secrel32 _f
     52 ; X86-NEXT: .secidx _f
     53 ; X86-NEXT: .short 1
     54 ; X86-NEXT: .long [[END_OF_F]]-_f
     55 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
     56 ; X86-NEXT: .long   0
     57 ; X86-NEXT: .long   3
     58 ; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
     59 ; X86-NEXT: .long [[ASM_LINE]]-_f
     60 ; X86-NEXT: .long   4
     61 ; X86-NEXT: .long [[CALL_LINE]]-_f
     62 ; X86-NEXT: .long   5
     63 ; X86-NEXT: .long [[RETURN_STMT]]-_f
     64 ; X86-NEXT: .long   6
     65 ; X86-NEXT: .short  0
     66 ; X86-NEXT: .short  0
     67 ; X86-NEXT: .short  0
     68 ; X86-NEXT: .short  0
     69 ; X86-NEXT: .short  0
     70 ; X86-NEXT: .short  0
     71 ; X86-NEXT: [[FILE_SEGMENT_END]]:
     72 ; X86-NEXT: [[F2_END]]:
     73 ; File index to string table offset subsection
     74 ; X86-NEXT: .long   244
     75 ; X86-NEXT: .long   8
     76 ; X86-NEXT: .long   1
     77 ; X86-NEXT: .long   0
     78 ; String table
     79 ; X86-NEXT: .long   243
     80 ; X86-NEXT: .long   10
     81 ; X86-NEXT: .byte   0
     82 ; X86-NEXT: .ascii  "D:\\asm.c"
     83 ; X86-NEXT: .byte   0
     84 ; Padding
     85 ; X86-NEXT: .zero   2
     86 
     87 ; OBJ32:    Section {
     88 ; OBJ32:      Name: .debug$S (2E 64 65 62 75 67 24 53)
     89 ; OBJ32:      Characteristics [ (0x42100040)
     90 ; OBJ32:      ]
     91 ; OBJ32:      Relocations [
     92 ; OBJ32-NEXT:   0x2C IMAGE_REL_I386_SECREL _f
     93 ; OBJ32-NEXT:   0x30 IMAGE_REL_I386_SECTION _f
     94 ; OBJ32-NEXT:   0x44 IMAGE_REL_I386_SECREL _f
     95 ; OBJ32-NEXT:   0x48 IMAGE_REL_I386_SECTION _f
     96 ; OBJ32-NEXT: ]
     97 ; OBJ32:    CodeViewDebugInfo [
     98 ; OBJ32:      Subsection [
     99 ; OBJ32-NEXT:   Type: 0xF1
    100 ; OBJ32-NOT:    ]
    101 ; OBJ32:        ProcStart {
    102 ; OBJ32-NEXT:     DisplayName: f
    103 ; OBJ32-NEXT:     Section: _f
    104 ; OBJ32-NEXT:     CodeSize: 0x6
    105 ; OBJ32-NEXT:   }
    106 ; OBJ32-NEXT:   ProcEnd
    107 ; OBJ32-NEXT: ]
    108 ; OBJ32:      FunctionLineTable [
    109 ; OBJ32-NEXT:   Name: _f
    110 ; OBJ32-NEXT:   Flags: 0x1
    111 ; OBJ32-NEXT:   CodeSize: 0x6
    112 ; OBJ32-NEXT:   FilenameSegment [
    113 ; OBJ32-NEXT:     Filename: D:\asm.c
    114 ; FIXME: An empty __asm stmt creates an extra entry.
    115 ; We seem to know that these offsets are the same statically during the
    116 ; execution of endModule().  See PR18679 for the details.
    117 ; OBJ32-NEXT:     +0x0: 4
    118 ; OBJ32-NEXT:     +0x0: 5
    119 ; OBJ32-NEXT:     +0x5: 6
    120 ; OBJ32-NEXT:     ColStart: 0
    121 ; OBJ32-NEXT:     ColEnd: 0
    122 ; OBJ32-NEXT:     ColStart: 0
    123 ; OBJ32-NEXT:     ColEnd: 0
    124 ; OBJ32-NEXT:     ColStart: 0
    125 ; OBJ32-NEXT:     ColEnd: 0
    126 ; OBJ32-NEXT:   ]
    127 ; OBJ32-NEXT: ]
    128 
    129 ; X64-LABEL: f:
    130 ; X64-NEXT: .L{{.*}}:{{$}}
    131 ; X64-NEXT: [[START:.*]]:{{$}}
    132 ; X64:      # BB
    133 ; X64:      subq    $40, %rsp
    134 ; X64-NEXT: [[ASM_LINE:.*]]:{{$}}
    135 ; X64:      [[CALL_LINE:.*]]:{{$}}
    136 ; X64:      callq   g
    137 ; X64-NEXT: [[EPILOG_AND_RET:.*]]:
    138 ; X64:      addq    $40, %rsp
    139 ; X64-NEXT: ret
    140 ; X64-NEXT: [[END_OF_F:.*]]:
    141 ;
    142 ; X64-LABEL: .section        .debug$S,"dr"
    143 ; X64-NEXT: .long   4
    144 ; Symbol subsection
    145 ; X64-NEXT: .long   241
    146 ; X64-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]]
    147 ; X64-NEXT: [[F1_START]]:
    148 ; X64-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]]
    149 ; X64-NEXT: [[PROC_SEGMENT_START]]:
    150 ; X64-NEXT: .short  4423
    151 ; X64-NEXT: .zero   12
    152 ; X64-NEXT: .long [[END_OF_F]]-f
    153 ; X64-NEXT: .zero   12
    154 ; X64-NEXT: .secrel32 f
    155 ; X64-NEXT: .secidx f
    156 ; X64-NEXT: .byte   0
    157 ; X64-NEXT: .byte   102
    158 ; X64-NEXT: .byte   0
    159 ; X64-NEXT: [[PROC_SEGMENT_END]]:
    160 ; X64-NEXT: .short  2
    161 ; X64-NEXT: .short  4431
    162 ; X64-NEXT: [[F1_END]]:
    163 ; Padding
    164 ; X64-NEXT: .zero   3
    165 ; Line table
    166 ; X64-NEXT: .long   242
    167 ; X64-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
    168 ; X64-NEXT: [[F2_START]]:
    169 ; X64-NEXT: .secrel32 f
    170 ; X64-NEXT: .secidx f
    171 ; X64-NEXT: .short 1
    172 ; X64-NEXT: .long [[END_OF_F]]-f
    173 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
    174 ; X64-NEXT: .long   0
    175 ; X64-NEXT: .long   4
    176 ; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
    177 ; X64-NEXT: .long [[START]]-f
    178 ; X64-NEXT: .long   3
    179 ; X64-NEXT: .long [[ASM_LINE]]-f
    180 ; X64-NEXT: .long   4
    181 ; X64-NEXT: .long [[CALL_LINE]]-f
    182 ; X64-NEXT: .long   5
    183 ; X64-NEXT: .long [[EPILOG_AND_RET]]-f
    184 ; X64-NEXT: .long   6
    185 ; X64-NEXT: .short  0
    186 ; X64-NEXT: .short  0
    187 ; X64-NEXT: .short  0
    188 ; X64-NEXT: .short  0
    189 ; X64-NEXT: .short  0
    190 ; X64-NEXT: .short  0
    191 ; X64-NEXT: .short  0
    192 ; X64-NEXT: .short  0
    193 ; X64-NEXT: [[FILE_SEGMENT_END]]:
    194 ; X64-NEXT: [[F2_END]]:
    195 ; File index to string table offset subsection
    196 ; X64-NEXT: .long   244
    197 ; X64-NEXT: .long   8
    198 ; X64-NEXT: .long   1
    199 ; X64-NEXT: .long   0
    200 ; String table
    201 ; X64-NEXT: .long   243
    202 ; X64-NEXT: .long   10
    203 ; X64-NEXT: .byte   0
    204 ; X64-NEXT: .ascii  "D:\\asm.c"
    205 ; X64-NEXT: .byte   0
    206 ; Padding
    207 ; X64-NEXT: .zero   2
    208 
    209 ; OBJ64:    Section {
    210 ; OBJ64:      Name: .debug$S (2E 64 65 62 75 67 24 53)
    211 ; OBJ64:      Characteristics [ (0x42100040)
    212 ; OBJ64:      ]
    213 ; OBJ64:      Relocations [
    214 ; OBJ64-NEXT:   0x2C IMAGE_REL_AMD64_SECREL f
    215 ; OBJ64-NEXT:   0x30 IMAGE_REL_AMD64_SECTION f
    216 ; OBJ64-NEXT:   0x44 IMAGE_REL_AMD64_SECREL f
    217 ; OBJ64-NEXT:   0x48 IMAGE_REL_AMD64_SECTION f
    218 ; OBJ64-NEXT: ]
    219 ; OBJ64:      Subsection [
    220 ; OBJ64-NEXT:   Type: 0xF1
    221 ; OBJ64-NOT:    ]
    222 ; OBJ64:        ProcStart {
    223 ; OBJ64-NEXT:     DisplayName: f
    224 ; OBJ64-NEXT:     Section: f
    225 ; OBJ64-NEXT:     CodeSize: 0xE
    226 ; OBJ64-NEXT:   }
    227 ; OBJ64-NEXT:   ProcEnd
    228 ; OBJ64-NEXT: ]
    229 ; OBJ64:      FunctionLineTable [
    230 ; OBJ64-NEXT:   Name: f
    231 ; OBJ64-NEXT:   Flags: 0x1
    232 ; OBJ64-NEXT:   CodeSize: 0xE
    233 ; OBJ64-NEXT:   FilenameSegment [
    234 ; OBJ64-NEXT:     Filename: D:\asm.c
    235 ; OBJ64-NEXT:     +0x0: 3
    236 ; FIXME: An empty __asm stmt creates an extra entry.
    237 ; See PR18679 for the details.
    238 ; OBJ64-NEXT:     +0x4: 4
    239 ; OBJ64-NEXT:     +0x4: 5
    240 ; OBJ64-NEXT:     +0x9: 6
    241 ; OBJ64-NEXT:     ColStart: 0
    242 ; OBJ64-NEXT:     ColEnd: 0
    243 ; OBJ64-NEXT:     ColStart: 0
    244 ; OBJ64-NEXT:     ColEnd: 0
    245 ; OBJ64-NEXT:     ColStart: 0
    246 ; OBJ64-NEXT:     ColEnd: 0
    247 ; OBJ64-NEXT:     ColStart: 0
    248 ; OBJ64-NEXT:     ColEnd: 0
    249 ; OBJ64-NEXT:   ]
    250 ; OBJ64-NEXT: ]
    251 
    252 ; Function Attrs: nounwind
    253 define void @f() #0 !dbg !4 {
    254 entry:
    255   call void asm sideeffect inteldialect ".align 4", "~{dirflag},~{fpsr},~{flags}"() #2, !dbg !12
    256   call void @g(), !dbg !13
    257   ret void, !dbg !14
    258 }
    259 
    260 declare void @g() #1
    261 
    262 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
    263 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
    264 attributes #2 = { nounwind }
    265 
    266 !llvm.dbg.cu = !{!0}
    267 !llvm.module.flags = !{!9, !10}
    268 !llvm.ident = !{!11}
    269 
    270 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
    271 !1 = !DIFile(filename: "<unknown>", directory: "D:\5C")
    272 !2 = !{}
    273 !3 = !{!4}
    274 !4 = distinct !DISubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !5, scope: !6, type: !7, variables: !2)
    275 !5 = !DIFile(filename: "asm.c", directory: "D:\5C")
    276 !6 = !DIFile(filename: "asm.c", directory: "D:C")
    277 !7 = !DISubroutineType(types: !8)
    278 !8 = !{null}
    279 !9 = !{i32 2, !"CodeView", i32 1}
    280 !10 = !{i32 1, !"Debug Info Version", i32 3}
    281 !11 = !{!"clang version 3.5 "}
    282 !12 = !DILocation(line: 4, scope: !4)
    283 !13 = !DILocation(line: 5, scope: !4)
    284 !14 = !DILocation(line: 6, scope: !4)
    285