xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/arguments.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-unknown-unknown -O0 -filetype=obj < %s > %t
4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump %t | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; IR generated from clang -g with the following source:
7*9880d681SAndroid Build Coastguard Worker; struct foo {
8*9880d681SAndroid Build Coastguard Worker;   foo(const foo&);
9*9880d681SAndroid Build Coastguard Worker;   int i;
10*9880d681SAndroid Build Coastguard Worker; };
11*9880d681SAndroid Build Coastguard Worker;
12*9880d681SAndroid Build Coastguard Worker; void func(foo f, foo g) {
13*9880d681SAndroid Build Coastguard Worker;   f.i++;
14*9880d681SAndroid Build Coastguard Worker; }
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; CHECK: debug_info contents
17*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram
18*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
19*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_linkage_name{{.*}}"_Z4func3fooS_"
20*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: NULL
21*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_formal_parameter
22*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
23*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name{{.*}}"f"
24*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: NULL
25*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_formal_parameter
26*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG
27*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name{{.*}}"g"
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker%struct.foo = type { i32 }
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable
32*9880d681SAndroid Build Coastguard Workerdefine void @_Z4func3fooS_(%struct.foo* %f, %struct.foo* %g) #0 !dbg !4 {
33*9880d681SAndroid Build Coastguard Workerentry:
34*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.foo* %f, metadata !19, metadata !DIExpression()), !dbg !20
35*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.foo* %g, metadata !21, metadata !DIExpression()), !dbg !20
36*9880d681SAndroid Build Coastguard Worker  %i = getelementptr inbounds %struct.foo, %struct.foo* %f, i32 0, i32 0, !dbg !22
37*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* %i, align 4, !dbg !22
38*9880d681SAndroid Build Coastguard Worker  %inc = add nsw i32 %0, 1, !dbg !22
39*9880d681SAndroid Build Coastguard Worker  store i32 %inc, i32* %i, align 4, !dbg !22
40*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !23
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
44*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
47*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
50*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!24}
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker!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)
53*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "scratch.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
54*9880d681SAndroid Build Coastguard Worker!2 = !{}
55*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "func", linkageName: "_Z4func3fooS_", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !6, variables: !2)
56*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "scratch.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
57*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
58*9880d681SAndroid Build Coastguard Worker!7 = !{null, !8, !8}
59*9880d681SAndroid Build Coastguard Worker!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 32, align: 32, file: !1, elements: !9)
60*9880d681SAndroid Build Coastguard Worker!9 = !{!10, !12}
61*9880d681SAndroid Build Coastguard Worker!10 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 3, size: 32, align: 32, file: !1, scope: !8, baseType: !11)
62*9880d681SAndroid Build Coastguard Worker!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
63*9880d681SAndroid Build Coastguard Worker!12 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !8, type: !13)
64*9880d681SAndroid Build Coastguard Worker!13 = !DISubroutineType(types: !14)
65*9880d681SAndroid Build Coastguard Worker!14 = !{null, !15, !16}
66*9880d681SAndroid Build Coastguard Worker!15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
67*9880d681SAndroid Build Coastguard Worker!16 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !17)
68*9880d681SAndroid Build Coastguard Worker!17 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
69*9880d681SAndroid Build Coastguard Worker!19 = !DILocalVariable(name: "f", line: 6, arg: 1, scope: !4, file: !5, type: !8)
70*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 6, scope: !4)
71*9880d681SAndroid Build Coastguard Worker!21 = !DILocalVariable(name: "g", line: 6, arg: 2, scope: !4, file: !5, type: !8)
72*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 7, scope: !4)
73*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 8, scope: !4)
74*9880d681SAndroid Build Coastguard Worker!24 = !{i32 1, !"Debug Info Version", i32 3}
75