1 ; RUN: llc --filetype=obj -o %t < %s
2 ; RUN: llvm-dwarfdump --debug-info %t | FileCheck %s
3 ; RUN: llvm-dwarfdump --verify %t
5 ; This file was based on output of
7 ; clang -target msp430 -S -emit-llvm -gdwarf-3 -Os dwarf-basics.c
9 ; for the following dwarf-basics.c
15 ; int f(long y, struct X *p)
21 ; CHECK: file format elf32-msp430
23 ; CHECK: .debug_info contents:
24 ; CHECK: Compile Unit: length = 0x{{.*}}, format = DWARF32, version = 0x0003, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x{{.*}})
26 ; CHECK: DW_TAG_compile_unit
27 ; CHECK: DW_AT_producer ("clang version 11.0.0 (git@...)")
28 ; CHECK: DW_AT_language (DW_LANG_C99)
29 ; CHECK: DW_AT_name ("dwarf-basics.c")
30 ; CHECK: DW_AT_stmt_list (0x{{.*}})
31 ; CHECK: DW_AT_comp_dir ("/tmp")
32 ; CHECK: DW_AT_low_pc (0x{{.*}})
33 ; CHECK: DW_AT_high_pc (0x{{.*}})
35 ; CHECK: DW_TAG_subprogram
36 ; CHECK: DW_AT_low_pc (0x{{.*}})
37 ; CHECK: DW_AT_high_pc (0x{{.*}})
38 ; CHECK: DW_AT_frame_base (DW_OP_reg1 SP)
39 ; CHECK: DW_AT_name ("f")
40 ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c")
41 ; CHECK: DW_AT_decl_line (5)
42 ; CHECK: DW_AT_prototyped (0x01)
43 ; CHECK: DW_AT_type (0x{{.*}} "int")
44 ; CHECK: DW_AT_external (0x01)
46 ; CHECK: DW_TAG_formal_parameter
47 ; CHECK: DW_AT_location (0x{{.*}}:
48 ; CHECK: [0x00000000, 0x00000004): DW_OP_reg12 R12)
49 ; CHECK: DW_AT_name ("y")
50 ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c")
51 ; CHECK: DW_AT_decl_line (5)
52 ; CHECK: DW_AT_type (0x{{.*}} "long int")
54 ; CHECK: DW_TAG_formal_parameter
55 ; CHECK: DW_AT_location (DW_OP_reg14 R14)
56 ; CHECK: DW_AT_name ("p")
57 ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c")
58 ; CHECK: DW_AT_decl_line (5)
59 ; CHECK: DW_AT_type (0x{{.*}} "X *")
63 ; CHECK: DW_TAG_base_type
64 ; CHECK: DW_AT_name ("int")
65 ; CHECK: DW_AT_encoding (DW_ATE_signed)
66 ; CHECK: DW_AT_byte_size (0x02)
68 ; CHECK: DW_TAG_base_type
69 ; CHECK: DW_AT_name ("long int")
70 ; CHECK: DW_AT_encoding (DW_ATE_signed)
71 ; CHECK: DW_AT_byte_size (0x04)
73 ; CHECK: DW_TAG_pointer_type
74 ; CHECK: DW_AT_type (0x{{.*}} "X")
76 ; CHECK: DW_TAG_structure_type
77 ; CHECK: DW_AT_name ("X")
78 ; CHECK: DW_AT_byte_size (0x02)
79 ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c")
80 ; CHECK: DW_AT_decl_line (1)
82 ; CHECK: DW_TAG_member
83 ; CHECK: DW_AT_name ("a")
84 ; CHECK: DW_AT_type (0x{{.*}} "void *")
85 ; CHECK: DW_AT_decl_file ("/tmp{{[/\\]}}dwarf-basics.c")
86 ; CHECK: DW_AT_decl_line (2)
87 ; CHECK: DW_AT_data_member_location (0)
91 ; CHECK: DW_TAG_pointer_type
96 source_filename = "dwarf-basics.c"
97 target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
98 target triple = "msp430"
100 %struct.X = type { ptr }
102 define i16 @f(i32 %y, ptr %p) !dbg !7 {
104 call void @llvm.dbg.value(metadata i32 %y, metadata !18, metadata !DIExpression()), !dbg !20
105 call void @llvm.dbg.value(metadata ptr %p, metadata !19, metadata !DIExpression()), !dbg !20
109 declare void @llvm.dbg.value(metadata, metadata, metadata)
112 !llvm.module.flags = !{!3, !4, !5}
115 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (git@...)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
116 !1 = !DIFile(filename: "dwarf-basics.c", directory: "/tmp")
118 !3 = !{i32 7, !"Dwarf Version", i32 3}
119 !4 = !{i32 2, !"Debug Info Version", i32 3}
120 !5 = !{i32 1, !"wchar_size", i32 2}
121 !6 = !{!"clang version 11.0.0 (git@...)"}
122 !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 5, type: !8, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
123 !8 = !DISubroutineType(types: !9)
124 !9 = !{!10, !11, !12}
125 !10 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
126 !11 = !DIBasicType(name: "long int", size: 32, encoding: DW_ATE_signed)
127 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 16)
128 !13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "X", file: !1, line: 1, size: 16, elements: !14)
130 !15 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !13, file: !1, line: 2, baseType: !16, size: 16)
131 !16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 16)
133 !18 = !DILocalVariable(name: "y", arg: 1, scope: !7, file: !1, line: 5, type: !11)
134 !19 = !DILocalVariable(name: "p", arg: 2, scope: !7, file: !1, line: 5, type: !12)
135 !20 = !DILocation(line: 0, scope: !7)
136 !21 = !DILocation(line: 7, column: 3, scope: !7)