xref: /llvm-project/llvm/test/DebugInfo/X86/namelist1.ll (revision 391f323690b9ef84d13a09ff07fb805008401fee)
1; Namelist is a fortran feature, this test checks whether DW_TAG_namelist and
2; DW_TAG_namelist_item attributes are emitted correctly.
3;
4; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu %s -filetype=obj -o %t.o
5; RUN: llvm-dwarfdump %t.o | FileCheck %s
6;
7; CHECK: [[ITEM1:0x.+]]:       DW_TAG_variable
8; CHECK:                          DW_AT_name  ("a")
9; CHECK: [[ITEM2:0x.+]]:       DW_TAG_variable
10; CHECK:                          DW_AT_name  ("b")
11; CHECK: DW_TAG_namelist
12; CHECK:    DW_AT_name  ("nml")
13; CHECK: DW_TAG_namelist_item
14; CHECK:    DW_AT_namelist_item ([[ITEM1]])
15; CHECK: DW_TAG_namelist_item
16; CHECK:    DW_AT_namelist_item ([[ITEM2]])
17;
18; generated from
19;
20; program main
21;
22;  integer :: a=1, b
23;  namelist /nml/ a, b
24;
25;  a = 10
26;  b = 20
27;  Write(*,nml)
28;
29; end program main
30
31source_filename = "namelist.ll"
32
33define void @MAIN_() !dbg !2 {
34L.entry:
35  %b_350 = alloca i32, align 4
36  call void @llvm.dbg.declare(metadata ptr %b_350, metadata !12, metadata !DIExpression()), !dbg !13
37  call void @llvm.dbg.value(metadata i32 1, metadata !14, metadata !DIExpression()), !dbg !13
38  ret void, !dbg !17
39}
40
41declare void @llvm.dbg.declare(metadata, metadata, metadata)
42declare void @llvm.dbg.value(metadata, metadata, metadata)
43
44!llvm.module.flags = !{!10, !11}
45!llvm.dbg.cu = !{!4}
46
47!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_plus_uconst, 120))
48!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 3, type: !9, isLocal: true, isDefinition: true)
49!2 = distinct !DISubprogram(name: "main", scope: !4, file: !3, line: 1, type: !7, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !4)
50!3 = !DIFile(filename: "namelist.f90", directory: "/dir")
51!4 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: " F90 Flang - 1.5 2017-05-01", isOptimized: false, flags: "'+flang -g namelist.f90 -S -emit-llvm'", runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5, nameTableKind: None)
52!5 = !{}
53!6 = !{!0}
54!7 = !DISubroutineType(cc: DW_CC_program, types: !8)
55!8 = !{null}
56!9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
57!10 = !{i32 2, !"Dwarf Version", i32 4}
58!11 = !{i32 2, !"Debug Info Version", i32 3}
59!12 = !DILocalVariable(name: "b", scope: !2, file: !3, line: 3, type: !9)
60!13 = !DILocation(line: 0, scope: !2)
61!14 = distinct !DILocalVariable(scope: !2, file: !3, line: 2, type: !15, flags: DIFlagArtificial)
62!15 = !DICompositeType(tag: DW_TAG_namelist, name: "nml", scope: !2, file: !3, elements: !16)
63!16 = !{!1, !12}
64!17 = !DILocation(line: 10, column: 1, scope: !2)
65