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: .cv_file 1 "D:\\asm.c" 17; X86: .cv_loc 0 1 4 0 is_stmt 0 18; X86: .cv_loc 0 1 5 0 19; X86: calll _g 20; X86: .cv_loc 0 1 6 0 21; X86: ret 22; X86: [[END_OF_F:.?Lfunc_end.*]]: 23; 24; X86-LABEL: .section .debug$S,"dr" 25; X86-NEXT: .p2align 2 26; X86-NEXT: .long 4 27; Symbol subsection 28; X86-NEXT: .long 241 29; X86-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]] # 30; X86-NEXT: [[F1_START]]: 31; X86-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]] # 32; X86-NEXT: [[PROC_SEGMENT_START]]: 33; X86-NEXT: .short 4423 34; X86-NEXT: .long 0 35; X86-NEXT: .long 0 36; X86-NEXT: .long 0 37; X86-NEXT: .long [[END_OF_F]]-_f 38; X86-NEXT: .long 0 39; X86-NEXT: .long 0 40; X86-NEXT: .long 4098 41; X86-NEXT: .secrel32 _f 42; X86-NEXT: .secidx _f 43; X86-NEXT: .byte 0 44; X86-NEXT: .asciz "f" 45; X86-NEXT: [[PROC_SEGMENT_END]]: 46; X86-NEXT: .short 2 47; X86-NEXT: .short 4431 48; X86-NEXT: [[F1_END]]: 49; X86-NEXT: .p2align 2 50; Line table 51; X86-NEXT: .cv_linetable 0, _f, [[END_OF_F]] 52; File index to string table offset subsection 53; X86-NEXT: .cv_filechecksums 54; String table 55; X86-NEXT: .cv_stringtable 56 57; OBJ32: Section { 58; OBJ32: Name: .debug$S (2E 64 65 62 75 67 24 53) 59; OBJ32: Characteristics [ (0x42300040) 60; OBJ32: ] 61; OBJ32: Relocations [ 62; OBJ32-NEXT: 0x2C IMAGE_REL_I386_SECREL _f 63; OBJ32-NEXT: 0x30 IMAGE_REL_I386_SECTION _f 64; OBJ32-NEXT: 0x44 IMAGE_REL_I386_SECREL _f 65; OBJ32-NEXT: 0x48 IMAGE_REL_I386_SECTION _f 66; OBJ32-NEXT: ] 67; OBJ32: CodeViewDebugInfo [ 68; OBJ32: Subsection [ 69; OBJ32-NEXT: SubSectionType: Symbols (0xF1) 70; OBJ32-NOT: ] 71; OBJ32: ProcStart { 72; OBJ32: CodeSize: 0x6 73; OBJ32: DisplayName: f 74; OBJ32: LinkageName: _f 75; OBJ32: } 76; OBJ32: ProcEnd { 77; OBJ32: } 78; OBJ32-NEXT: ] 79; OBJ32: FunctionLineTable [ 80; OBJ32-NEXT: Name: _f 81; OBJ32-NEXT: Flags: 0x0 82; OBJ32-NEXT: CodeSize: 0x6 83; OBJ32-NEXT: FilenameSegment [ 84; OBJ32-NEXT: Filename: D:\asm.c 85; FIXME: An empty __asm stmt creates an extra entry. 86; We seem to know that these offsets are the same statically during the 87; execution of endModule(). See PR18679 for the details. 88; OBJ32-NEXT: +0x0 [ 89; OBJ32-NEXT: LineNumberStart: 4 90; OBJ32-NEXT: LineNumberEndDelta: 0 91; OBJ32-NEXT: IsStatement: No 92; OBJ32-NEXT: ] 93; OBJ32-NEXT: +0x0 [ 94; OBJ32-NEXT: LineNumberStart: 5 95; OBJ32-NEXT: LineNumberEndDelta: 0 96; OBJ32-NEXT: IsStatement: No 97; OBJ32-NEXT: ] 98; OBJ32-NEXT: +0x5 [ 99; OBJ32-NEXT: LineNumberStart: 6 100; OBJ32-NEXT: LineNumberEndDelta: 0 101; OBJ32-NEXT: IsStatement: No 102; OBJ32-NEXT: ] 103; OBJ32-NEXT: ] 104 105; X64-LABEL: f: 106; X64: .cv_file 1 "D:\\asm.c" 107; X64: .cv_loc 0 1 3 0 is_stmt 0 108; X64: subq $40, %rsp 109; X64: .cv_loc 0 1 4 0 110; X64: .cv_loc 0 1 5 0 111; X64: callq g 112; X64: .cv_loc 0 1 6 0 113; X64: addq $40, %rsp 114; X64-NEXT: ret 115; X64: [[END_OF_F:.?Lfunc_end.*]]: 116; 117; X64-LABEL: .section .debug$S,"dr" 118; X64-NEXT: .p2align 2 119; X64-NEXT: .long 4 120; Symbol subsection 121; X64-NEXT: .long 241 122; X64-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]] # 123; X64-NEXT: [[F1_START]]: 124; X64-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]] # 125; X64-NEXT: [[PROC_SEGMENT_START]]: 126; X64-NEXT: .short 4423 127; X64-NEXT: .long 0 128; X64-NEXT: .long 0 129; X64-NEXT: .long 0 130; X64-NEXT: .long [[END_OF_F]]-f 131; X64-NEXT: .long 0 132; X64-NEXT: .long 0 133; X64-NEXT: .long 4098 134; X64-NEXT: .secrel32 f 135; X64-NEXT: .secidx f 136; X64-NEXT: .byte 0 137; X64-NEXT: .asciz "f" 138; X64-NEXT: [[PROC_SEGMENT_END]]: 139; X64-NEXT: .short 2 140; X64-NEXT: .short 4431 141; X64-NEXT: [[F1_END]]: 142; X64-NEXT: .p2align 2 143; Line table 144; X64-NEXT: .cv_linetable 0, f, [[END_OF_F]] 145; File index to string table offset subsection 146; X64-NEXT: .cv_filechecksums 147; String table 148; X64-NEXT: .cv_stringtable 149 150; OBJ64: Section { 151; OBJ64: Name: .debug$S (2E 64 65 62 75 67 24 53) 152; OBJ64: Characteristics [ (0x42300040) 153; OBJ64: ] 154; OBJ64: Relocations [ 155; OBJ64-NEXT: 0x2C IMAGE_REL_AMD64_SECREL f 156; OBJ64-NEXT: 0x30 IMAGE_REL_AMD64_SECTION f 157; OBJ64-NEXT: 0x44 IMAGE_REL_AMD64_SECREL f 158; OBJ64-NEXT: 0x48 IMAGE_REL_AMD64_SECTION f 159; OBJ64-NEXT: ] 160; OBJ64: Subsection [ 161; OBJ64-NEXT: SubSectionType: Symbols (0xF1) 162; OBJ64-NOT: ] 163; OBJ64: ProcStart { 164; OBJ64: CodeSize: 0xE 165; OBJ64: DisplayName: f 166; OBJ64: LinkageName: f 167; OBJ64: } 168; OBJ64-NEXT: ProcEnd { 169; OBJ64-NEXT: } 170; OBJ64-NEXT: ] 171; OBJ64: FunctionLineTable [ 172; OBJ64-NEXT: Name: f 173; OBJ64-NEXT: Flags: 0x0 174; OBJ64-NEXT: CodeSize: 0xE 175; OBJ64-NEXT: FilenameSegment [ 176; OBJ64-NEXT: Filename: D:\asm.c 177; FIXME: An empty __asm stmt creates an extra entry. 178; See PR18679 for the details. 179; OBJ64-NEXT: +0x0 [ 180; OBJ64-NEXT: LineNumberStart: 3 181; OBJ64-NEXT: LineNumberEndDelta: 0 182; OBJ64-NEXT: IsStatement: No 183; OBJ64-NEXT: ] 184; OBJ64-NEXT: +0x4 [ 185; OBJ64-NEXT: LineNumberStart: 4 186; OBJ64-NEXT: LineNumberEndDelta: 0 187; OBJ64-NEXT: IsStatement: No 188; OBJ64-NEXT: ] 189; OBJ64-NEXT: +0x4 [ 190; OBJ64-NEXT: LineNumberStart: 5 191; OBJ64-NEXT: LineNumberEndDelta: 0 192; OBJ64-NEXT: IsStatement: No 193; OBJ64-NEXT: ] 194; OBJ64-NEXT: +0x9 [ 195; OBJ64-NEXT: LineNumberStart: 6 196; OBJ64-NEXT: LineNumberEndDelta: 0 197; OBJ64-NEXT: IsStatement: No 198; OBJ64-NEXT: ] 199; OBJ64-NEXT: ] 200; OBJ64-NEXT: ] 201 202; Function Attrs: nounwind 203define void @f() #0 !dbg !4 { 204entry: 205 call void asm sideeffect inteldialect ".align 4", "~{dirflag},~{fpsr},~{flags}"() #2, !dbg !12 206 call void @g(), !dbg !13 207 ret void, !dbg !14 208} 209 210declare void @g() #1 211 212attributes #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" } 213attributes #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" } 214attributes #2 = { nounwind } 215 216!llvm.dbg.cu = !{!0} 217!llvm.module.flags = !{!9, !10} 218!llvm.ident = !{!11} 219 220!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 221!1 = !DIFile(filename: "<unknown>", directory: "D:\5C") 222!2 = !{} 223!4 = distinct !DISubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !5, scope: !6, type: !7, variables: !2) 224!5 = !DIFile(filename: "asm.c", directory: "D:\5C") 225!6 = !DIFile(filename: "asm.c", directory: "D:C") 226!7 = !DISubroutineType(types: !8) 227!8 = !{null} 228!9 = !{i32 2, !"CodeView", i32 1} 229!10 = !{i32 1, !"Debug Info Version", i32 3} 230!11 = !{!"clang version 3.5 "} 231!12 = !DILocation(line: 4, scope: !4) 232!13 = !DILocation(line: 5, scope: !4) 233!14 = !DILocation(line: 6, scope: !4) 234