7668c958be945ed3e70d0cba59ba177e76315bc8
[scilab.git] / scilab / modules / jit / src / cpp / llvm-wrapper-generated.cpp
1 // Generated by llvm2cpp - DO NOT MODIFY!
2
3
4 Module* makeLLVMModuleContents(Module *mod)
5 {
6
7     mod->setModuleIdentifier("<stdin>");
8
9     // Type Definitions
10     StructType *StructTy_class_std__ios_base__Init = mod->getTypeByName("class.std::ios_base::Init");
11     if (!StructTy_class_std__ios_base__Init)
12     {
13         StructTy_class_std__ios_base__Init = StructType::create(mod->getContext(), "class.std::ios_base::Init");
14     }
15     std::vector<Type*>StructTy_class_std__ios_base__Init_fields;
16     StructTy_class_std__ios_base__Init_fields.push_back(IntegerType::get(mod->getContext(), 8));
17     if (StructTy_class_std__ios_base__Init->isOpaque())
18     {
19         StructTy_class_std__ios_base__Init->setBody(StructTy_class_std__ios_base__Init_fields, /*isPacked=*/false);
20     }
21
22     PointerType* PointerTy_0 = PointerType::get(StructTy_class_std__ios_base__Init, 0);
23
24     PointerType* PointerTy_1 = PointerType::get(IntegerType::get(mod->getContext(), 8), 0);
25
26     std::vector<Type*>StructTy_3_fields;
27     StructTy_3_fields.push_back(IntegerType::get(mod->getContext(), 32));
28     std::vector<Type*>FuncTy_5_args;
29     FunctionType* FuncTy_5 = FunctionType::get(
30                                  /*Result=*/Type::getVoidTy(mod->getContext()),
31                                  /*Params=*/FuncTy_5_args,
32                                  /*isVarArg=*/false);
33
34     PointerType* PointerTy_4 = PointerType::get(FuncTy_5, 0);
35
36     StructTy_3_fields.push_back(PointerTy_4);
37     StructType *StructTy_3 = StructType::get(mod->getContext(), StructTy_3_fields, /*isPacked=*/false);
38
39     ArrayType* ArrayTy_2 = ArrayType::get(StructTy_3, 1);
40
41     PointerType* PointerTy_6 = PointerType::get(ArrayTy_2, 0);
42
43     std::vector<Type*>FuncTy_8_args;
44     FuncTy_8_args.push_back(PointerTy_0);
45     FunctionType* FuncTy_8 = FunctionType::get(
46                                  /*Result=*/Type::getVoidTy(mod->getContext()),
47                                  /*Params=*/FuncTy_8_args,
48                                  /*isVarArg=*/false);
49
50     PointerType* PointerTy_7 = PointerType::get(FuncTy_8, 0);
51
52     std::vector<Type*>FuncTy_10_args;
53     FuncTy_10_args.push_back(PointerTy_1);
54     FunctionType* FuncTy_10 = FunctionType::get(
55                                   /*Result=*/Type::getVoidTy(mod->getContext()),
56                                   /*Params=*/FuncTy_10_args,
57                                   /*isVarArg=*/false);
58
59     PointerType* PointerTy_9 = PointerType::get(FuncTy_10, 0);
60
61     std::vector<Type*>FuncTy_12_args;
62     FuncTy_12_args.push_back(PointerTy_9);
63     FuncTy_12_args.push_back(PointerTy_1);
64     FuncTy_12_args.push_back(PointerTy_1);
65     FunctionType* FuncTy_12 = FunctionType::get(
66                                   /*Result=*/IntegerType::get(mod->getContext(), 32),
67                                   /*Params=*/FuncTy_12_args,
68                                   /*isVarArg=*/false);
69
70     PointerType* PointerTy_11 = PointerType::get(FuncTy_12, 0);
71
72     std::vector<Type*>FuncTy_13_args;
73     FunctionType* FuncTy_13 = FunctionType::get(
74                                   /*Result=*/IntegerType::get(mod->getContext(), 32),
75                                   /*Params=*/FuncTy_13_args,
76                                   /*isVarArg=*/false);
77
78     StructType *StructTy_class_types__Double = mod->getTypeByName("class.types::Double");
79     if (!StructTy_class_types__Double)
80     {
81         StructTy_class_types__Double = StructType::create(mod->getContext(), "class.types::Double");
82     }
83     std::vector<Type*>StructTy_class_types__Double_fields;
84     StructType *StructTy_class_types__ArrayOf = mod->getTypeByName("class.types::ArrayOf");
85     if (!StructTy_class_types__ArrayOf)
86     {
87         StructTy_class_types__ArrayOf = StructType::create(mod->getContext(), "class.types::ArrayOf");
88     }
89     std::vector<Type*>StructTy_class_types__ArrayOf_fields;
90     StructType *StructTy_class_types__GenericType = mod->getTypeByName("class.types::GenericType");
91     if (!StructTy_class_types__GenericType)
92     {
93         StructTy_class_types__GenericType = StructType::create(mod->getContext(), "class.types::GenericType");
94     }
95     std::vector<Type*>StructTy_class_types__GenericType_fields;
96     ArrayType* ArrayTy_16 = ArrayType::get(IntegerType::get(mod->getContext(), 8), 36);
97
98     StructTy_class_types__GenericType_fields.push_back(ArrayTy_16);
99     StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
100     StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
101     StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
102     StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
103     ArrayType* ArrayTy_17 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 50);
104
105     StructTy_class_types__GenericType_fields.push_back(ArrayTy_17);
106     StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
107     if (StructTy_class_types__GenericType->isOpaque())
108     {
109         StructTy_class_types__GenericType->setBody(StructTy_class_types__GenericType_fields, /*isPacked=*/false);
110     }
111
112     StructTy_class_types__ArrayOf_fields.push_back(StructTy_class_types__GenericType);
113     StructTy_class_types__ArrayOf_fields.push_back(IntegerType::get(mod->getContext(), 8));
114     PointerType* PointerTy_18 = PointerType::get(Type::getDoubleTy(mod->getContext()), 0);
115
116     StructTy_class_types__ArrayOf_fields.push_back(PointerTy_18);
117     StructTy_class_types__ArrayOf_fields.push_back(PointerTy_18);
118     if (StructTy_class_types__ArrayOf->isOpaque())
119     {
120         StructTy_class_types__ArrayOf->setBody(StructTy_class_types__ArrayOf_fields, /*isPacked=*/false);
121     }
122
123     StructTy_class_types__Double_fields.push_back(StructTy_class_types__ArrayOf);
124     StructTy_class_types__Double_fields.push_back(IntegerType::get(mod->getContext(), 8));
125     StructTy_class_types__Double_fields.push_back(IntegerType::get(mod->getContext(), 8));
126     if (StructTy_class_types__Double->isOpaque())
127     {
128         StructTy_class_types__Double->setBody(StructTy_class_types__Double_fields, /*isPacked=*/false);
129     }
130
131     PointerType* PointerTy_15 = PointerType::get(StructTy_class_types__Double, 0);
132
133     PointerType* PointerTy_14 = PointerType::get(PointerTy_15, 0);
134
135     PointerType* PointerTy_19 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0);
136
137     std::vector<Type*>FuncTy_21_args;
138     FunctionType* FuncTy_21 = FunctionType::get(
139                                   /*Result=*/PointerTy_15,
140                                   /*Params=*/FuncTy_21_args,
141                                   /*isVarArg=*/false);
142
143     PointerType* PointerTy_20 = PointerType::get(FuncTy_21, 0);
144
145     std::vector<Type*>FuncTy_23_args;
146     FuncTy_23_args.push_back(PointerTy_15);
147     FuncTy_23_args.push_back(PointerTy_15);
148     FuncTy_23_args.push_back(PointerTy_14);
149     FunctionType* FuncTy_23 = FunctionType::get(
150                                   /*Result=*/IntegerType::get(mod->getContext(), 32),
151                                   /*Params=*/FuncTy_23_args,
152                                   /*isVarArg=*/false);
153
154     PointerType* PointerTy_22 = PointerType::get(FuncTy_23, 0);
155
156
157     // Function Declarations
158
159     Function* func___cxx_global_var_init = mod->getFunction("__cxx_global_var_init");
160     if (!func___cxx_global_var_init)
161     {
162         func___cxx_global_var_init = Function::Create(
163                                          /*Type=*/FuncTy_5,
164                                          /*Linkage=*/GlobalValue::InternalLinkage,
165                                          /*Name=*/"__cxx_global_var_init", mod);
166         func___cxx_global_var_init->setCallingConv(CallingConv::C);
167         func___cxx_global_var_init->setSection(".text.startup");
168     }
169     AttrListPtr func___cxx_global_var_init_PAL;
170     func___cxx_global_var_init->setAttributes(func___cxx_global_var_init_PAL);
171
172     Function* func__ZNSt8ios_base4InitC1Ev = mod->getFunction("_ZNSt8ios_base4InitC1Ev");
173     if (!func__ZNSt8ios_base4InitC1Ev)
174     {
175         func__ZNSt8ios_base4InitC1Ev = Function::Create(
176                                            /*Type=*/FuncTy_8,
177                                            /*Linkage=*/GlobalValue::ExternalLinkage,
178                                            /*Name=*/"_ZNSt8ios_base4InitC1Ev", mod); // (external, no body)
179         func__ZNSt8ios_base4InitC1Ev->setCallingConv(CallingConv::C);
180     }
181     AttrListPtr func__ZNSt8ios_base4InitC1Ev_PAL;
182     func__ZNSt8ios_base4InitC1Ev->setAttributes(func__ZNSt8ios_base4InitC1Ev_PAL);
183
184     Function* func__ZNSt8ios_base4InitD1Ev = mod->getFunction("_ZNSt8ios_base4InitD1Ev");
185     if (!func__ZNSt8ios_base4InitD1Ev)
186     {
187         func__ZNSt8ios_base4InitD1Ev = Function::Create(
188                                            /*Type=*/FuncTy_8,
189                                            /*Linkage=*/GlobalValue::ExternalLinkage,
190                                            /*Name=*/"_ZNSt8ios_base4InitD1Ev", mod); // (external, no body)
191         func__ZNSt8ios_base4InitD1Ev->setCallingConv(CallingConv::C);
192     }
193     AttrListPtr func__ZNSt8ios_base4InitD1Ev_PAL;
194     func__ZNSt8ios_base4InitD1Ev->setAttributes(func__ZNSt8ios_base4InitD1Ev_PAL);
195
196     Function* func___cxa_atexit = mod->getFunction("__cxa_atexit");
197     if (!func___cxa_atexit)
198     {
199         func___cxa_atexit = Function::Create(
200                                 /*Type=*/FuncTy_12,
201                                 /*Linkage=*/GlobalValue::ExternalLinkage,
202                                 /*Name=*/"__cxa_atexit", mod); // (external, no body)
203         func___cxa_atexit->setCallingConv(CallingConv::C);
204     }
205     AttrListPtr func___cxa_atexit_PAL;
206     func___cxa_atexit->setAttributes(func___cxa_atexit_PAL);
207
208     Function* func__Z3foov = mod->getFunction("_Z3foov");
209     if (!func__Z3foov)
210     {
211         func__Z3foov = Function::Create(
212                            /*Type=*/FuncTy_13,
213                            /*Linkage=*/GlobalValue::ExternalLinkage,
214                            /*Name=*/"_Z3foov", mod);
215         func__Z3foov->setCallingConv(CallingConv::C);
216     }
217     AttrListPtr func__Z3foov_PAL;
218     func__Z3foov->setAttributes(func__Z3foov_PAL);
219
220     Function* func__ZN5types6Double5EmptyEv = mod->getFunction("_ZN5types6Double5EmptyEv");
221     if (!func__ZN5types6Double5EmptyEv)
222     {
223         func__ZN5types6Double5EmptyEv = Function::Create(
224                                             /*Type=*/FuncTy_21,
225                                             /*Linkage=*/GlobalValue::ExternalLinkage,
226                                             /*Name=*/"_ZN5types6Double5EmptyEv", mod); // (external, no body)
227         func__ZN5types6Double5EmptyEv->setCallingConv(CallingConv::C);
228     }
229     AttrListPtr func__ZN5types6Double5EmptyEv_PAL;
230     func__ZN5types6Double5EmptyEv->setAttributes(func__ZN5types6Double5EmptyEv_PAL);
231
232     Function* func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_ = mod->getFunction("_Z17AddDoubleToDoublePN5types6DoubleES1_PS1_");
233     if (!func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_)
234     {
235         func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_ = Function::Create(
236                     /*Type=*/FuncTy_23,
237                     /*Linkage=*/GlobalValue::ExternalLinkage,
238                     /*Name=*/"_Z17AddDoubleToDoublePN5types6DoubleES1_PS1_", mod); // (external, no body)
239         func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_->setCallingConv(CallingConv::C);
240     }
241     AttrListPtr func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1__PAL;
242     func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_->setAttributes(func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1__PAL);
243
244     Function* func__GLOBAL__I_a = mod->getFunction("_GLOBAL__I_a");
245     if (!func__GLOBAL__I_a)
246     {
247         func__GLOBAL__I_a = Function::Create(
248                                 /*Type=*/FuncTy_5,
249                                 /*Linkage=*/GlobalValue::InternalLinkage,
250                                 /*Name=*/"_GLOBAL__I_a", mod);
251         func__GLOBAL__I_a->setCallingConv(CallingConv::C);
252         func__GLOBAL__I_a->setSection(".text.startup");
253     }
254     AttrListPtr func__GLOBAL__I_a_PAL;
255     func__GLOBAL__I_a->setAttributes(func__GLOBAL__I_a_PAL);
256
257     // Global Variable Declarations
258
259
260     GlobalVariable* gvar_struct__ZStL8__ioinit = new GlobalVariable(/*Module=*/*mod,
261             /*Type=*/StructTy_class_std__ios_base__Init,
262             /*isConstant=*/false,
263             /*Linkage=*/GlobalValue::InternalLinkage,
264             /*Initializer=*/0, // has initializer, specified below
265             /*Name=*/"_ZStL8__ioinit");
266     gvar_struct__ZStL8__ioinit->setAlignment(1);
267
268     GlobalVariable* gvar_int8___dso_handle = new GlobalVariable(/*Module=*/*mod,
269             /*Type=*/IntegerType::get(mod->getContext(), 8),
270             /*isConstant=*/false,
271             /*Linkage=*/GlobalValue::ExternalLinkage,
272             /*Initializer=*/0,
273             /*Name=*/"__dso_handle");
274
275     GlobalVariable* gvar_array_llvm_global_ctors = new GlobalVariable(/*Module=*/*mod,
276             /*Type=*/ArrayTy_2,
277             /*isConstant=*/false,
278             /*Linkage=*/GlobalValue::AppendingLinkage,
279             /*Initializer=*/0, // has initializer, specified below
280             /*Name=*/"llvm.global_ctors");
281
282     // Constant Definitions
283     ConstantAggregateZero* const_struct_24 = ConstantAggregateZero::get(StructTy_class_std__ios_base__Init);
284     std::vector<Constant*> const_array_25_elems;
285     std::vector<Constant*> const_struct_26_fields;
286     ConstantInt* const_int32_27 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("65535"), 10));
287     const_struct_26_fields.push_back(const_int32_27);
288     const_struct_26_fields.push_back(func__GLOBAL__I_a);
289     Constant* const_struct_26 = ConstantStruct::get(StructTy_3, const_struct_26_fields);
290     const_array_25_elems.push_back(const_struct_26);
291     Constant* const_array_25 = ConstantArray::get(ArrayTy_2, const_array_25_elems);
292     Constant* const_ptr_28 = ConstantExpr::getCast(Instruction::BitCast, func__ZNSt8ios_base4InitD1Ev, PointerTy_9);
293     std::vector<Constant*> const_ptr_29_indices;
294     ConstantInt* const_int32_30 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10));
295     const_ptr_29_indices.push_back(const_int32_30);
296     const_ptr_29_indices.push_back(const_int32_30);
297     Constant* const_ptr_29 = ConstantExpr::getGetElementPtr(gvar_struct__ZStL8__ioinit, const_ptr_29_indices);
298     ConstantInt* const_int32_31 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10));
299
300     // Global Variable Definitions
301     gvar_struct__ZStL8__ioinit->setInitializer(const_struct_24);
302     gvar_array_llvm_global_ctors->setInitializer(const_array_25);
303
304     // Function Definitions
305
306     // Function: __cxx_global_var_init (func___cxx_global_var_init)
307     {
308
309         BasicBlock* label_32 = BasicBlock::Create(mod->getContext(), "", func___cxx_global_var_init, 0);
310
311         // Block  (label_32)
312         CallInst* void_33 = CallInst::Create(func__ZNSt8ios_base4InitC1Ev, gvar_struct__ZStL8__ioinit, "", label_32);
313         void_33->setCallingConv(CallingConv::C);
314         void_33->setTailCall(false);
315         AttrListPtr void_33_PAL;
316         void_33->setAttributes(void_33_PAL);
317
318         std::vector<Value*> int32_34_params;
319         int32_34_params.push_back(const_ptr_28);
320         int32_34_params.push_back(const_ptr_29);
321         int32_34_params.push_back(gvar_int8___dso_handle);
322         CallInst* int32_34 = CallInst::Create(func___cxa_atexit, int32_34_params, "", label_32);
323         int32_34->setCallingConv(CallingConv::C);
324         int32_34->setTailCall(false);
325         AttrListPtr int32_34_PAL;
326         int32_34->setAttributes(int32_34_PAL);
327
328         ReturnInst::Create(mod->getContext(), label_32);
329
330     }
331
332     // Function: _Z3foov (func__Z3foov)
333     {
334
335         BasicBlock* label_36 = BasicBlock::Create(mod->getContext(), "", func__Z3foov, 0);
336
337         // Block  (label_36)
338         AllocaInst* ptr_pdbl1 = new AllocaInst(PointerTy_15, "pdbl1", label_36);
339         ptr_pdbl1->setAlignment(8);
340         AllocaInst* ptr_res = new AllocaInst(IntegerType::get(mod->getContext(), 32), "res", label_36);
341         ptr_res->setAlignment(4);
342         CallInst* ptr_37 = CallInst::Create(func__ZN5types6Double5EmptyEv, "", label_36);
343         ptr_37->setCallingConv(CallingConv::C);
344         ptr_37->setTailCall(false);
345         AttrListPtr ptr_37_PAL;
346         ptr_37->setAttributes(ptr_37_PAL);
347
348         StoreInst* void_38 = new StoreInst(ptr_37, ptr_pdbl1, false, label_36);
349         void_38->setAlignment(8);
350         LoadInst* ptr_39 = new LoadInst(ptr_pdbl1, "", false, label_36);
351         ptr_39->setAlignment(8);
352         LoadInst* ptr_40 = new LoadInst(ptr_pdbl1, "", false, label_36);
353         ptr_40->setAlignment(8);
354         std::vector<Value*> int32_41_params;
355         int32_41_params.push_back(ptr_39);
356         int32_41_params.push_back(ptr_40);
357         int32_41_params.push_back(ptr_pdbl1);
358         CallInst* int32_41 = CallInst::Create(func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_, int32_41_params, "", label_36);
359         int32_41->setCallingConv(CallingConv::C);
360         int32_41->setTailCall(false);
361         AttrListPtr int32_41_PAL;
362         int32_41->setAttributes(int32_41_PAL);
363
364         StoreInst* void_42 = new StoreInst(int32_41, ptr_res, false, label_36);
365         void_42->setAlignment(4);
366         LoadInst* int32_43 = new LoadInst(ptr_res, "", false, label_36);
367         int32_43->setAlignment(4);
368         ReturnInst::Create(mod->getContext(), int32_43, label_36);
369
370     }
371
372     // Function: _GLOBAL__I_a (func__GLOBAL__I_a)
373     {
374
375         BasicBlock* label_45 = BasicBlock::Create(mod->getContext(), "", func__GLOBAL__I_a, 0);
376
377         // Block  (label_45)
378         CallInst* void_46 = CallInst::Create(func___cxx_global_var_init, "", label_45);
379         void_46->setCallingConv(CallingConv::C);
380         void_46->setTailCall(false);
381         AttrListPtr void_46_PAL;
382         void_46->setAttributes(void_46_PAL);
383
384         ReturnInst::Create(mod->getContext(), label_45);
385
386     }
387
388     return mod;
389
390 }