xref: /llvm-project/llvm/test/DebugInfo/X86/set.ll (revision 42043c423ff01d8d07f33aed76819d3b716bba0c)
1; Test set representation in DWARF debug info:
2
3; RUN: llc -debugger-tune=gdb -dwarf-version=4 -filetype=obj -o %t.o < %s
4; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefix=CHECK
5
6; ModuleID = 'Main.mb'
7source_filename = "../src/Main.m3"
8target datalayout = "e-m:e-p:64:64-i64:64-f80:128-n8:16:32:64-S128"
9target triple = "x86_64-pc-linux-gnu"
10
11%M_Const_struct = type { [7 x i8], [1 x i8], [4 x i8], [4 x i8], ptr, ptr, ptr, ptr, [8 x i8], [14 x i8], [2 x i8] }
12%M_Main_struct = type { ptr, [32 x i8], ptr, [24 x i8], ptr, [8 x i8], ptr, i64, [8 x i8], ptr, ptr, [8 x i8], ptr, [8 x i8] }
13
14@M_Const = internal constant %M_Const_struct { [7 x i8] c"Main_M3", [1 x i8] zeroinitializer, [4 x i8] c"Test", [4 x i8] zeroinitializer, ptr @Main_M3, ptr @M_Const, ptr @Main__Test, ptr getelementptr inbounds (i8, ptr @M_Const, i64 8), [8 x i8] zeroinitializer, [14 x i8] c"../src/Main.m3", [2 x i8] zeroinitializer }, align 8
15@M_Main = internal global %M_Main_struct { ptr getelementptr inbounds (i8, ptr @M_Const, i64 56), [32 x i8] zeroinitializer, ptr getelementptr inbounds (i8, ptr @M_Const, i64 16), [24 x i8] zeroinitializer, ptr getelementptr inbounds (i8, ptr @M_Main, i64 104), [8 x i8] zeroinitializer, ptr @Main_M3, i64 3, [8 x i8] zeroinitializer, ptr @Main_I3, ptr getelementptr inbounds (i8, ptr @M_Main, i64 128), [8 x i8] zeroinitializer, ptr @RTHooks_I3, [8 x i8] zeroinitializer }, align 8
16@m3_jmpbuf_size = external global i64, align 8
17
18declare ptr @Main_I3()
19
20declare ptr @RTHooks_I3()
21
22; Function Attrs: uwtable
23define void @Main__Test() #0 !dbg !5 {
24entry:
25  %as = alloca i64, align 8
26  %bs = alloca i64, align 8
27  br label %second, !dbg !21
28
29second:                                           ; preds = %entry
30  call void @llvm.dbg.declare(metadata ptr %as, metadata !22, metadata !DIExpression()), !dbg !25
31  call void @llvm.dbg.declare(metadata ptr %bs, metadata !26, metadata !DIExpression()), !dbg !25
32  store i64 36028797018972298, ptr %as, align 8, !dbg !28
33  store i64 197, ptr %bs, align 8, !dbg !29
34  ret void, !dbg !21
35}
36
37; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
38declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
39
40declare ptr @alloca()
41
42; Function Attrs: uwtable
43define ptr @Main_M3(i64 %mode) #0 !dbg !30 {
44entry:
45  %mode1 = alloca i64, align 8
46  store i64 %mode, ptr %mode1, align 8
47  br label %second, !dbg !36
48
49second:                                           ; preds = %entry
50  call void @llvm.dbg.declare(metadata ptr %mode1, metadata !37, metadata !DIExpression()), !dbg !38
51  %v.3 = load i64, ptr %mode1, align 8, !dbg !38
52  %icmp = icmp eq i64 %v.3, 0, !dbg !38
53  br i1 %icmp, label %if_1, label %else_1, !dbg !38
54
55else_1:                                           ; preds = %second
56  call void @Main__Test(), !dbg !36
57  br label %if_1, !dbg !36
58
59if_1:                                             ; preds = %else_1, %second
60  ret ptr @M_Main, !dbg !36
61}
62
63attributes #0 = { uwtable "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
64attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
65
66!llvm.ident = !{!0}
67!llvm.dbg.cu = !{!1}
68!llvm.module.flags = !{!18, !19, !20}
69
70!0 = !{!"versions- cm3: d5.10.0 llvm: 9.0"}
71!1 = distinct !DICompileUnit(language: DW_LANG_Modula3, file: !2, producer: "cm3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3)
72!2 = !DIFile(filename: "Main.m3", directory: "/home/cm3/settest/src")
73!3 = !{!4}
74!4 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", scope: !5, file: !2, line: 11, size: 8, align: 8, elements: !9)
75!5 = distinct !DISubprogram(name: "Test", linkageName: "Main__Test", scope: !2, file: !2, line: 11, type: !6, scopeLine: 11, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !8)
76!6 = !DISubroutineType(types: !7)
77!7 = !{null}
78!8 = !{}
79!9 = !{!10, !11, !12, !13, !14, !15, !16, !17}
80!10 = !DIEnumerator(name: "alpha", value: 0)
81!11 = !DIEnumerator(name: "beta", value: 1)
82!12 = !DIEnumerator(name: "gamma", value: 2)
83!13 = !DIEnumerator(name: "delta", value: 3)
84!14 = !DIEnumerator(name: "epsilon", value: 4)
85!15 = !DIEnumerator(name: "theta", value: 5)
86!16 = !DIEnumerator(name: "psi", value: 6)
87!17 = !DIEnumerator(name: "zeta", value: 7)
88!18 = !{i64 2, !"Dwarf Version", i64 4}
89!19 = !{i64 2, !"Debug Info Version", i64 3}
90!20 = !{i64 2, !"wchar_size", i64 2}
91!21 = !DILocation(line: 20, scope: !5)
92!22 = !DILocalVariable(name: "as", scope: !5, file: !2, line: 11, type: !23)
93!23 = !DIDerivedType(tag: DW_TAG_set_type, name: "SS", scope: !2, file: !2, line: 11, baseType: !24, size: 64, align: 64)
94!24 = !DIBasicType(name: "SR", size: 8, encoding: DW_ATE_signed)
95; CHECK:         DW_TAG_set_type
96; CHECK:           DW_AT_type{{.*}}"SR"
97; CHECK:           DW_AT_name      ("SS")
98; CHECK:           DW_AT_byte_size (0x08)
99!25 = !DILocation(line: 11, scope: !5)
100!26 = !DILocalVariable(name: "bs", scope: !5, file: !2, line: 11, type: !27)
101!27 = !DIDerivedType(tag: DW_TAG_set_type, name: "ST", scope: !2, file: !2, line: 11, baseType: !4, size: 64, align: 64)
102; CHECK:         DW_TAG_set_type
103; CHECK:           DW_AT_type{{.*}}"Enum"
104; CHECK:           DW_AT_name      ("ST")
105; CHECK:           DW_AT_byte_size (0x08)
106!28 = !DILocation(line: 17, scope: !5)
107!29 = !DILocation(line: 18, scope: !5)
108!30 = distinct !DISubprogram(name: "Main_M3", linkageName: "Main_M3", scope: !2, file: !2, line: 22, type: !31, scopeLine: 22, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !8)
109!31 = !DISubroutineType(types: !32)
110!32 = !{!33, !35}
111!33 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "ADDR", baseType: !34, size: 64, align: 64)
112!34 = !DICompositeType(tag: DW_TAG_class_type, name: "ADDR__HeapObject", scope: !5, file: !2, line: 22, size: 64, align: 64, identifier: "AJWxb1")
113!35 = !DIBasicType(name: "INTEGER", size: 64, encoding: DW_ATE_signed)
114!36 = !DILocation(line: 23, scope: !30)
115!37 = !DILocalVariable(name: "mode", arg: 1, scope: !30, file: !2, line: 22, type: !35)
116!38 = !DILocation(line: 22, scope: !30)
117