llvm.org GIT mirror llvm / 5a71366
Move dw_op_minus test to DebugInfo/X86. The test requires X86 target support, and checks the actual debug info contents, including register numbers which would be different on other platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248938 91177308-0d34-0410-b5e6-96231b3b80d8 Evgeniy Stepanov 5 years ago
2 changed file(s) with 84 addition(s) and 84 deletion(s). Raw diff Collapse all Expand all
+0
-84
test/DebugInfo/Generic/dw_op_minus.ll less more
None ; Test dwarf codegen of DW_OP_minus.
1 ; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
2
3 ; This was built by compiling the following source with SafeStack and
4 ; simplifying the result a little.
5 ; extern "C" {
6 ; void Capture(int *);
7 ; void f() {
8 ; int buf[100];
9 ; Capture(buf);
10 ; }
11 ; }
12 ; The interesting part is !DIExpression(DW_OP_deref, DW_OP_minus, 400)
13
14 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15 target triple = "x86_64-unknown-linux-gnu"
16
17 @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
18
19 define void @f() {
20 entry:
21 %unsafe_stack_ptr = load i8*, i8** @__safestack_unsafe_stack_ptr
22 %unsafe_stack_static_top = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
23 store i8* %unsafe_stack_static_top, i8** @__safestack_unsafe_stack_ptr
24 %0 = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
25 %buf = bitcast i8* %0 to [100 x i32]*
26 %1 = bitcast [100 x i32]* %buf to i8*, !dbg !16
27 call void @llvm.dbg.declare(metadata i8* %unsafe_stack_ptr, metadata !8, metadata !17), !dbg !18
28 %arraydecay = getelementptr inbounds [100 x i32], [100 x i32]* %buf, i64 0, i64 0, !dbg !19
29 call void @Capture(i32* %arraydecay), !dbg !20
30 store i8* %unsafe_stack_ptr, i8** @__safestack_unsafe_stack_ptr, !dbg !21
31 ret void, !dbg !21
32 }
33
34 ; Function Attrs: nounwind readnone
35 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
36
37 declare void @Capture(i32*)
38
39 !llvm.dbg.cu = !{!0}
40 !llvm.module.flags = !{!13, !14}
41
42 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
43 !1 = !DIFile(filename: "1.cc", directory: "/tmp")
44 !2 = !{}
45 !3 = !{!4}
46 !4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, function: void ()* @f, variables: !7)
47 !5 = !DISubroutineType(types: !6)
48 !6 = !{null}
49 !7 = !{!8}
50 !8 = !DILocalVariable(name: "buf", scope: !4, file: !1, line: 5, type: !9)
51 !9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 3200, align: 32, elements: !11)
52 !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
53 !11 = !{!12}
54 !12 = !DISubrange(count: 100)
55 !13 = !{i32 2, !"Dwarf Version", i32 4}
56 !14 = !{i32 2, !"Debug Info Version", i32 3}
57 !15 = !{!"clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)"}
58 !16 = !DILocation(line: 5, column: 3, scope: !4)
59 !17 = !DIExpression(DW_OP_deref, DW_OP_minus, 400)
60 !18 = !DILocation(line: 5, column: 7, scope: !4)
61 !19 = !DILocation(line: 6, column: 11, scope: !4)
62 !20 = !DILocation(line: 6, column: 3, scope: !4)
63 !21 = !DILocation(line: 7, column: 1, scope: !4)
64
65 ; RCX - 400
66 ; CHECK: .short 6 # Loc expr size
67 ; CHECK-NEXT: .byte 114 # DW_OP_breg2
68 ; CHECK-NEXT: .byte 0 # 0
69 ; CHECK-NEXT: .byte 16 # DW_OP_constu
70 ; CHECK-NEXT: .byte 144 # 400
71 ; CHECK-NEXT: .byte 3 # DW_OP_minus
72 ; CHECK-NEXT: .byte 28
73
74 ; RCX is clobbered in call @Capture, but there is a spilled copy.
75 ; *(RSP + 8) - 400
76 ; CHECK: .short 7 # Loc expr size
77 ; CHECK-NEXT: .byte 119 # DW_OP_breg7
78 ; CHECK-NEXT: .byte 8 # 8
79 ; CHECK-NEXT: .byte 6 # DW_OP_deref
80 ; CHECK-NEXT: .byte 16 # DW_OP_constu
81 ; CHECK-NEXT: .byte 144 # 400
82 ; CHECK-NEXT: .byte 3 # DW_OP_minus
83 ; CHECK-NEXT: .byte 28
0 ; Test dwarf codegen of DW_OP_minus.
1 ; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
2
3 ; This was built by compiling the following source with SafeStack and
4 ; simplifying the result a little.
5 ; extern "C" {
6 ; void Capture(int *);
7 ; void f() {
8 ; int buf[100];
9 ; Capture(buf);
10 ; }
11 ; }
12 ; The interesting part is !DIExpression(DW_OP_deref, DW_OP_minus, 400)
13
14 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15 target triple = "x86_64-unknown-linux-gnu"
16
17 @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global i8*
18
19 define void @f() {
20 entry:
21 %unsafe_stack_ptr = load i8*, i8** @__safestack_unsafe_stack_ptr
22 %unsafe_stack_static_top = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
23 store i8* %unsafe_stack_static_top, i8** @__safestack_unsafe_stack_ptr
24 %0 = getelementptr i8, i8* %unsafe_stack_ptr, i32 -400
25 %buf = bitcast i8* %0 to [100 x i32]*
26 %1 = bitcast [100 x i32]* %buf to i8*, !dbg !16
27 call void @llvm.dbg.declare(metadata i8* %unsafe_stack_ptr, metadata !8, metadata !17), !dbg !18
28 %arraydecay = getelementptr inbounds [100 x i32], [100 x i32]* %buf, i64 0, i64 0, !dbg !19
29 call void @Capture(i32* %arraydecay), !dbg !20
30 store i8* %unsafe_stack_ptr, i8** @__safestack_unsafe_stack_ptr, !dbg !21
31 ret void, !dbg !21
32 }
33
34 ; Function Attrs: nounwind readnone
35 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
36
37 declare void @Capture(i32*)
38
39 !llvm.dbg.cu = !{!0}
40 !llvm.module.flags = !{!13, !14}
41
42 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
43 !1 = !DIFile(filename: "1.cc", directory: "/tmp")
44 !2 = !{}
45 !3 = !{!4}
46 !4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, function: void ()* @f, variables: !7)
47 !5 = !DISubroutineType(types: !6)
48 !6 = !{null}
49 !7 = !{!8}
50 !8 = !DILocalVariable(name: "buf", scope: !4, file: !1, line: 5, type: !9)
51 !9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 3200, align: 32, elements: !11)
52 !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
53 !11 = !{!12}
54 !12 = !DISubrange(count: 100)
55 !13 = !{i32 2, !"Dwarf Version", i32 4}
56 !14 = !{i32 2, !"Debug Info Version", i32 3}
57 !15 = !{!"clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)"}
58 !16 = !DILocation(line: 5, column: 3, scope: !4)
59 !17 = !DIExpression(DW_OP_deref, DW_OP_minus, 400)
60 !18 = !DILocation(line: 5, column: 7, scope: !4)
61 !19 = !DILocation(line: 6, column: 11, scope: !4)
62 !20 = !DILocation(line: 6, column: 3, scope: !4)
63 !21 = !DILocation(line: 7, column: 1, scope: !4)
64
65 ; RCX - 400
66 ; CHECK: .short 6 # Loc expr size
67 ; CHECK-NEXT: .byte 114 # DW_OP_breg2
68 ; CHECK-NEXT: .byte 0 # 0
69 ; CHECK-NEXT: .byte 16 # DW_OP_constu
70 ; CHECK-NEXT: .byte 144 # 400
71 ; CHECK-NEXT: .byte 3 # DW_OP_minus
72 ; CHECK-NEXT: .byte 28
73
74 ; RCX is clobbered in call @Capture, but there is a spilled copy.
75 ; *(RSP + 8) - 400
76 ; CHECK: .short 7 # Loc expr size
77 ; CHECK-NEXT: .byte 119 # DW_OP_breg7
78 ; CHECK-NEXT: .byte 8 # 8
79 ; CHECK-NEXT: .byte 6 # DW_OP_deref
80 ; CHECK-NEXT: .byte 16 # DW_OP_constu
81 ; CHECK-NEXT: .byte 144 # 400
82 ; CHECK-NEXT: .byte 3 # DW_OP_minus
83 ; CHECK-NEXT: .byte 28