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