xref: /llvm-project/llvm/test/DebugInfo/COFF/fortran-basic.ll (revision 750a6870eb41922f7013c163b458a02d5aa8994b)
1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
2;
3; The IR in this test derives from the following Fortran program:
4;	program array
5;	  integer array1, array2
6;	  dimension array1(10)
7;         dimension array2(3:10)
8;         double precision d
9;         logical l
10;         character*6 c
11;         complex*8 cmp8
12;         complex*16 cmp16
13;         complex*32 cmp32
14;
15;         common /com/ d, l, c
16;
17;         array1(1) = 1
18;         array2(3) = 2
19;         d = 8.0
20;         l = .TRUE.
21;         c = 'oooooo'
22;         cmp8 = (8.8, 1.1)
23;         cmp16 = (16.16, 2.2)
24;         cmp32 = (32.32, 3.3)
25;	end
26;
27; CHECK: Array ([[array2_t:.*]]) {
28; CHECK-NEXT: TypeLeafKind: LF_ARRAY
29; CHECK-NEXT: ElementType: int
30; CHECK-NEXT: IndexType: unsigned __int64
31; CHECK-NEXT: SizeOf: 32
32;
33; CHECK: Array ([[array1_t:.*]]) {
34; CHECK-NEXT: TypeLeafKind: LF_ARRAY
35; CHECK-NEXT: ElementType: int
36; CHECK-NEXT: IndexType: unsigned __int64
37; CHECK-NEXT: SizeOf: 40
38;
39; CHECK: Array ([[char_6_t:.*]]) {
40; CHECK-NEXT: TypeLeafKind: LF_ARRAY
41; CHECK-NEXT: ElementType: char
42; CHECK-NEXT: IndexType: unsigned __int64
43; CHECK-NEXT: SizeOf: 6
44; CHECK-NEXT: CHARACTER_0
45;
46; CHECK:      Type: _Complex __float128 (0x53)
47; CHECK-NEXT: Flags [
48; CHECK-NEXT: ]
49; CHECK-NEXT: VarName: CMP32
50;
51; CHECK:      Type: _Complex double (0x51)
52; CHECK-NEXT: Flags [
53; CHECK-NEXT: ]
54; CHECK-NEXT: VarName: CMP16
55;
56; CHECK:      Type: _Complex float (0x50)
57; CHECK-NEXT: Flags [
58; CHECK-NEXT: ]
59; CHECK-NEXT: VarName: CMP8
60;
61; CHECK: DataOffset: ARRAY$ARRAY2+0x0
62; CHECK-NEXT: Type: [[array2_t]]
63; CHECK-NEXT: DisplayName: ARRAY2
64; CHECK-NEXT: LinkageName: ARRAY$ARRAY2
65;
66; CHECK: DataOffset: ARRAY$ARRAY1+0x0
67; CHECK-NEXT: Type: [[array1_t]]
68; CHECK-NEXT: DisplayName: ARRAY1
69; CHECK-NEXT: LinkageName: ARRAY$ARRAY1
70;
71; CHECK: DataOffset: COM+0x0
72; CHECK-NEXT: Type: double
73; CHECK-NEXT: DisplayName: D
74; CHECK-NEXT: LinkageName: COM
75;
76; CHECK: DataOffset: COM+0x8
77; CHECK-NEXT: Type: __bool32
78; CHECK-NEXT: DisplayName: L
79; CHECK-NEXT: LinkageName: COM
80;
81; CHECK: DataOffset: COM+0xC
82; CHECK-NEXT: Type: CHARACTER_0 ([[char_6_t]])
83; CHECK-NEXT: DisplayName: C
84; CHECK-NEXT: LinkageName: COM
85
86; ModuleID = 'fortran-basic.f'
87source_filename = "fortran-basic.f"
88target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
89target triple = "x86_64-pc-windows-msvc"
90
91%complex_256bit = type { fp128, fp128 }
92%complex_128bit = type { double, double }
93%complex_64bit = type { float, float }
94
95@strlit = internal unnamed_addr constant [6 x i8] c"oooooo"
96@COM = common unnamed_addr global [18 x i8] zeroinitializer, align 32, !dbg !0, !dbg !9, !dbg !12
97@"ARRAY$ARRAY2" = internal global [8 x i32] zeroinitializer, align 16, !dbg !15
98@"ARRAY$ARRAY1" = internal global [10 x i32] zeroinitializer, align 16, !dbg !21
99@0 = internal unnamed_addr constant i32 2
100
101; Function Attrs: noinline nounwind optnone uwtable
102define void @MAIN__() #0 !dbg !3 {
103alloca_0:
104  %"$io_ctx" = alloca [6 x i64], align 8
105  %"ARRAY$CMP32" = alloca %complex_256bit, align 16
106  %"ARRAY$CMP16" = alloca %complex_128bit, align 8, !dbg !42
107  %"ARRAY$CMP8" = alloca %complex_64bit, align 8, !dbg !42
108  call void @llvm.dbg.declare(metadata ptr %"ARRAY$CMP32", metadata !27, metadata !DIExpression()), !dbg !42
109  call void @llvm.dbg.declare(metadata ptr %"ARRAY$CMP16", metadata !29, metadata !DIExpression()), !dbg !41
110  call void @llvm.dbg.declare(metadata ptr %"ARRAY$CMP8", metadata !31, metadata !DIExpression()), !dbg !40
111  %strlit_fetch.1 = load [6 x i8], ptr @strlit, align 1, !dbg !39
112  %func_result = call i32 @for_set_reentrancy(ptr @0), !dbg !39
113  store i32 1, ptr @"ARRAY$ARRAY1", align 1, !dbg !43
114  store i32 2, ptr @"ARRAY$ARRAY2", align 1, !dbg !44
115  store double 8.000000e+00, ptr @COM, align 1, !dbg !45
116  store i32 -1, ptr getelementptr inbounds ([18 x i8], ptr @COM, i32 0, i64 8), align 1, !dbg !46
117  call void @llvm.for.cpystr.i64.i64.i64(ptr getelementptr inbounds ([18 x i8], ptr @COM, i32 0, i64 12), i64 6, ptr @strlit, i64 3, i64 0, i1 false), !dbg !47
118  store %complex_64bit { float 0x40219999A0000000, float 0x3FF19999A0000000 }, ptr %"ARRAY$CMP8", align 8, !dbg !48
119  store %complex_128bit { double 0x403028F5C0000000, double 0x40019999A0000000 }, ptr %"ARRAY$CMP16", align 8, !dbg !49
120  store %complex_256bit { fp128 0xL00000000000000004004028F5C000000, fp128 0xL00000000000000004000A66666000000 }, ptr %"ARRAY$CMP32", align 16, !dbg !50
121  ret void, !dbg !51
122}
123
124declare i32 @for_set_reentrancy(ptr nocapture readonly)
125
126; Function Attrs: nounwind readnone speculatable
127declare ptr @llvm.intel.subscript.p0.i64.i64.p0.i64(i8, i64, i64, ptr, i64) #1
128
129; Function Attrs: argmemonly nofree nosync nounwind willreturn
130declare void @llvm.for.cpystr.i64.i64.i64(ptr noalias nocapture writeonly, i64, ptr noalias nocapture readonly, i64, i64, i1 immarg) #2
131
132; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
133declare void @llvm.dbg.declare(metadata, metadata, metadata) #3
134
135attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="none" "intel-lang"="fortran" "min-legal-vector-width"="0" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" }
136attributes #1 = { nounwind readnone speculatable }
137attributes #2 = { argmemonly nofree nosync nounwind willreturn }
138attributes #3 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
139
140!llvm.module.flags = !{!34, !35, !36}
141!llvm.dbg.cu = !{!7}
142!omp_offload.info = !{}
143
144!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
145!1 = distinct !DIGlobalVariable(name: "D", linkageName: "COM", scope: !2, file: !4, line: 5, type: !33, isLocal: false, isDefinition: true)
146!2 = !DICommonBlock(scope: !3, declaration: null, name: "COM", file: !4, line: 8)
147!3 = distinct !DISubprogram(name: "ARRAY", linkageName: "MAIN__", scope: !4, file: !4, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !7, retainedNodes: !26)
148!4 = !DIFile(filename: "fortran-basic.f", directory: "d:\\temp")
149!5 = !DISubroutineType(types: !6)
150!6 = !{null}
151!7 = distinct !DICompileUnit(language: DW_LANG_Fortran95, file: !4, producer: "Fortran", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !8, splitDebugInlining: false, nameTableKind: None)
152!8 = !{!0, !9, !12, !15, !21}
153!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression(DW_OP_plus_uconst, 8))
154!10 = distinct !DIGlobalVariable(name: "L", linkageName: "COM", scope: !2, file: !4, line: 6, type: !11, isLocal: false, isDefinition: true)
155!11 = !DIBasicType(name: "LOGICAL*4", size: 32, encoding: DW_ATE_boolean)
156!12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression(DW_OP_plus_uconst, 12))
157!13 = distinct !DIGlobalVariable(name: "C", linkageName: "COM", scope: !2, file: !4, line: 7, type: !14, isLocal: false, isDefinition: true)
158!14 = !DIStringType(name: "CHARACTER_0", size: 48)
159!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
160!16 = distinct !DIGlobalVariable(name: "ARRAY2", linkageName: "ARRAY$ARRAY2", scope: !3, file: !4, line: 2, type: !17, isLocal: true, isDefinition: true)
161!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, elements: !19)
162!18 = !DIBasicType(name: "INTEGER*4", size: 32, encoding: DW_ATE_signed)
163!19 = !{!20}
164!20 = !DISubrange(lowerBound: 3, upperBound: 10)
165!21 = !DIGlobalVariableExpression(var: !22, expr: !DIExpression())
166!22 = distinct !DIGlobalVariable(name: "ARRAY1", linkageName: "ARRAY$ARRAY1", scope: !3, file: !4, line: 2, type: !23, isLocal: true, isDefinition: true)
167!23 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, elements: !24)
168!24 = !{!25}
169!25 = !DISubrange(count: 10, lowerBound: 1)
170!26 = !{!27, !29, !31}
171!27 = !DILocalVariable(name: "CMP32", scope: !3, file: !4, line: 10, type: !28)
172!28 = !DIBasicType(name: "COMPLEX*32", size: 256, encoding: DW_ATE_complex_float)
173!29 = !DILocalVariable(name: "CMP16", scope: !3, file: !4, line: 9, type: !30)
174!30 = !DIBasicType(name: "COMPLEX*16", size: 128, encoding: DW_ATE_complex_float)
175!31 = !DILocalVariable(name: "CMP8", scope: !3, file: !4, line: 8, type: !32)
176!32 = !DIBasicType(name: "COMPLEX*8", size: 64, encoding: DW_ATE_complex_float)
177!33 = !DIBasicType(name: "REAL*8", size: 64, encoding: DW_ATE_float)
178!34 = !{i32 7, !"PIC Level", i32 2}
179!35 = !{i32 2, !"Debug Info Version", i32 3}
180!36 = !{i32 2, !"CodeView", i32 1}
181!39 = !DILocation(line: 1, column: 10, scope: !3)
182!40 = !DILocation(line: 8, column: 9, scope: !3)
183!41 = !DILocation(line: 9, column: 9, scope: !3)
184!42 = !DILocation(line: 10, column: 9, scope: !3)
185!43 = !DILocation(line: 14, column: 9, scope: !3)
186!44 = !DILocation(line: 15, column: 9, scope: !3)
187!45 = !DILocation(line: 16, column: 9, scope: !3)
188!46 = !DILocation(line: 17, column: 9, scope: !3)
189!47 = !DILocation(line: 18, column: 9, scope: !3)
190!48 = !DILocation(line: 19, column: 9, scope: !3)
191!49 = !DILocation(line: 20, column: 9, scope: !3)
192!50 = !DILocation(line: 21, column: 9, scope: !3)
193!51 = !DILocation(line: 22, column: 2, scope: !3)
194