blob: ba218c8ef2452de4190f195af43b6fe9dc0e0185 [file] [log] [blame]
Chris Lattner502fe922006-03-10 22:32:18 +00001;; RUN: llvm-as < %s | llc
Chris Lattner7eed62b2004-11-06 21:07:31 +00002
Chris Lattner019314c2004-01-06 05:37:45 +00003;; Debugger type declarations
4%lldb.compile_unit = type { uint, ushort, ushort, sbyte*, sbyte*, sbyte*, {}* }
5%lldb.global = type { uint, %lldb.compile_unit*, sbyte*, {}*, sbyte*, bool, bool }
6%lldb.local = type { uint, %lldb.global*, sbyte*, sbyte*, bool, bool }
7
8
9;; Debugger intrinsic declarations...
10declare {}* %llvm.dbg.stoppoint({}*, uint, uint, %lldb.compile_unit*)
11declare {}* %llvm.dbg.func.start(%lldb.global*)
12declare {}* %llvm.dbg.region.start({}*)
13declare {}* %llvm.dbg.region.end({}*)
Chris Lattner019314c2004-01-06 05:37:45 +000014
15;; Global object anchors
16%llvm.dbg.translation_units = linkonce global {} {}
17%llvm.dbg.globals = linkonce global {} {}
18
19
20%.str_1 = internal constant [11 x sbyte] c"funccall.c\00"
21%.str_2 = internal constant [12 x sbyte] c"/home/sabre\00"
22%.str_3 = internal constant [14 x sbyte] c"llvmgcc 3.4.x\00"
23
24%d.compile_unit = internal constant %lldb.compile_unit {
25 uint 17, ;; DW_TAG_compile_unit
26 ushort 0, ;; LLVM Debug version #
27 ushort 1, ;; Language: DW_LANG_C89
28 sbyte* getelementptr ([11 x sbyte]* %.str_1, long 0, long 0), ;; Source filename
29 sbyte* getelementptr ([12 x sbyte]* %.str_2, long 0, long 0), ;; Working directory
30 sbyte* getelementptr ([14 x sbyte]* %.str_3, long 0, long 0), ;; producer
31 {}* %llvm.dbg.translation_units ;; Anchor
32}
33
34
35%.str_5 = internal global [5 x sbyte] c"main\00"
36%.str_6 = internal global [4 x sbyte] c"foo\00"
37%.str_7 = internal global [2 x sbyte] c"q\00"
38%.str_8 = internal global [2 x sbyte] c"t\00"
39
40%d.main = global %lldb.global {
41 uint 46, ;; DW_TAG_subprogram
42 %lldb.compile_unit* %d.compile_unit, ;; context pointer
43 sbyte* getelementptr ([5 x sbyte]* %.str_5, long 0, long 0), ;; name
44 {}* %llvm.dbg.globals, ;; anchor
45 sbyte* null, ;; EVENTUALLY the type
46 bool true, ;; non-static linkage?
47 bool false ;; definition, not declaration
48}
49
50%d.foo = global %lldb.global {
51 uint 46, ;; DW_TAG_subprogram
52 %lldb.compile_unit* %d.compile_unit, ;; context pointer
53 sbyte* getelementptr ([4 x sbyte]* %.str_6, long 0, long 0), ;; name
54 {}* %llvm.dbg.globals, ;; anchor
55 sbyte* null, ;; EVENTUALLY the type
56 bool true, ;; non-static linkage
57 bool false ;; definition, not declaration
58}
59
60%d.q = internal global %lldb.global {
61 uint 52, ;; DW_TAG_variable
62 %lldb.compile_unit* %d.compile_unit, ;; context pointer
63 sbyte* getelementptr ([2 x sbyte]* %.str_7, long 0, long 0), ;; name
64 {}* %llvm.dbg.globals, ;; anchor
65 sbyte* null, ;; EVENTUALLY the type
66 bool false, ;; static linkage
67 bool false ;; definition, not declaration
68}
69
70
71%d.t = internal global %lldb.local {
72 uint 52, ;; DW_TAG_variable
73 %lldb.global* %d.foo, ;; context pointer
74 sbyte* getelementptr ([2 x sbyte]* %.str_8, long 0, long 0), ;; name
75 sbyte* null, ;; EVENTUALLY the type
76 bool false, ;; local variable
77 bool false ;; definition, not declaratation
78}
79
80
81
82%q = internal global int 0
Chris Lattner94276b62004-01-05 05:32:40 +000083
84implementation ; Functions:
85
Chris Lattner94276b62004-01-05 05:32:40 +000086void %foo() {
Chris Lattner019314c2004-01-06 05:37:45 +000087entry:
88 %t = alloca int
89 %.1 = call {}* %llvm.dbg.func.start(%lldb.global* %d.foo)
90 %.2 = call {}* %llvm.dbg.stoppoint({}* %.1, uint 5, uint 2, %lldb.compile_unit* %d.compile_unit)
91
Chris Lattner019314c2004-01-06 05:37:45 +000092 %tmp.0 = load int* %q
Chris Lattner94276b62004-01-05 05:32:40 +000093 store int %tmp.0, int* %t
Chris Lattner502fe922006-03-10 22:32:18 +000094 %.4 = call {}* %llvm.dbg.stoppoint({}* %.2, uint 6, uint 2, %lldb.compile_unit* %d.compile_unit)
Chris Lattner019314c2004-01-06 05:37:45 +000095 %tmp.01 = load int* %t
96 %tmp.1 = add int %tmp.01, 1
Chris Lattner94276b62004-01-05 05:32:40 +000097 store int %tmp.1, int* %q
Chris Lattner019314c2004-01-06 05:37:45 +000098 %.5 = call {}* %llvm.dbg.stoppoint({}* %.4, uint 7, uint 1, %lldb.compile_unit* %d.compile_unit)
99 call {}* %llvm.dbg.region.end({}* %.5)
Chris Lattner94276b62004-01-05 05:32:40 +0000100 ret void
101}
102
103int %main() {
104entry:
Chris Lattner019314c2004-01-06 05:37:45 +0000105 %.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)
Chris Lattner94276b62004-01-05 05:32:40 +0000108 store int 0, int* %q
Chris Lattner019314c2004-01-06 05:37:45 +0000109 %.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
Chris Lattner94276b62004-01-05 05:32:40 +0000114 store int %tmp.3, int* %q
Chris Lattner019314c2004-01-06 05:37:45 +0000115 %.5 = call {}* %llvm.dbg.stoppoint({}* %.4, uint 13, uint 2, %lldb.compile_unit* %d.compile_unit)
116 %tmp.4 = load int* %q
Chris Lattner94276b62004-01-05 05:32:40 +0000117 store int %tmp.4, int* %result
Chris Lattner019314c2004-01-06 05:37:45 +0000118 %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)
Chris Lattner94276b62004-01-05 05:32:40 +0000121 ret int %tmp.5
122}