Fixing a typo in configure.ac.
[oota-llvm.git] / test / DebugInfo / funccall.ll
1 ;; RUN: llvm-upgrade < %s | llvm-as | llc
2
3 ;; Debugger type declarations
4 %llvm.dbg.anchor.type = type { uint, uint }
5 %llvm.dbg.basictype.type = type { uint, {  }*, sbyte*, {  }*, uint, ulong, ulong, ulong, uint, uint }
6 %llvm.dbg.compile_unit.type = type { uint, {  }*, uint, sbyte*, sbyte*, sbyte* }
7 %llvm.dbg.global_variable.type = type { uint, {  }*, {  }*, sbyte*, sbyte*, sbyte*, {  }*, uint, {  }*, bool, bool, {  }* }
8 %llvm.dbg.subprogram.type = type { uint, {  }*, {  }*, sbyte*, sbyte*, sbyte*, {  }*, uint, {  }*, bool, bool }
9 %llvm.dbg.variable.type = type { uint, {  }*, sbyte*, {  }*, uint, {  }* }
10
11 ;; Debugger intrinsic declarations...
12 declare void %llvm.dbg.func.start({  }*)
13 declare void %llvm.dbg.stoppoint(uint, uint, {  }*)
14 declare void %llvm.dbg.declare({  }*, {  }*)
15 declare void %llvm.dbg.region.start({  }*)
16 declare void %llvm.dbg.region.end({  }*)
17
18 ;; Debugger anchors
19 %llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type {
20   uint 393216,                                                                   ;; DW_TAG_anchor | version(6)
21   uint 46 }, section "llvm.metadata"                                             ;; DW_TAG_subprogram
22 %llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type {
23   uint 393216,                                                                   ;; DW_TAG_anchor | version(6)
24   uint 17 }, section "llvm.metadata"                                             ;; DW_TAG_compile_unit
25 %llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type {
26   uint 393216,                                                                   ;; DW_TAG_anchor | version(6)
27   uint 52 }, section "llvm.metadata"                                             ;; DW_TAG_variable
28
29 ;; Debug info
30 %llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type {
31     uint 393262,                                                                 ;; DW_TAG_subprogram | version(6)
32     {  }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*),       ;; Anchor
33     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Context
34     sbyte* getelementptr ([4 x sbyte]* %str, int 0, int 0),                      ;; Name
35     sbyte* getelementptr ([4 x sbyte]* %str, int 0, int 0),                      ;; Fully quanlified name
36     sbyte* null,                                                                 ;; Linkage name
37     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Compile unit
38     uint 4,                                                                      ;; Line number
39     {  }* null,                                                                  ;; Type descriptor
40     bool false,                                                                  ;; Static?
41     bool true }, section "llvm.metadata"                                         ;; External?
42 %str = internal constant [4 x sbyte] c"foo\00", section "llvm.metadata"
43     
44 %llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type {
45     uint 393233,                                                                 ;; DW_TAG_compile_unit | version(6)
46     {  }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*),     ;; Anchor
47     uint 1,                                                                      ;; Language
48     sbyte* getelementptr ([11 x sbyte]* %str, int 0, int 0),                     ;; Source file
49     sbyte* getelementptr ([50 x sbyte]* %str, int 0, int 0),                     ;; Source file directory
50     sbyte* getelementptr ([45 x sbyte]* %str, int 0, int 0) }, section "llvm.metadata" ;; Produceer
51 %str = internal constant [11 x sbyte] c"funccall.c\00", section "llvm.metadata"
52 %str = internal constant [50 x sbyte] c"/Volumes/Big2/llvm/llvm/test/Regression/Debugger/\00", section "llvm.metadata"
53 %str = internal constant [45 x sbyte] c"4.0.1 LLVM (Apple Computer, Inc. build 5421)\00", section "llvm.metadata"
54
55 %llvm.dbg.variable = internal constant %llvm.dbg.variable.type {
56     uint 393472,                                                                 ;; DW_TAG_auto_variable | version(6)
57     {  }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram to {  }*),    ;; Context
58     sbyte* getelementptr ([2 x sbyte]* %str, int 0, int 0),                      ;; Name
59     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Compile unit
60     uint 5,                                                                      ;; Line number
61     {  }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*) }, section "llvm.metadata" ;; Type
62 %str = internal constant [2 x sbyte] c"t\00", section "llvm.metadata"
63
64 %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
65     uint 393252,                                                                 ;; DW_TAG_base_type | version(6)
66     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Context
67     sbyte* getelementptr ([4 x sbyte]* %str1, int 0, int 0),                     ;; Name
68     {  }* null,                                                                  ;; Compile Unit
69     uint 0,                                                                      ;; Line number
70     ulong 32,                                                                    ;; Size in bits
71     ulong 32,                                                                    ;; Align in bits
72     ulong 0,                                                                     ;; Offset in bits
73     uint 0,                                                                      ;; Flags
74     uint 5 }, section "llvm.metadata"                                            ;; Basic type encoding
75 %str1 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
76
77 %llvm.dbg.subprogram2 = internal constant %llvm.dbg.subprogram.type {
78     uint 393262,                                                                 ;; DW_TAG_subprogram | version(6)
79     {  }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*),       ;; Anchor
80     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Context
81     sbyte* getelementptr ([5 x sbyte]* %str, int 0, int 0),                      ;; Name
82     sbyte* getelementptr ([5 x sbyte]* %str, int 0, int 0),                      ;; Fully quanlified name
83     sbyte* null,                                                                 ;; Linkage name
84     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Compile unit
85     uint 8,                                                                      ;; Line number
86     {  }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*),      ;; Type descriptor
87     bool false,                                                                  ;; Static?
88     bool true }, section "llvm.metadata"                                         ;; External?
89 %str = internal constant [5 x sbyte] c"main\00", section "llvm.metadata"
90
91 %llvm.dbg.variable3 = internal constant %llvm.dbg.variable.type {
92     uint 393474,                                                                 ;; DW_TAG_return_variable | version(6)
93     {  }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram2 to {  }*),   ;; Context
94     sbyte* getelementptr ([7 x sbyte]* %str, int 0, int 0),                      ;; Name
95     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Compile unit
96     uint 8,                                                                      ;; Line number
97     {  }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*) }, section "llvm.metadata" ;; Type 
98 %str = internal constant [7 x sbyte] c"retval\00", section "llvm.metadata"
99
100 %llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type {
101     uint 393268,                                                                 ;; DW_TAG_variable | version(6)
102     {  }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to {  }*),  ;; Anchor
103     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Context
104     sbyte* getelementptr ([2 x sbyte]* %str4, int 0, int 0),                     ;; Name
105     sbyte* getelementptr ([2 x sbyte]* %str4, int 0, int 0),                     ;; Fully qualified name
106     sbyte* null,                                                                 ;; Linkage name
107     {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),;; Compile unit
108     uint 2,                                                                      ;; Line number
109     {  }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*),      ;; Type
110     bool true,                                                                   ;; Static?
111     bool true,                                                                   ;; External?
112     {  }* bitcast (int* %q to {  }*) }, section "llvm.metadata"                  ;; Variable
113 %str4 = internal constant [2 x sbyte] c"q\00", section "llvm.metadata"
114
115 ;; Global
116 %q = internal global int 0
117
118 implementation
119
120 void %foo() {
121 entry:
122         %t = alloca int, align 4
123         "alloca point" = bitcast int 0 to int
124         call void %llvm.dbg.func.start( {  }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram to {  }*) )
125         call void %llvm.dbg.stoppoint( uint 4, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
126         %t = bitcast int* %t to {  }*
127         call void %llvm.dbg.declare( {  }* %t, {  }* bitcast (%llvm.dbg.variable.type* %llvm.dbg.variable to {  }*) )
128         call void %llvm.dbg.stoppoint( uint 5, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
129         %tmp = load int* %q
130         store int %tmp, int* %t
131         call void %llvm.dbg.stoppoint( uint 6, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
132         %tmp1 = load int* %t
133         %tmp2 = add int %tmp1, 1
134         store int %tmp2, int* %q
135         call void %llvm.dbg.stoppoint( uint 7, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
136         call void %llvm.dbg.region.end( {  }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram to {  }*) )
137         ret void
138 }
139
140 int %main() {
141 entry:
142         %retval = alloca int, align 4
143         %tmp = alloca int, align 4
144         "alloca point" = bitcast int 0 to int
145         call void %llvm.dbg.func.start( {  }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram2 to {  }*) )
146         call void %llvm.dbg.stoppoint( uint 8, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
147         %retval = bitcast int* %retval to {  }*
148         call void %llvm.dbg.declare( {  }* %retval, {  }* bitcast (%llvm.dbg.variable.type* %llvm.dbg.variable3 to {  }*) )
149         call void %llvm.dbg.stoppoint( uint 9, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
150         store int 0, int* %q
151         call void %llvm.dbg.stoppoint( uint 10, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
152         call void (...)* bitcast (void ()* %foo to void (...)*)( )
153         call void %llvm.dbg.stoppoint( uint 11, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
154         %tmp = load int* %q
155         %tmp1 = sub int %tmp, 1
156         store int %tmp1, int* %q
157         call void %llvm.dbg.stoppoint( uint 13, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
158         %tmp2 = load int* %q
159         store int %tmp2, int* %tmp
160         %tmp3 = load int* %tmp
161         store int %tmp3, int* %retval
162         %retval = load int* %retval
163         call void %llvm.dbg.stoppoint( uint 14, uint 0, {  }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*) )
164         call void %llvm.dbg.region.end( {  }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram2 to {  }*) )
165         ret int %retval
166 }