Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 1 | ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s |
| 2 | ; REQUIRES: object-emission |
| 3 | |
| 4 | ; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source |
| 5 | ; |
| 6 | ; // every object of type struct data will be aligned to 128-byte boundary |
| 7 | ; struct data { |
| 8 | ; char x; |
| 9 | ; _Alignas(128) char arr[2]; |
| 10 | ; }; |
| 11 | ; |
| 12 | ; _Alignas(2048) struct data d; // this instance of data is aligned even stricter |
| 13 | ; int foo(void) |
| 14 | ; { |
| 15 | ; struct data local_data; |
| 16 | ; return 0; |
| 17 | ; } |
| 18 | |
| 19 | ; CHECK: DW_TAG_variable |
| 20 | ; CHECK-NOT: DW_TAG |
| 21 | ; CHECK: DW_AT_name{{.*}}"d" |
| 22 | ; CHECK-NOT: DW_TAG |
| 23 | ; CHECK: DW_AT_alignment{{.*}}2048 |
| 24 | ; CHECK: DW_TAG_structure_type |
| 25 | ; CHECK: DW_TAG_member |
| 26 | ; CHECK: DW_TAG_member |
| 27 | ; CHECK-NOT: DW_TAG |
| 28 | ; CHECK: DW_AT_name{{.*}}"arr" |
| 29 | ; CHECK-NOT: DW_TAG |
| 30 | ; CHECK: DW_AT_alignment{{.*}}128 |
| 31 | |
| 32 | ; ModuleID = 'test.c' |
| 33 | source_filename = "test.c" |
| 34 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 35 | target triple = "x86_64-unknown-linux-gnu" |
| 36 | |
| 37 | %struct.data = type { i8, [127 x i8], [2 x i8], [126 x i8] } |
| 38 | |
| 39 | @d = common global %struct.data zeroinitializer, align 2048, !dbg !0 |
| 40 | |
| 41 | ; Function Attrs: nounwind uwtable |
| 42 | define i32 @foo() #0 !dbg !17 { |
| 43 | entry: |
| 44 | %local_data = alloca %struct.data, align 128 |
| 45 | call void @llvm.dbg.declare(metadata %struct.data* %local_data, metadata !21, metadata !22), !dbg !23 |
| 46 | ret i32 0, !dbg !24 |
| 47 | } |
| 48 | |
| 49 | ; Function Attrs: nounwind readnone |
| 50 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 51 | |
| 52 | attributes #0 = { nounwind uwtable } |
| 53 | attributes #1 = { nounwind readnone } |
| 54 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 55 | !llvm.dbg.cu = !{!2} |
Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 56 | !llvm.module.flags = !{!14, !15} |
| 57 | !llvm.ident = !{!16} |
| 58 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 59 | !0 = distinct !DIGlobalVariableExpression(var: !1) |
| 60 | !1 = !DIGlobalVariable(name: "d", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, align: 16384) |
| 61 | !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) |
| 62 | !3 = !DIFile(filename: "test.c", directory: "/tmp") |
| 63 | !4 = !{} |
| 64 | !5 = !{!0} |
| 65 | !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "data", file: !3, line: 2, size: 2048, elements: !7) |
Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 66 | !7 = !{!8, !10} |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 67 | !8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !3, line: 3, baseType: !9, size: 8) |
Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 68 | !9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 69 | !10 = !DIDerivedType(tag: DW_TAG_member, name: "arr", scope: !6, file: !3, line: 4, baseType: !11, size: 16, align: 1024, offset: 1024) |
Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 70 | !11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 16, elements: !12) |
| 71 | !12 = !{!13} |
| 72 | !13 = !DISubrange(count: 2) |
| 73 | !14 = !{i32 2, !"Dwarf Version", i32 4} |
| 74 | !15 = !{i32 2, !"Debug Info Version", i32 3} |
| 75 | !16 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"} |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 76 | !17 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 8, type: !18, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !2, variables: !4) |
Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 77 | !18 = !DISubroutineType(types: !19) |
| 78 | !19 = !{!20} |
| 79 | !20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 80 | !21 = !DILocalVariable(name: "local_data", scope: !17, file: !3, line: 10, type: !6) |
Victor Leschuk | 3c98998 | 2016-10-26 11:59:03 +0000 | [diff] [blame] | 81 | !22 = !DIExpression() |
| 82 | !23 = !DILocation(line: 10, column: 17, scope: !17) |
| 83 | !24 = !DILocation(line: 11, column: 5, scope: !17) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 84 | |