xref: /llvm-project/llvm/test/DebugInfo/MSP430/cu-ranges.ll (revision c395a846001aa953e54916c6f88da22173efb25e)
1; RUN: llc -O0 -mtriple=msp430 -filetype=obj %s -o %t
2; RUN: llvm-dwarfdump -v %t | FileCheck %s
3
4; Ported from generic test to cover 2-byte address size case
5; Check that 16-bit addresses of MSP430 are properly stored
6; in 32-bit DWARF fields
7
8; Check that we emit ranges for this which has a non-traditional section and a normal section.
9
10; CHECK: DW_TAG_compile_unit
11; CHECK: DW_AT_ranges
12; CHECK: DW_TAG_subprogram
13; CHECK: DW_AT_low_pc
14; CHECK: DW_AT_high_pc
15; CHECK: DW_TAG_subprogram
16; CHECK: DW_AT_low_pc
17; CHECK: DW_AT_high_pc
18
19; CHECK: .debug_ranges contents:
20; CHECK-NEXT: 00000000 00000000 00000030
21; CHECK-NEXT: 00000000 00000000 00000030
22; CHECK-NEXT: 00000000 <End of list>
23
24; Function Attrs: nounwind uwtable
25define i32 @foo(i32 %a) #0 section "__TEXT,__foo" !dbg !4 {
26entry:
27  %a.addr = alloca i32, align 4
28  store i32 %a, ptr %a.addr, align 4
29  call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !13, metadata !DIExpression()), !dbg !14
30  %0 = load i32, ptr %a.addr, align 4, !dbg !15
31  %add = add nsw i32 %0, 5, !dbg !15
32  ret i32 %add, !dbg !15
33}
34
35; Function Attrs: nounwind readnone
36declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
37
38; Function Attrs: nounwind uwtable
39define i32 @bar(i32 %a) #0 !dbg !9 {
40entry:
41  %a.addr = alloca i32, align 4
42  store i32 %a, ptr %a.addr, align 4
43  call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !16, metadata !DIExpression()), !dbg !17
44  %0 = load i32, ptr %a.addr, align 4, !dbg !18
45  %add = add nsw i32 %0, 5, !dbg !18
46  ret i32 %add, !dbg !18
47}
48
49attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
50attributes #1 = { nounwind readnone }
51
52!llvm.dbg.cu = !{!0}
53!llvm.module.flags = !{!10, !11}
54!llvm.ident = !{!12}
55
56!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
57!1 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo")
58!2 = !{}
59!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
60!5 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo")
61!6 = !DISubroutineType(types: !7)
62!7 = !{!8, !8}
63!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
64!9 = distinct !DISubprogram(name: "bar", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !2)
65!10 = !{i32 2, !"Dwarf Version", i32 4}
66!11 = !{i32 1, !"Debug Info Version", i32 3}
67!12 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"}
68!13 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8)
69!14 = !DILocation(line: 1, scope: !4)
70!15 = !DILocation(line: 2, scope: !4)
71!16 = !DILocalVariable(name: "a", line: 5, arg: 1, scope: !9, file: !5, type: !8)
72!17 = !DILocation(line: 5, scope: !9)
73!18 = !DILocation(line: 6, scope: !9)
74
75