Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 1 | ; A by-value struct is a register-indirect value (breg). |
| 2 | ; RUN: llc %s -filetype=asm -o - | FileCheck %s |
| 3 | |
Rafael Espindola | f1a13f5 | 2015-03-11 00:51:37 +0000 | [diff] [blame] | 4 | ; CHECK: Lsection_info: |
Alexey Samsonov | 8000e27 | 2014-06-09 21:53:47 +0000 | [diff] [blame] | 5 | ; CHECK: DW_AT_location |
| 6 | ; CHECK-NEXT: .byte 112 |
| 7 | ; 112 = 0x70 = DW_OP_breg0 |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 8 | |
| 9 | ; rdar://problem/13658587 |
| 10 | ; |
| 11 | ; Generated from |
| 12 | ; |
| 13 | ; struct five |
| 14 | ; { |
| 15 | ; int a; |
| 16 | ; int b; |
| 17 | ; int c; |
| 18 | ; int d; |
| 19 | ; int e; |
| 20 | ; }; |
| 21 | ; |
| 22 | ; int |
| 23 | ; return_five_int (struct five f) |
| 24 | ; { |
| 25 | ; return f.a; |
| 26 | ; } |
| 27 | |
| 28 | target 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" |
| 29 | target triple = "arm64-apple-ios3.0.0" |
| 30 | |
| 31 | %struct.five = type { i32, i32, i32, i32, i32 } |
| 32 | |
| 33 | ; Function Attrs: nounwind ssp |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 34 | define i32 @return_five_int(%struct.five* %f) #0 !dbg !4 { |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 35 | entry: |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 36 | call void @llvm.dbg.declare(metadata %struct.five* %f, metadata !17, metadata !DIExpression(DW_OP_deref)), !dbg !18 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 37 | %a = getelementptr inbounds %struct.five, %struct.five* %f, i32 0, i32 0, !dbg !19 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 38 | %0 = load i32, i32* %a, align 4, !dbg !19 |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 39 | ret i32 %0, !dbg !19 |
| 40 | } |
| 41 | |
| 42 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 43 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
Tim Northover | 00ed996 | 2014-03-29 10:18:08 +0000 | [diff] [blame] | 44 | |
| 45 | attributes #0 = { nounwind ssp } |
| 46 | attributes #1 = { nounwind readnone } |
| 47 | |
| 48 | !llvm.dbg.cu = !{!0} |
| 49 | !llvm.module.flags = !{!16, !20} |
| 50 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 51 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "LLVM version 3.4 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 52 | !1 = !DIFile(filename: "struct_by_value.c", directory: "") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 53 | !2 = !{} |
| 54 | !3 = !{!4} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 55 | !4 = distinct !DISubprogram(name: "return_five_int", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 14, file: !1, scope: !5, type: !6, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 56 | !5 = !DIFile(filename: "struct_by_value.c", directory: "") |
| 57 | !6 = !DISubroutineType(types: !7) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 58 | !7 = !{!8, !9} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 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) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 61 | !10 = !{!11, !12, !13, !14, !15} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 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) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 67 | !16 = !{i32 2, !"Dwarf Version", i32 2} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 68 | !17 = !DILocalVariable(name: "f", line: 13, arg: 1, scope: !4, file: !5, type: !9) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 69 | !18 = !DILocation(line: 13, scope: !4) |
| 70 | !19 = !DILocation(line: 16, scope: !4) |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 71 | !20 = !{i32 1, !"Debug Info Version", i32 3} |