1 ; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
2 ; RUN: llc < %s | llvm-mc -filetype=obj --triple=i686-windows | llvm-readobj - --codeview | FileCheck %s
4 ; C++ source to regenerate:
6 ; void usevars(int, ...);
8 ; int a[5] = {9, 4, 5, 4, 2};
11 ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
13 ; CHECK: CodeViewTypes [
14 ; CHECK: Section: .debug$T (6)
16 ; CHECK: ArgList (0x1000) {
17 ; CHECK: TypeLeafKind: LF_ARGLIST (0x1201)
22 ; CHECK: Procedure (0x1001) {
23 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
24 ; CHECK: ReturnType: void (0x3)
25 ; CHECK: CallingConvention: NearC (0x0)
26 ; CHECK: FunctionOptions [ (0x0)
28 ; CHECK: NumParameters: 0
29 ; CHECK: ArgListType: () (0x1000)
31 ; CHECK: FuncId (0x1002) {
32 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
33 ; CHECK: ParentScope: 0x0
34 ; CHECK: FunctionType: void () (0x1001)
37 ; CHECK: Array (0x1003) {
38 ; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
39 ; CHECK: ElementType: int (0x74)
40 ; CHECK: IndexType: unsigned long (0x22)
45 ; CHECK: CodeViewDebugInfo [
46 ; CHECK: Section: .debug$S (5)
49 ; CHECK: SubSectionType: Symbols (0xF1)
50 ; CHECK: {{.*}}Proc{{.*}}Sym {
51 ; CHECK: PtrParent: 0x0
54 ; CHECK: CodeSize: 0x39
55 ; CHECK: DbgStart: 0x0
57 ; CHECK: FunctionType: f (0x1002)
58 ; CHECK: CodeOffset: ?f@@YAXXZ+0x0
60 ; CHECK: Flags [ (0x0)
62 ; CHECK: DisplayName: f
63 ; CHECK: LinkageName: ?f@@YAXXZ
67 ; CHECK: Flags [ (0x0)
71 ; CHECK: DefRangeFramePointerRelSym {
73 ; CHECK: LocalVariableAddrRange {
74 ; CHECK: OffsetStart: .text+0x6
75 ; CHECK: ISectStart: 0x0
84 source_filename = "t.cpp"
85 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
86 target triple = "i686-pc-windows-msvc19.0.23918"
88 @"\01?a@?1??f@@YAXXZ@3PAHA" = private unnamed_addr constant [5 x i32] [i32 9, i32 4, i32 5, i32 4, i32 2], align 4
90 define void @"\01?f@@YAXXZ"() #0 !dbg !6 {
92 %a = alloca [5 x i32], align 4
93 call void @llvm.dbg.declare(metadata [5 x i32]* %a, metadata !9, metadata !14), !dbg !15
94 %0 = bitcast [5 x i32]* %a to i8*, !dbg !15
95 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 bitcast ([5 x i32]* @"\01?a@?1??f@@YAXXZ@3PAHA" to i8*), i32 20, i1 false), !dbg !15
96 %arraydecay = getelementptr inbounds [5 x i32], [5 x i32]* %a, i32 0, i32 0, !dbg !16
97 %arrayidx = getelementptr inbounds [5 x i32], [5 x i32]* %a, i32 0, i32 0, !dbg !17
98 %1 = load i32, i32* %arrayidx, align 4, !dbg !17
99 call void (i32, ...) @"\01?usevars@@YAXHZZ"(i32 %1, i32* %arraydecay), !dbg !18
103 ; Function Attrs: nounwind readnone
104 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
106 ; Function Attrs: argmemonly nounwind
107 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #2
109 declare void @"\01?usevars@@YAXHZZ"(i32, ...) #3
111 attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
112 attributes #1 = { nounwind readnone }
113 attributes #2 = { argmemonly nounwind }
114 attributes #3 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
117 !llvm.module.flags = !{!3, !4}
120 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
121 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cllvm\5Ctest\5CDebugInfo\5CCOFF")
123 !3 = !{i32 2, !"CodeView", i32 1}
124 !4 = !{i32 2, !"Debug Info Version", i32 3}
125 !5 = !{!"clang version 3.9.0 "}
126 !6 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAXXZ", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
127 !7 = !DISubroutineType(types: !8)
129 !9 = !DILocalVariable(name: "a", scope: !6, file: !1, line: 3, type: !10)
130 !10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 160, align: 32, elements: !12)
131 !11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
133 !13 = !DISubrange(count: 5)
134 !14 = !DIExpression()
135 !15 = !DILocation(line: 3, column: 7, scope: !6)
136 !16 = !DILocation(line: 4, column: 17, scope: !6)
137 !17 = !DILocation(line: 4, column: 11, scope: !6)
138 !18 = !DILocation(line: 4, column: 3, scope: !6)
139 !19 = !DILocation(line: 5, column: 1, scope: !6)