xref: /llvm-project/llvm/test/DebugInfo/COFF/types-array.ll (revision f8499d5709e37b4e9a6d2a39c385cfd2c00bad6e)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
3; RUN: llc < %s | llvm-mc -filetype=obj --triple=i686-windows | llvm-readobj - --codeview | FileCheck %s
4
5; C++ source to regenerate:
6; $ cat t.cpp
7; void usevars(int, ...);
8; void f() {
9;   int a[5] = {9, 4, 5, 4, 2};
10;   usevars(a[0], a);
11; }
12; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
13
14; CHECK: CodeViewTypes [
15; CHECK:   Section: .debug$T (6)
16; CHECK:   Magic: 0x4
17; CHECK:   ArgList (0x1000) {
18; CHECK:     TypeLeafKind: LF_ARGLIST (0x1201)
19; CHECK:     NumArgs: 0
20; CHECK:     Arguments [
21; CHECK:     ]
22; CHECK:   }
23; CHECK:   Procedure (0x1001) {
24; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
25; CHECK:     ReturnType: void (0x3)
26; CHECK:     CallingConvention: NearC (0x0)
27; CHECK:     FunctionOptions [ (0x0)
28; CHECK:     ]
29; CHECK:     NumParameters: 0
30; CHECK:     ArgListType: () (0x1000)
31; CHECK:   }
32; CHECK:   FuncId (0x1002) {
33; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
34; CHECK:     ParentScope: 0x0
35; CHECK:     FunctionType: void () (0x1001)
36; CHECK:     Name: f
37; CHECK:   }
38; CHECK:   Array (0x1003) {
39; CHECK:     TypeLeafKind: LF_ARRAY (0x1503)
40; CHECK:     ElementType: int (0x74)
41; CHECK:     IndexType: unsigned long (0x22)
42; CHECK:     SizeOf: 20
43; CHECK:     Name:
44; CHECK:   }
45; CHECK: ]
46; CHECK: CodeViewDebugInfo [
47; CHECK:   Section: .debug$S (5)
48; CHECK:   Magic: 0x4
49; CHECK:   Subsection [
50; CHECK:     SubSectionType: Symbols (0xF1)
51; CHECK:     {{.*}}Proc{{.*}}Sym {
52; CHECK:       PtrParent: 0x0
53; CHECK:       PtrEnd: 0x0
54; CHECK:       PtrNext: 0x0
55; CHECK:       CodeSize: 0x39
56; CHECK:       DbgStart: 0x0
57; CHECK:       DbgEnd: 0x0
58; CHECK:       FunctionType: f (0x1002)
59; CHECK:       CodeOffset: ?f@@YAXXZ+0x0
60; CHECK:       Segment: 0x0
61; CHECK:       Flags [ (0x81)
62; CHECK:         HasFP (0x1)
63; CHECK:         HasOptimizedDebugInfo (0x80)
64; CHECK:       ]
65; CHECK:       DisplayName: f
66; CHECK:       LinkageName: ?f@@YAXXZ
67; CHECK:     }
68; CHECK:     LocalSym {
69; CHECK:       Type: 0x1003
70; CHECK:       Flags [ (0x0)
71; CHECK:       ]
72; CHECK:       VarName: a
73; CHECK:     }
74; CHECK:     DefRangeFramePointerRelSym {
75; CHECK:       Offset: -20
76; CHECK:       LocalVariableAddrRange {
77; CHECK:         OffsetStart: .text+0x9
78; CHECK:         ISectStart: 0x0
79; CHECK:         Range: 0x30
80; CHECK:       }
81; CHECK:     }
82; CHECK:     ProcEnd {
83; CHECK:     }
84; CHECK:   ]
85
86; ModuleID = 't.cpp'
87source_filename = "t.cpp"
88target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
89target triple = "i686-pc-windows-msvc19.0.23918"
90
91@"\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
92
93define void @"\01?f@@YAXXZ"() #0 !dbg !6 {
94entry:
95  %a = alloca [5 x i32], align 4
96  call void @llvm.dbg.declare(metadata ptr %a, metadata !9, metadata !14), !dbg !15
97  call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a, ptr align 4 @"\01?a@?1??f@@YAXXZ@3PAHA", i32 20, i1 false), !dbg !15
98  %0 = load i32, ptr %a, align 4, !dbg !17
99  call void (i32, ...) @"\01?usevars@@YAXHZZ"(i32 %0, ptr %a), !dbg !18
100  ret void, !dbg !19
101}
102
103; Function Attrs: nounwind readnone
104declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
105
106; Function Attrs: argmemonly nounwind
107declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1) #2
108
109declare void @"\01?usevars@@YAXHZZ"(i32, ...) #3
110
111attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }
112attributes #1 = { nounwind readnone }
113attributes #2 = { argmemonly nounwind }
114attributes #3 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }
115
116!llvm.dbg.cu = !{!0}
117!llvm.module.flags = !{!3, !4}
118!llvm.ident = !{!5}
119
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")
122!2 = !{}
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)
128!8 = !{null}
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)
132!12 = !{!13}
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)
140