xref: /llvm-project/llvm/test/DebugInfo/X86/reference-argument.ll (revision 10b03e66629aedad79a804e22d23b575077303b3)
1; RUN: llc -mtriple=x86_64-apple-macosx10.9.0 -filetype=obj -O0 < %s \
2; RUN:   | llvm-dwarfdump -v -debug-info - | FileCheck %s
3; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-apple-macosx10.9.0 -filetype=obj -O0 < %s \
4; RUN:   | llvm-dwarfdump -v -debug-info - | FileCheck %s
5; ModuleID = 'aggregate-indirect-arg.cpp'
6; extracted from debuginfo-tests/aggregate-indirect-arg.cpp
7
8; v should be a pointer.
9; CHECK:  .debug_info contents:
10; CHECK:   DW_TAG_subprogram
11; CHECK:     DW_AT_specification {{.*}} "_ZN1A3fooE4SVal"
12; CHECK-NOT: DW_TAG_subprogram
13; CHECK:     DW_TAG_formal_parameter
14; CHECK:       DW_AT_name {{.*}} "this"
15; CHECK-NOT:   DW_TAG_subprogram
16; CHECK:     DW_TAG_formal_parameter
17; CHECK-NEXT:  DW_AT_location
18; CHECK-NEXT:  DW_OP_breg5 RDI+0
19; CHECK-NEXT:  DW_AT_name {{.*}} "v"
20
21target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
22target triple = "x86_64-apple-macosx10.9.0"
23
24%class.SVal = type { ptr, i32 }
25%class.A = type { i8 }
26
27declare void @_Z3barR4SVal(ptr %v)
28declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
29declare void @llvm.dbg.value(metadata, metadata, metadata) #1
30declare i32 @main()
31; Function Attrs: nounwind ssp uwtable
32define linkonce_odr void @_ZN1A3fooE4SVal(ptr %this, ptr %v) nounwind ssp uwtable align 2 !dbg !35 {
33entry:
34  %this.addr = alloca ptr, align 8
35  store ptr %this, ptr %this.addr, align 8
36  call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !59, metadata !DIExpression()), !dbg !61
37  call void @llvm.dbg.value(metadata ptr %v, metadata !62, metadata !DIExpression(DW_OP_deref)), !dbg !61
38  %this1 = load ptr, ptr %this.addr
39  call void @_Z3barR4SVal(ptr %v), !dbg !61
40  ret void, !dbg !61
41}
42declare void @_ZN4SValD1Ev(ptr %this)
43declare void @_ZN4SValD2Ev(ptr %this)
44
45!llvm.dbg.cu = !{!0}
46!llvm.module.flags = !{!47, !68}
47
48!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
49!1 = !DIFile(filename: "aggregate-indirect-arg.cpp", directory: "")
50!2 = !{}
51!4 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barR4SVal", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 19, file: !1, scope: !5, type: !6, retainedNodes: !2)
52!5 = !DIFile(filename: "aggregate-indirect-arg.cpp", directory: "")
53!6 = !DISubroutineType(types: !7)
54!7 = !{null, !8}
55!8 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !9)
56!9 = !DICompositeType(tag: DW_TAG_class_type, name: "SVal", line: 12, size: 128, align: 64, file: !1, elements: !10)
57!10 = !{!11, !14, !16, !21, !23}
58!11 = !DIDerivedType(tag: DW_TAG_member, name: "Data", line: 15, size: 64, align: 64, file: !1, scope: !9, baseType: !12)
59!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13)
60!13 = !DIDerivedType(tag: DW_TAG_const_type, baseType: null)
61!14 = !DIDerivedType(tag: DW_TAG_member, name: "Kind", line: 16, size: 32, align: 32, offset: 64, file: !1, scope: !9, baseType: !15)
62!15 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
63!16 = !DISubprogram(name: "~SVal", line: 14, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 14, file: !1, scope: !9, type: !17)
64!17 = !DISubroutineType(types: !18)
65!18 = !{null, !19}
66!19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !9)
67!21 = !DISubprogram(name: "SVal", line: 12, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 12, file: !1, scope: !9, type: !17)
68!23 = !DISubprogram(name: "SVal", line: 12, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 12, file: !1, scope: !9, type: !24)
69!24 = !DISubroutineType(types: !25)
70!25 = !{null, !19, !26}
71!26 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !27)
72!27 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !9)
73!29 = distinct !DISubprogram(name: "main", line: 25, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 25, file: !1, scope: !5, type: !30, retainedNodes: !2)
74!30 = !DISubroutineType(types: !31)
75!31 = !{!32}
76!32 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
77!33 = distinct !DISubprogram(name: "~SVal", linkageName: "_ZN4SValD1Ev", line: 14, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 14, file: !1, scope: null, type: !17, declaration: !16, retainedNodes: !2)
78!34 = distinct !DISubprogram(name: "~SVal", linkageName: "_ZN4SValD2Ev", line: 14, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 14, file: !1, scope: null, type: !17, declaration: !16, retainedNodes: !2)
79!35 = distinct !DISubprogram(name: "foo", linkageName: "_ZN1A3fooE4SVal", line: 22, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 22, file: !1, scope: null, type: !36, declaration: !41, retainedNodes: !2)
80!36 = !DISubroutineType(types: !37)
81!37 = !{null, !38, !9}
82!38 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !39)
83!39 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 20, size: 8, align: 8, file: !1, elements: !40)
84!40 = !{!41, !43}
85!41 = !DISubprogram(name: "foo", linkageName: "_ZN1A3fooE4SVal", line: 22, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 22, file: !1, scope: !39, type: !36)
86!43 = !DISubprogram(name: "A", line: 20, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 20, file: !1, scope: !39, type: !44)
87!44 = !DISubroutineType(types: !45)
88!45 = !{null, !38}
89!47 = !{i32 2, !"Dwarf Version", i32 3}
90!48 = !DILocalVariable(name: "v", line: 19, arg: 1, scope: !4, file: !5, type: !8)
91!49 = !DILocation(line: 19, scope: !4)
92!50 = !DILocalVariable(name: "v", line: 26, scope: !29, file: !5, type: !9)
93!51 = !DILocation(line: 26, scope: !29)
94!52 = !DILocation(line: 27, scope: !29)
95!53 = !DILocation(line: 28, scope: !29)
96!54 = !DILocalVariable(name: "a", line: 29, scope: !29, file: !5, type: !39)
97!55 = !DILocation(line: 29, scope: !29)
98!56 = !DILocation(line: 30, scope: !29)
99!57 = !DILocation(line: 31, scope: !29)
100!58 = !DILocation(line: 32, scope: !29)
101!59 = !DILocalVariable(name: "this", line: 22, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, file: !5, type: !60)
102!60 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !39)
103!61 = !DILocation(line: 22, scope: !35)
104!62 = !DILocalVariable(name: "v", line: 22, arg: 2, scope: !35, file: !5, type: !9)
105!63 = !DILocalVariable(name: "this", line: 14, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !33, file: !5, type: !64)
106!64 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9)
107!65 = !DILocation(line: 14, scope: !33)
108!66 = !DILocalVariable(name: "this", line: 14, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, file: !5, type: !64)
109!67 = !DILocation(line: 14, scope: !34)
110!68 = !{i32 1, !"Debug Info Version", i32 3}
111