blob: 7ead32faec243ec8513f00126274d4059d3f61e8 [file] [log] [blame]
Chris Lattner7bfdd862005-12-21 05:09:57 +00001; Verify debugger intrinsics are ignored or accepted.
2; RUN: llvm-as < %s | llc
Chris Lattner7bfdd862005-12-21 05:09:57 +00003
4;; Debugger type declarations
5%lldb.compile_unit = type { uint, ushort, ushort, sbyte*, sbyte*, sbyte*, {}* }
6%lldb.global = type { uint, %lldb.compile_unit*, sbyte*, {}*, sbyte*, bool, bool }
7%lldb.local = type { uint, %lldb.global*, sbyte*, sbyte*, bool, bool }
8
9
10;; Debugger intrinsic declarations...
11declare {}* %llvm.dbg.stoppoint({}*, uint, uint, %lldb.compile_unit*)
12declare {}* %llvm.dbg.func.start(%lldb.global*)
13declare {}* %llvm.dbg.region.start({}*)
14declare {}* %llvm.dbg.region.end({}*)
15declare {}* %llvm.dbg.declare({}*, ...)
16
17;; Global object anchors
18%llvm.dbg.translation_units = linkonce global {} {}
19%llvm.dbg.globals = linkonce global {} {}
20
21
22%.str_1 = internal constant [11 x sbyte] c"funccall.c\00"
23%.str_2 = internal constant [12 x sbyte] c"/home/sabre\00"
24%.str_3 = internal constant [14 x sbyte] c"llvmgcc 3.4.x\00"
25
26%d.compile_unit = internal constant %lldb.compile_unit {
27 uint 17, ;; DW_TAG_compile_unit
28 ushort 0, ;; LLVM Debug version #
29 ushort 1, ;; Language: DW_LANG_C89
30 sbyte* getelementptr ([11 x sbyte]* %.str_1, long 0, long 0), ;; Source filename
31 sbyte* getelementptr ([12 x sbyte]* %.str_2, long 0, long 0), ;; Working directory
32 sbyte* getelementptr ([14 x sbyte]* %.str_3, long 0, long 0), ;; producer
33 {}* %llvm.dbg.translation_units ;; Anchor
34}
35
36
37%.str_5 = internal global [5 x sbyte] c"main\00"
38%.str_6 = internal global [4 x sbyte] c"foo\00"
39%.str_7 = internal global [2 x sbyte] c"q\00"
40%.str_8 = internal global [2 x sbyte] c"t\00"
41
42%d.main = global %lldb.global {
43 uint 46, ;; DW_TAG_subprogram
44 %lldb.compile_unit* %d.compile_unit, ;; context pointer
45 sbyte* getelementptr ([5 x sbyte]* %.str_5, long 0, long 0), ;; name
46 {}* %llvm.dbg.globals, ;; anchor
47 sbyte* null, ;; EVENTUALLY the type
48 bool true, ;; non-static linkage?
49 bool false ;; definition, not declaration
50}
51
52%d.foo = global %lldb.global {
53 uint 46, ;; DW_TAG_subprogram
54 %lldb.compile_unit* %d.compile_unit, ;; context pointer
55 sbyte* getelementptr ([4 x sbyte]* %.str_6, long 0, long 0), ;; name
56 {}* %llvm.dbg.globals, ;; anchor
57 sbyte* null, ;; EVENTUALLY the type
58 bool true, ;; non-static linkage
59 bool false ;; definition, not declaration
60}
61
62%d.q = internal global %lldb.global {
63 uint 52, ;; DW_TAG_variable
64 %lldb.compile_unit* %d.compile_unit, ;; context pointer
65 sbyte* getelementptr ([2 x sbyte]* %.str_7, long 0, long 0), ;; name
66 {}* %llvm.dbg.globals, ;; anchor
67 sbyte* null, ;; EVENTUALLY the type
68 bool false, ;; static linkage
69 bool false ;; definition, not declaration
70}
71
72
73%d.t = internal global %lldb.local {
74 uint 52, ;; DW_TAG_variable
75 %lldb.global* %d.foo, ;; context pointer
76 sbyte* getelementptr ([2 x sbyte]* %.str_8, long 0, long 0), ;; name
77 sbyte* null, ;; EVENTUALLY the type
78 bool false, ;; local variable
79 bool false ;; definition, not declaratation
80}
81
82
83
84%q = internal global int 0
85
86implementation ; Functions:
87
88void %foo() {
89entry:
90 %t = alloca int
91 %.1 = call {}* %llvm.dbg.func.start(%lldb.global* %d.foo)
92 %.2 = call {}* %llvm.dbg.stoppoint({}* %.1, uint 5, uint 2, %lldb.compile_unit* %d.compile_unit)
93
94 %.3 = call {}*({}*, ...)* %llvm.dbg.declare({}* %.2, %lldb.local* %d.t, int* %t)
95 %tmp.0 = load int* %q
96 store int %tmp.0, int* %t
97 %.4 = call {}* %llvm.dbg.stoppoint({}* %.3, uint 6, uint 2, %lldb.compile_unit* %d.compile_unit)
98 %tmp.01 = load int* %t
99 %tmp.1 = add int %tmp.01, 1
100 store int %tmp.1, int* %q
101 %.5 = call {}* %llvm.dbg.stoppoint({}* %.4, uint 7, uint 1, %lldb.compile_unit* %d.compile_unit)
102 call {}* %llvm.dbg.region.end({}* %.5)
103 ret void
104}
105
106int %main() {
107entry:
108 %.1 = call {}* %llvm.dbg.func.start(%lldb.global* %d.main)
109 %result = alloca int
110 %.2 = call {}* %llvm.dbg.stoppoint({}* %.1, uint 9, uint 2, %lldb.compile_unit* %d.compile_unit)
111 store int 0, int* %q
112 %.3 = call {}* %llvm.dbg.stoppoint({}* %.2, uint 10, uint 2, %lldb.compile_unit* %d.compile_unit)
113 call void %foo()
114 %.4 = call {}* %llvm.dbg.stoppoint({}* %.3, uint 11, uint 2, %lldb.compile_unit* %d.compile_unit)
115 %tmp.2 = load int* %q
116 %tmp.3 = sub int %tmp.2, 1
117 store int %tmp.3, int* %q
118 %.5 = call {}* %llvm.dbg.stoppoint({}* %.4, uint 13, uint 2, %lldb.compile_unit* %d.compile_unit)
119 %tmp.4 = load int* %q
120 store int %tmp.4, int* %result
121 %tmp.5 = load int* %result
122 %.6 = call {}* %llvm.dbg.stoppoint({}* %.5, uint 14, uint 1, %lldb.compile_unit* %d.compile_unit)
123 call {}* %llvm.dbg.region.end({}* %.6)
124 ret int %tmp.5
125}