• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; A by-value struct is a register-indirect value (breg).
2; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
3
4; Test that the 'f' parameter is present, with a location, and that the
5; expression for the location contains a DW_OP_breg
6; CHECK: DW_TAG_formal_parameter
7; CHECK-NEXT: DW_AT_location
8; CHECK-NEXT: DW_OP_breg
9
10; rdar://problem/13658587
11;
12; Generated from
13;
14; struct five
15; {
16;   int a;
17;   int b;
18;   int c;
19;   int d;
20;   int e;
21; };
22;
23; int
24; return_five_int (struct five f)
25; {
26;   return f.a;
27; }
28
29target 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-n32:64-S128"
30target triple = "arm64-apple-ios3.0.0"
31
32%struct.five = type { i32, i32, i32, i32, i32 }
33
34; Function Attrs: nounwind ssp
35define i32 @return_five_int(%struct.five* %f) #0 !dbg !4 {
36entry:
37  call void @llvm.dbg.declare(metadata %struct.five* %f, metadata !17, metadata !DIExpression(DW_OP_deref)), !dbg !18
38  %a = getelementptr inbounds %struct.five, %struct.five* %f, i32 0, i32 0, !dbg !19
39  %0 = load i32, i32* %a, align 4, !dbg !19
40  ret i32 %0, !dbg !19
41}
42
43; Function Attrs: nounwind readnone
44declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
45
46attributes #0 = { nounwind ssp }
47attributes #1 = { nounwind readnone }
48
49!llvm.dbg.cu = !{!0}
50!llvm.module.flags = !{!16, !20}
51
52!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "LLVM version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
53!1 = !DIFile(filename: "struct_by_value.c", directory: "")
54!2 = !{}
55!4 = distinct !DISubprogram(name: "return_five_int", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 14, file: !1, scope: !5, type: !6, retainedNodes: !2)
56!5 = !DIFile(filename: "struct_by_value.c", directory: "")
57!6 = !DISubroutineType(types: !7)
58!7 = !{!8, !9}
59!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
60!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "five", line: 1, size: 160, align: 32, file: !1, elements: !10)
61!10 = !{!11, !12, !13, !14, !15}
62!11 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 3, size: 32, align: 32, file: !1, scope: !9, baseType: !8)
63!12 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 4, size: 32, align: 32, offset: 32, file: !1, scope: !9, baseType: !8)
64!13 = !DIDerivedType(tag: DW_TAG_member, name: "c", line: 5, size: 32, align: 32, offset: 64, file: !1, scope: !9, baseType: !8)
65!14 = !DIDerivedType(tag: DW_TAG_member, name: "d", line: 6, size: 32, align: 32, offset: 96, file: !1, scope: !9, baseType: !8)
66!15 = !DIDerivedType(tag: DW_TAG_member, name: "e", line: 7, size: 32, align: 32, offset: 128, file: !1, scope: !9, baseType: !8)
67!16 = !{i32 2, !"Dwarf Version", i32 2}
68!17 = !DILocalVariable(name: "f", line: 13, arg: 1, scope: !4, file: !5, type: !9)
69!18 = !DILocation(line: 13, scope: !4)
70!19 = !DILocation(line: 16, scope: !4)
71!20 = !{i32 1, !"Debug Info Version", i32 3}
72