blob: 724c38c440e3c2d9d68ec6b11d5b2a907ae8c09f [file] [log] [blame]
Eric Christopher02dbadb2014-02-14 01:26:55 +00001; RUN: llc -generate-arange-section < %s | FileCheck %s
Richard Mitton21101b32013-09-19 23:21:01 +00002
Richard Mitton21101b32013-09-19 23:21:01 +00003; -- header --
Richard Mittonc2508242013-10-03 22:07:08 +00004; CHECK: .short 2 # DWARF Arange version number
Rafael Espindolafcc28212015-03-10 03:58:36 +00005; CHECK-NEXT: .long .Lcu_begin0
Richard Mittonc2508242013-10-03 22:07:08 +00006; CHECK-NEXT: .byte 8 # Address Size (in bytes)
7; CHECK-NEXT: .byte 0 # Segment Size (in bytes)
Richard Mitton21101b32013-09-19 23:21:01 +00008; -- alignment --
Benjamin Kramer8a68ab32014-01-07 19:28:14 +00009; CHECK-NEXT: .zero 4,255
Richard Mitton21101b32013-09-19 23:21:01 +000010
Rafael Espindola4f4ef152015-03-09 22:08:37 +000011; <data section> - it should have made one span covering all vars in this CU.
12; CHECK-NEXT: .quad some_data
Rafael Espindolaf2b408c2015-03-23 21:22:04 +000013; CHECK-NEXT: .quad .Lsec_end0-some_data
Rafael Espindola4f4ef152015-03-09 22:08:37 +000014
15; <other sections> - it should have made one span covering all vars in this CU.
16; CHECK-NEXT: .quad some_other
Rafael Espindolaf2b408c2015-03-23 21:22:04 +000017; CHECK-NEXT: .quad .Lsec_end1-some_other
Rafael Espindola4f4ef152015-03-09 22:08:37 +000018
Richard Mitton089ed892013-09-23 17:56:20 +000019; <common symbols> - it should have made one span for each symbol.
Richard Mittonc2508242013-10-03 22:07:08 +000020; CHECK-NEXT: .quad some_bss
21; CHECK-NEXT: .quad 4
22
Richard Mittonc2508242013-10-03 22:07:08 +000023; <text section> - it should have made one span covering all functions in this CU.
24; CHECK-NEXT: .quad .Lfunc_begin0
Rafael Espindolaf2b408c2015-03-23 21:22:04 +000025; CHECK-NEXT: .quad .Lsec_end2-.Lfunc_begin0
Richard Mitton21101b32013-09-19 23:21:01 +000026
Richard Mittonc2508242013-10-03 22:07:08 +000027; -- finish --
28; CHECK-NEXT: # ARange terminator
Richard Mitton21101b32013-09-19 23:21:01 +000029
Richard Mitton21101b32013-09-19 23:21:01 +000030; -- source code --
31; Generated from: "clang -c -g -emit-llvm"
32;
33; int some_data = 4;
34; int some_bss;
Richard Mittonc2508242013-10-03 22:07:08 +000035; int some_other __attribute__ ((section ("strange+section"))) = 5;
Richard Mitton21101b32013-09-19 23:21:01 +000036;
37; void some_code()
38; {
39; some_bss += some_data + some_other;
40; }
41
Adrian Prantl1eadba12016-12-22 00:45:21 +000042source_filename = "test/DebugInfo/X86/dwarf-aranges.ll"
Richard Mitton21101b32013-09-19 23:21:01 +000043target triple = "x86_64-unknown-linux-gnu"
44
Adrian Prantl1eadba12016-12-22 00:45:21 +000045@some_data = global i32 4, align 4, !dbg !0
46@some_other = global i32 5, section "strange+section", align 4, !dbg !4
47@some_bss = common global i32 0, align 4, !dbg !6
Richard Mitton21101b32013-09-19 23:21:01 +000048
Adrian Prantl1eadba12016-12-22 00:45:21 +000049define void @some_code() !dbg !13 {
Richard Mitton21101b32013-09-19 23:21:01 +000050entry:
Adrian Prantl1eadba12016-12-22 00:45:21 +000051 %0 = load i32, i32* @some_data, align 4, !dbg !16
52 %1 = load i32, i32* @some_other, align 4, !dbg !16
53 %add = add nsw i32 %0, %1, !dbg !16
54 %2 = load i32, i32* @some_bss, align 4, !dbg !16
55 %add1 = add nsw i32 %2, %add, !dbg !16
56 store i32 %add1, i32* @some_bss, align 4, !dbg !16
57 ret void, !dbg !17
Richard Mitton21101b32013-09-19 23:21:01 +000058}
59
Adrian Prantl1eadba12016-12-22 00:45:21 +000060!llvm.dbg.cu = !{!8}
61!llvm.module.flags = !{!11, !12}
Richard Mitton21101b32013-09-19 23:21:01 +000062
Adrian Prantl05782212017-08-30 18:06:51 +000063!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
Adrian Prantl1eadba12016-12-22 00:45:21 +000064!1 = !DIGlobalVariable(name: "some_data", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
65!2 = !DIFile(filename: "test.c", directory: "/home/kayamon")
66!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
Adrian Prantl05782212017-08-30 18:06:51 +000067!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
Adrian Prantl1eadba12016-12-22 00:45:21 +000068!5 = !DIGlobalVariable(name: "some_other", scope: null, file: !2, line: 3, type: !3, isLocal: false, isDefinition: true)
Adrian Prantl05782212017-08-30 18:06:51 +000069!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
Adrian Prantl1eadba12016-12-22 00:45:21 +000070!7 = !DIGlobalVariable(name: "some_bss", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
71!8 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.4 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !9, retainedTypes: !9, globals: !10, imports: !9)
72!9 = !{}
73!10 = !{!0, !4, !6}
74!11 = !{i32 2, !"Dwarf Version", i32 4}
75!12 = !{i32 1, !"Debug Info Version", i32 3}
76!13 = distinct !DISubprogram(name: "some_code", scope: !2, file: !2, line: 5, type: !14, isLocal: false, isDefinition: true, scopeLine: 6, virtualIndex: 6, isOptimized: false, unit: !8, variables: !9)
77!14 = !DISubroutineType(types: !15)
78!15 = !{null}
79!16 = !DILocation(line: 7, scope: !13)
80!17 = !DILocation(line: 8, scope: !13)
81