comparison gen/runtime.cpp @ 213:7816aafeea3c trunk

[svn r229] Updated the object.d implementation to the latest Tango. Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array. Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 . Cleaned up some type code. Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant. Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
author lindquist
date Fri, 30 May 2008 19:32:04 +0200
parents c4c9b4ac021b
children 0db62b770a49
comparison
equal deleted inserted replaced
212:4c2689d57ba4 213:7816aafeea3c
130 return new llvm::GlobalVariable(t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName(),target); 130 return new llvm::GlobalVariable(t->getElementType(),g->isConstant(),g->getLinkage(),NULL,g->getName(),target);
131 } 131 }
132 132
133 ////////////////////////////////////////////////////////////////////////////////////////////////// 133 //////////////////////////////////////////////////////////////////////////////////////////////////
134 134
135 static const llvm::Type* rt_ptr(const llvm::Type* t) 135 static const LLType* rt_ptr(const LLType* t)
136 { 136 {
137 return getPtrToType(t); 137 return getPtrToType(t);
138 } 138 }
139 139
140 static const llvm::Type* rt_array(const llvm::Type* elemty) 140 static const LLType* rt_array(const LLType* elemty)
141 { 141 {
142 std::vector<const llvm::Type*> t; 142 std::vector<const LLType*> t;
143 t.push_back(DtoSize_t()); 143 t.push_back(DtoSize_t());
144 t.push_back(rt_ptr(elemty)); 144 t.push_back(rt_ptr(elemty));
145 return rt_ptr(llvm::StructType::get(t)); 145 return rt_ptr(llvm::StructType::get(t));
146 } 146 }
147 147
148 static const llvm::Type* rt_array2(const llvm::Type* elemty) 148 static const LLType* rt_array2(const LLType* elemty)
149 { 149 {
150 std::vector<const llvm::Type*> t; 150 std::vector<const LLType*> t;
151 t.push_back(DtoSize_t()); 151 t.push_back(DtoSize_t());
152 t.push_back(rt_ptr(elemty)); 152 t.push_back(rt_ptr(elemty));
153 return llvm::StructType::get(t); 153 return llvm::StructType::get(t);
154 } 154 }
155 155
156 static const llvm::Type* rt_dg1() 156 static const LLType* rt_dg1()
157 { 157 {
158 std::vector<const llvm::Type*> types; 158 std::vector<const LLType*> types;
159 types.push_back(rt_ptr(llvm::Type::Int8Ty)); 159 types.push_back(rt_ptr(llvm::Type::Int8Ty));
160 types.push_back(rt_ptr(llvm::Type::Int8Ty)); 160 types.push_back(rt_ptr(llvm::Type::Int8Ty));
161 const llvm::FunctionType* fty = llvm::FunctionType::get(llvm::Type::Int32Ty, types, false); 161 const llvm::FunctionType* fty = llvm::FunctionType::get(llvm::Type::Int32Ty, types, false);
162 162
163 std::vector<const llvm::Type*> t; 163 std::vector<const LLType*> t;
164 t.push_back(rt_ptr(llvm::Type::Int8Ty)); 164 t.push_back(rt_ptr(llvm::Type::Int8Ty));
165 t.push_back(rt_ptr(fty)); 165 t.push_back(rt_ptr(fty));
166 return rt_ptr(llvm::StructType::get(t)); 166 return rt_ptr(llvm::StructType::get(t));
167 } 167 }
168 168
169 static const llvm::Type* rt_dg2() 169 static const LLType* rt_dg2()
170 { 170 {
171 std::vector<const llvm::Type*> types; 171 std::vector<const LLType*> types;
172 types.push_back(rt_ptr(llvm::Type::Int8Ty)); 172 types.push_back(rt_ptr(llvm::Type::Int8Ty));
173 types.push_back(rt_ptr(llvm::Type::Int8Ty)); 173 types.push_back(rt_ptr(llvm::Type::Int8Ty));
174 types.push_back(rt_ptr(llvm::Type::Int8Ty)); 174 types.push_back(rt_ptr(llvm::Type::Int8Ty));
175 const llvm::FunctionType* fty = llvm::FunctionType::get(llvm::Type::Int32Ty, types, false); 175 const llvm::FunctionType* fty = llvm::FunctionType::get(llvm::Type::Int32Ty, types, false);
176 176
177 std::vector<const llvm::Type*> t; 177 std::vector<const LLType*> t;
178 t.push_back(rt_ptr(llvm::Type::Int8Ty)); 178 t.push_back(rt_ptr(llvm::Type::Int8Ty));
179 t.push_back(rt_ptr(fty)); 179 t.push_back(rt_ptr(fty));
180 return rt_ptr(llvm::StructType::get(t)); 180 return rt_ptr(llvm::StructType::get(t));
181 } 181 }
182 182
183 static void LLVM_D_BuildRuntimeModule() 183 static void LLVM_D_BuildRuntimeModule()
184 { 184 {
185 M = new llvm::Module("llvmdc internal runtime"); 185 M = new llvm::Module("llvmdc internal runtime");
186 186
187 const llvm::Type* voidTy = llvm::Type::VoidTy; 187 const LLType* voidTy = llvm::Type::VoidTy;
188 const llvm::Type* boolTy = llvm::Type::Int1Ty; 188 const LLType* boolTy = llvm::Type::Int1Ty;
189 const llvm::Type* byteTy = llvm::Type::Int8Ty; 189 const LLType* byteTy = llvm::Type::Int8Ty;
190 const llvm::Type* shortTy = llvm::Type::Int16Ty; 190 const LLType* shortTy = llvm::Type::Int16Ty;
191 const llvm::Type* intTy = llvm::Type::Int32Ty; 191 const LLType* intTy = llvm::Type::Int32Ty;
192 const llvm::Type* longTy = llvm::Type::Int64Ty; 192 const LLType* longTy = llvm::Type::Int64Ty;
193 const llvm::Type* floatTy = llvm::Type::FloatTy; 193 const LLType* floatTy = llvm::Type::FloatTy;
194 const llvm::Type* doubleTy = llvm::Type::DoubleTy; 194 const LLType* doubleTy = llvm::Type::DoubleTy;
195 const llvm::Type* sizeTy = DtoSize_t(); 195 const LLType* sizeTy = DtoSize_t();
196 const llvm::Type* voidPtrTy = rt_ptr(byteTy); 196 const LLType* voidPtrTy = rt_ptr(byteTy);
197 const llvm::Type* stringTy = rt_array(byteTy); 197 const LLType* stringTy = rt_array(byteTy);
198 const llvm::Type* wstringTy = rt_array(shortTy); 198 const LLType* wstringTy = rt_array(shortTy);
199 const llvm::Type* dstringTy = rt_array(intTy); 199 const LLType* dstringTy = rt_array(intTy);
200 const llvm::Type* objectTy = rt_ptr(ClassDeclaration::object->type->ir.type->get()); 200 const LLType* objectTy = rt_ptr(ClassDeclaration::object->type->ir.type->get());
201 const llvm::Type* classInfoTy = rt_ptr(ClassDeclaration::classinfo->type->ir.type->get()); 201 const LLType* classInfoTy = rt_ptr(ClassDeclaration::classinfo->type->ir.type->get());
202 const llvm::Type* typeInfoTy = rt_ptr(Type::typeinfo->type->ir.type->get()); 202 const LLType* typeInfoTy = rt_ptr(Type::typeinfo->type->ir.type->get());
203 const llvm::Type* aaTy = rt_ptr(llvm::OpaqueType::get()); 203 const LLType* aaTy = rt_ptr(llvm::OpaqueType::get());
204 204
205 ///////////////////////////////////////////////////////////////////////////////////// 205 /////////////////////////////////////////////////////////////////////////////////////
206 ///////////////////////////////////////////////////////////////////////////////////// 206 /////////////////////////////////////////////////////////////////////////////////////
207 ///////////////////////////////////////////////////////////////////////////////////// 207 /////////////////////////////////////////////////////////////////////////////////////
208 208
211 // void _d_switch_error( char[] file, uint line ) 211 // void _d_switch_error( char[] file, uint line )
212 { 212 {
213 std::string fname("_d_assert"); 213 std::string fname("_d_assert");
214 std::string fname2("_d_array_bounds"); 214 std::string fname2("_d_array_bounds");
215 std::string fname3("_d_switch_error"); 215 std::string fname3("_d_switch_error");
216 std::vector<const llvm::Type*> types; 216 std::vector<const LLType*> types;
217 types.push_back(stringTy); 217 types.push_back(stringTy);
218 types.push_back(intTy); 218 types.push_back(intTy);
219 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 219 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
220 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 220 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
221 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 221 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
223 } 223 }
224 224
225 // void _d_assert_msg( char[] msg, char[] file, uint line ) 225 // void _d_assert_msg( char[] msg, char[] file, uint line )
226 { 226 {
227 std::string fname("_d_assert_msg"); 227 std::string fname("_d_assert_msg");
228 std::vector<const llvm::Type*> types; 228 std::vector<const LLType*> types;
229 types.push_back(stringTy); 229 types.push_back(stringTy);
230 types.push_back(stringTy); 230 types.push_back(stringTy);
231 types.push_back(intTy); 231 types.push_back(intTy);
232 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 232 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
233 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 233 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
238 ///////////////////////////////////////////////////////////////////////////////////// 238 /////////////////////////////////////////////////////////////////////////////////////
239 239
240 // void* _d_allocmemoryT(TypeInfo ti) 240 // void* _d_allocmemoryT(TypeInfo ti)
241 { 241 {
242 std::string fname("_d_allocmemoryT"); 242 std::string fname("_d_allocmemoryT");
243 std::vector<const llvm::Type*> types; 243 std::vector<const LLType*> types;
244 types.push_back(typeInfoTy); 244 types.push_back(typeInfoTy);
245 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 245 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
246 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 246 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
247 } 247 }
248 248
249 // void* _d_newarrayT(TypeInfo ti, size_t length) 249 // void* _d_newarrayT(TypeInfo ti, size_t length)
250 // void* _d_newarrayiT(TypeInfo ti, size_t length) 250 // void* _d_newarrayiT(TypeInfo ti, size_t length)
251 { 251 {
252 std::string fname("_d_newarrayT"); 252 std::string fname("_d_newarrayT");
253 std::string fname2("_d_newarrayiT"); 253 std::string fname2("_d_newarrayiT");
254 std::vector<const llvm::Type*> types; 254 std::vector<const LLType*> types;
255 types.push_back(typeInfoTy); 255 types.push_back(typeInfoTy);
256 types.push_back(sizeTy); 256 types.push_back(sizeTy);
257 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 257 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
258 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 258 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
259 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 259 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
262 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) 262 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata)
263 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) 263 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata)
264 { 264 {
265 std::string fname("_d_arraysetlengthT"); 265 std::string fname("_d_arraysetlengthT");
266 std::string fname2("_d_arraysetlengthiT"); 266 std::string fname2("_d_arraysetlengthiT");
267 std::vector<const llvm::Type*> types; 267 std::vector<const LLType*> types;
268 types.push_back(typeInfoTy); 268 types.push_back(typeInfoTy);
269 types.push_back(sizeTy); 269 types.push_back(sizeTy);
270 types.push_back(sizeTy); 270 types.push_back(sizeTy);
271 types.push_back(voidPtrTy); 271 types.push_back(voidPtrTy);
272 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 272 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
275 } 275 }
276 276
277 // Object _d_newclass(ClassInfo ci) 277 // Object _d_newclass(ClassInfo ci)
278 { 278 {
279 std::string fname("_d_newclass"); 279 std::string fname("_d_newclass");
280 std::vector<const llvm::Type*> types; 280 std::vector<const LLType*> types;
281 types.push_back(classInfoTy); 281 types.push_back(classInfoTy);
282 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 282 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
283 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 283 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
284 } 284 }
285 285
286 // void _d_delarray(size_t plength, void* pdata) 286 // void _d_delarray(size_t plength, void* pdata)
287 { 287 {
288 std::string fname("_d_delarray"); 288 std::string fname("_d_delarray");
289 std::vector<const llvm::Type*> types; 289 std::vector<const LLType*> types;
290 types.push_back(sizeTy); 290 types.push_back(sizeTy);
291 types.push_back(voidPtrTy); 291 types.push_back(voidPtrTy);
292 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 292 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
293 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 293 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
294 } 294 }
298 // void _d_callfinalizer(void* p) 298 // void _d_callfinalizer(void* p)
299 { 299 {
300 std::string fname("_d_delmemory"); 300 std::string fname("_d_delmemory");
301 std::string fname2("_d_delinterface"); 301 std::string fname2("_d_delinterface");
302 std::string fname3("_d_callfinalizer"); 302 std::string fname3("_d_callfinalizer");
303 std::vector<const llvm::Type*> types; 303 std::vector<const LLType*> types;
304 types.push_back(voidPtrTy); 304 types.push_back(voidPtrTy);
305 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 305 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
306 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 306 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
307 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 307 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
308 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); 308 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M);
309 } 309 }
310 310
311 // void _d_delclass(Object p) 311 // void _d_delclass(Object p)
312 { 312 {
313 std::string fname("_d_delclass"); 313 std::string fname("_d_delclass");
314 std::vector<const llvm::Type*> types; 314 std::vector<const LLType*> types;
315 types.push_back(objectTy); 315 types.push_back(objectTy);
316 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 316 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
317 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 317 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
318 } 318 }
319 319
323 323
324 #define ARRAY_INIT(TY,suffix) \ 324 #define ARRAY_INIT(TY,suffix) \
325 { \ 325 { \
326 std::string fname("_d_array_init_"); \ 326 std::string fname("_d_array_init_"); \
327 fname.append(suffix); \ 327 fname.append(suffix); \
328 std::vector<const llvm::Type*> types; \ 328 std::vector<const LLType*> types; \
329 types.push_back(rt_ptr(TY)); \ 329 types.push_back(rt_ptr(TY)); \
330 types.push_back(sizeTy); \ 330 types.push_back(sizeTy); \
331 types.push_back(TY); \ 331 types.push_back(TY); \
332 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); \ 332 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); \
333 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ 333 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \
346 346
347 // array init mem 347 // array init mem
348 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) 348 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv)
349 { 349 {
350 std::string fname("_d_array_init_mem"); 350 std::string fname("_d_array_init_mem");
351 std::vector<const llvm::Type*> types; 351 std::vector<const LLType*> types;
352 types.push_back(voidPtrTy); 352 types.push_back(voidPtrTy);
353 types.push_back(sizeTy); 353 types.push_back(sizeTy);
354 types.push_back(voidPtrTy); 354 types.push_back(voidPtrTy);
355 types.push_back(sizeTy); 355 types.push_back(sizeTy);
356 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 356 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
363 363
364 #define STR_APPLY1(TY,a,b) \ 364 #define STR_APPLY1(TY,a,b) \
365 { \ 365 { \
366 std::string fname(a); \ 366 std::string fname(a); \
367 std::string fname2(b); \ 367 std::string fname2(b); \
368 std::vector<const llvm::Type*> types; \ 368 std::vector<const LLType*> types; \
369 types.push_back(TY); \ 369 types.push_back(TY); \
370 types.push_back(rt_dg1()); \ 370 types.push_back(rt_dg1()); \
371 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ 371 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
372 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ 372 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \
373 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ 373 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \
379 379
380 #define STR_APPLY2(TY,a,b) \ 380 #define STR_APPLY2(TY,a,b) \
381 { \ 381 { \
382 std::string fname(a); \ 382 std::string fname(a); \
383 std::string fname2(b); \ 383 std::string fname2(b); \
384 std::vector<const llvm::Type*> types; \ 384 std::vector<const LLType*> types; \
385 types.push_back(TY); \ 385 types.push_back(TY); \
386 types.push_back(rt_dg2()); \ 386 types.push_back(rt_dg2()); \
387 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ 387 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
388 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ 388 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \
389 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ 389 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \
395 395
396 #define STR_APPLY_R1(TY,a,b) \ 396 #define STR_APPLY_R1(TY,a,b) \
397 { \ 397 { \
398 std::string fname(a); \ 398 std::string fname(a); \
399 std::string fname2(b); \ 399 std::string fname2(b); \
400 std::vector<const llvm::Type*> types; \ 400 std::vector<const LLType*> types; \
401 types.push_back(TY); \ 401 types.push_back(TY); \
402 types.push_back(rt_dg1()); \ 402 types.push_back(rt_dg1()); \
403 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ 403 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
404 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ 404 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \
405 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ 405 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \
411 411
412 #define STR_APPLY_R2(TY,a,b) \ 412 #define STR_APPLY_R2(TY,a,b) \
413 { \ 413 { \
414 std::string fname(a); \ 414 std::string fname(a); \
415 std::string fname2(b); \ 415 std::string fname2(b); \
416 std::vector<const llvm::Type*> types; \ 416 std::vector<const LLType*> types; \
417 types.push_back(TY); \ 417 types.push_back(TY); \
418 types.push_back(rt_dg2()); \ 418 types.push_back(rt_dg2()); \
419 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ 419 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
420 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ 420 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \
421 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \ 421 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); \
431 431
432 // fixes the length for dynamic array casts 432 // fixes the length for dynamic array casts
433 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) 433 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz)
434 { 434 {
435 std::string fname("_d_array_cast_len"); 435 std::string fname("_d_array_cast_len");
436 std::vector<const llvm::Type*> types; 436 std::vector<const LLType*> types;
437 types.push_back(sizeTy); 437 types.push_back(sizeTy);
438 types.push_back(sizeTy); 438 types.push_back(sizeTy);
439 types.push_back(sizeTy); 439 types.push_back(sizeTy);
440 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); 440 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false);
441 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 441 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
447 447
448 // builds the d string[] for the D main args from the C main args 448 // builds the d string[] for the D main args from the C main args
449 // void _d_main_args(uint n, char** args, ref char[][] res) 449 // void _d_main_args(uint n, char** args, ref char[][] res)
450 { 450 {
451 std::string fname("_d_main_args"); 451 std::string fname("_d_main_args");
452 std::vector<const llvm::Type*> types; 452 std::vector<const LLType*> types;
453 types.push_back(intTy); 453 types.push_back(intTy);
454 types.push_back(rt_ptr(rt_ptr(byteTy))); 454 types.push_back(rt_ptr(rt_ptr(byteTy)));
455 types.push_back(rt_array(stringTy->getContainedType(0))); 455 types.push_back(rt_array(stringTy->getContainedType(0)));
456 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 456 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
457 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 457 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
463 463
464 // cast to object 464 // cast to object
465 // Object _d_toObject(void* p) 465 // Object _d_toObject(void* p)
466 { 466 {
467 std::string fname("_d_toObject"); 467 std::string fname("_d_toObject");
468 std::vector<const llvm::Type*> types; 468 std::vector<const LLType*> types;
469 types.push_back(voidPtrTy); 469 types.push_back(voidPtrTy);
470 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 470 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
471 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 471 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
472 } 472 }
473 473
474 // cast interface 474 // cast interface
475 // Object _d_interface_cast(void* p, ClassInfo c) 475 // Object _d_interface_cast(void* p, ClassInfo c)
476 { 476 {
477 std::string fname("_d_interface_cast"); 477 std::string fname("_d_interface_cast");
478 std::vector<const llvm::Type*> types; 478 std::vector<const LLType*> types;
479 types.push_back(voidPtrTy); 479 types.push_back(voidPtrTy);
480 types.push_back(classInfoTy); 480 types.push_back(classInfoTy);
481 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 481 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
482 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 482 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
483 } 483 }
484 484
485 // dynamic cast 485 // dynamic cast
486 // Object _d_dynamic_cast(Object o, ClassInfo c) 486 // Object _d_dynamic_cast(Object o, ClassInfo c)
487 { 487 {
488 std::string fname("_d_dynamic_cast"); 488 std::string fname("_d_dynamic_cast");
489 std::vector<const llvm::Type*> types; 489 std::vector<const LLType*> types;
490 types.push_back(objectTy); 490 types.push_back(objectTy);
491 types.push_back(classInfoTy); 491 types.push_back(classInfoTy);
492 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 492 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
493 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 493 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
494 } 494 }
500 // char[] _adReverseChar(char[] a) 500 // char[] _adReverseChar(char[] a)
501 // char[] _adSortChar(char[] a) 501 // char[] _adSortChar(char[] a)
502 { 502 {
503 std::string fname("_adReverseChar"); 503 std::string fname("_adReverseChar");
504 std::string fname2("_adSortChar"); 504 std::string fname2("_adSortChar");
505 std::vector<const llvm::Type*> types; 505 std::vector<const LLType*> types;
506 types.push_back(stringTy); 506 types.push_back(stringTy);
507 types.push_back(stringTy); 507 types.push_back(stringTy);
508 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 508 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
509 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 509 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
510 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 510 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
513 // wchar[] _adReverseWchar(wchar[] a) 513 // wchar[] _adReverseWchar(wchar[] a)
514 // wchar[] _adSortWchar(wchar[] a) 514 // wchar[] _adSortWchar(wchar[] a)
515 { 515 {
516 std::string fname("_adReverseWchar"); 516 std::string fname("_adReverseWchar");
517 std::string fname2("_adSortWchar"); 517 std::string fname2("_adSortWchar");
518 std::vector<const llvm::Type*> types; 518 std::vector<const LLType*> types;
519 types.push_back(wstringTy); 519 types.push_back(wstringTy);
520 types.push_back(wstringTy); 520 types.push_back(wstringTy);
521 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 521 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
522 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 522 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
523 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 523 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
524 } 524 }
525 525
526 // Array _adReverse(Array a, size_t szelem) 526 // Array _adReverse(Array a, size_t szelem)
527 { 527 {
528 std::string fname("_adReverse"); 528 std::string fname("_adReverse");
529 std::vector<const llvm::Type*> types; 529 std::vector<const LLType*> types;
530 types.push_back(rt_array(byteTy)); 530 types.push_back(rt_array(byteTy));
531 types.push_back(rt_array(byteTy)); 531 types.push_back(rt_array(byteTy));
532 types.push_back(sizeTy); 532 types.push_back(sizeTy);
533 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 533 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
534 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 534 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
535 } 535 }
536 536
537 // Array _adDupT(TypeInfo ti, Array a) 537 // Array _adDupT(TypeInfo ti, Array a)
538 { 538 {
539 std::string fname("_adDupT"); 539 std::string fname("_adDupT");
540 std::vector<const llvm::Type*> types; 540 std::vector<const LLType*> types;
541 types.push_back(rt_array(byteTy)); 541 types.push_back(rt_array(byteTy));
542 types.push_back(typeInfoTy); 542 types.push_back(typeInfoTy);
543 types.push_back(rt_array(byteTy)); 543 types.push_back(rt_array(byteTy));
544 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 544 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
545 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 545 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
548 // int _adEq(Array a1, Array a2, TypeInfo ti) 548 // int _adEq(Array a1, Array a2, TypeInfo ti)
549 // int _adCmp(Array a1, Array a2, TypeInfo ti) 549 // int _adCmp(Array a1, Array a2, TypeInfo ti)
550 { 550 {
551 std::string fname("_adEq"); 551 std::string fname("_adEq");
552 std::string fname2("_adCmp"); 552 std::string fname2("_adCmp");
553 std::vector<const llvm::Type*> types; 553 std::vector<const LLType*> types;
554 types.push_back(rt_array(byteTy)); 554 types.push_back(rt_array(byteTy));
555 types.push_back(rt_array(byteTy)); 555 types.push_back(rt_array(byteTy));
556 types.push_back(typeInfoTy); 556 types.push_back(typeInfoTy);
557 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 557 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
558 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 558 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
560 } 560 }
561 561
562 // int _adCmpChar(Array a1, Array a2) 562 // int _adCmpChar(Array a1, Array a2)
563 { 563 {
564 std::string fname("_adCmpChar"); 564 std::string fname("_adCmpChar");
565 std::vector<const llvm::Type*> types; 565 std::vector<const LLType*> types;
566 types.push_back(rt_array(byteTy)); 566 types.push_back(rt_array(byteTy));
567 types.push_back(rt_array(byteTy)); 567 types.push_back(rt_array(byteTy));
568 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 568 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
569 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 569 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
570 } 570 }
571 571
572 // Array _adSort(Array a, TypeInfo ti) 572 // Array _adSort(Array a, TypeInfo ti)
573 { 573 {
574 std::string fname("_adSort"); 574 std::string fname("_adSort");
575 std::vector<const llvm::Type*> types; 575 std::vector<const LLType*> types;
576 types.push_back(rt_array(byteTy)); 576 types.push_back(rt_array(byteTy));
577 types.push_back(rt_array(byteTy)); 577 types.push_back(rt_array(byteTy));
578 types.push_back(typeInfoTy); 578 types.push_back(typeInfoTy);
579 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 579 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
580 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 580 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
585 ///////////////////////////////////////////////////////////////////////////////////// 585 /////////////////////////////////////////////////////////////////////////////////////
586 586
587 // size_t _aaLen(AA aa) 587 // size_t _aaLen(AA aa)
588 { 588 {
589 std::string fname("_aaLen"); 589 std::string fname("_aaLen");
590 std::vector<const llvm::Type*> types; 590 std::vector<const LLType*> types;
591 types.push_back(aaTy); 591 types.push_back(aaTy);
592 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); 592 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false);
593 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 593 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
594 } 594 }
595 595
596 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) 596 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey)
597 { 597 {
598 std::string fname("_aaGet"); 598 std::string fname("_aaGet");
599 std::vector<const llvm::Type*> types; 599 std::vector<const LLType*> types;
600 types.push_back(aaTy); 600 types.push_back(aaTy);
601 types.push_back(typeInfoTy); 601 types.push_back(typeInfoTy);
602 types.push_back(sizeTy); 602 types.push_back(sizeTy);
603 types.push_back(voidPtrTy); 603 types.push_back(voidPtrTy);
604 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 604 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
606 } 606 }
607 607
608 // void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey) 608 // void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey)
609 { 609 {
610 std::string fname("_aaGetRvalue"); 610 std::string fname("_aaGetRvalue");
611 std::vector<const llvm::Type*> types; 611 std::vector<const LLType*> types;
612 types.push_back(aaTy); 612 types.push_back(aaTy);
613 types.push_back(typeInfoTy); 613 types.push_back(typeInfoTy);
614 types.push_back(sizeTy); 614 types.push_back(sizeTy);
615 types.push_back(voidPtrTy); 615 types.push_back(voidPtrTy);
616 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 616 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
618 } 618 }
619 619
620 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) 620 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey)
621 { 621 {
622 std::string fname("_aaIn"); 622 std::string fname("_aaIn");
623 std::vector<const llvm::Type*> types; 623 std::vector<const LLType*> types;
624 types.push_back(aaTy); 624 types.push_back(aaTy);
625 types.push_back(typeInfoTy); 625 types.push_back(typeInfoTy);
626 types.push_back(voidPtrTy); 626 types.push_back(voidPtrTy);
627 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 627 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
628 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 628 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
629 } 629 }
630 630
631 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) 631 // void _aaDel(AA aa, TypeInfo keyti, void* pkey)
632 { 632 {
633 std::string fname("_aaDel"); 633 std::string fname("_aaDel");
634 std::vector<const llvm::Type*> types; 634 std::vector<const LLType*> types;
635 types.push_back(aaTy); 635 types.push_back(aaTy);
636 types.push_back(typeInfoTy); 636 types.push_back(typeInfoTy);
637 types.push_back(voidPtrTy); 637 types.push_back(voidPtrTy);
638 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 638 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
639 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 639 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
640 } 640 }
641 641
642 // ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize) 642 // ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize)
643 { 643 {
644 std::string fname("_aaValues"); 644 std::string fname("_aaValues");
645 std::vector<const llvm::Type*> types; 645 std::vector<const LLType*> types;
646 types.push_back(rt_array(byteTy)); 646 types.push_back(rt_array(byteTy));
647 types.push_back(aaTy); 647 types.push_back(aaTy);
648 types.push_back(sizeTy); 648 types.push_back(sizeTy);
649 types.push_back(sizeTy); 649 types.push_back(sizeTy);
650 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 650 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
652 } 652 }
653 653
654 // void* _aaRehash(AA* paa, TypeInfo keyti) 654 // void* _aaRehash(AA* paa, TypeInfo keyti)
655 { 655 {
656 std::string fname("_aaRehash"); 656 std::string fname("_aaRehash");
657 std::vector<const llvm::Type*> types; 657 std::vector<const LLType*> types;
658 types.push_back(aaTy); 658 types.push_back(aaTy);
659 types.push_back(typeInfoTy); 659 types.push_back(typeInfoTy);
660 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 660 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
661 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 661 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
662 } 662 }
663 663
664 // ArrayRet_t _aaKeys(AA aa, size_t keysize) 664 // ArrayRet_t _aaKeys(AA aa, size_t keysize)
665 { 665 {
666 std::string fname("_aaKeys"); 666 std::string fname("_aaKeys");
667 std::vector<const llvm::Type*> types; 667 std::vector<const LLType*> types;
668 types.push_back(rt_array(byteTy)); 668 types.push_back(rt_array(byteTy));
669 types.push_back(aaTy); 669 types.push_back(aaTy);
670 types.push_back(sizeTy); 670 types.push_back(sizeTy);
671 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 671 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
672 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 672 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
673 } 673 }
674 674
675 // int _aaApply(AA aa, size_t keysize, dg_t dg) 675 // int _aaApply(AA aa, size_t keysize, dg_t dg)
676 { 676 {
677 std::string fname("_aaApply"); 677 std::string fname("_aaApply");
678 std::vector<const llvm::Type*> types; 678 std::vector<const LLType*> types;
679 types.push_back(aaTy); 679 types.push_back(aaTy);
680 types.push_back(sizeTy); 680 types.push_back(sizeTy);
681 types.push_back(rt_dg1()); 681 types.push_back(rt_dg1());
682 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 682 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
683 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 683 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
684 } 684 }
685 685
686 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) 686 // int _aaApply2(AA aa, size_t keysize, dg2_t dg)
687 { 687 {
688 std::string fname("_aaApply2"); 688 std::string fname("_aaApply2");
689 std::vector<const llvm::Type*> types; 689 std::vector<const LLType*> types;
690 types.push_back(aaTy); 690 types.push_back(aaTy);
691 types.push_back(sizeTy); 691 types.push_back(sizeTy);
692 types.push_back(rt_dg1()); 692 types.push_back(rt_dg1());
693 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 693 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
694 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 694 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
701 // void _moduleCtor() 701 // void _moduleCtor()
702 // void _moduleDtor() 702 // void _moduleDtor()
703 { 703 {
704 std::string fname("_moduleCtor"); 704 std::string fname("_moduleCtor");
705 std::string fname2("_moduleDtor"); 705 std::string fname2("_moduleDtor");
706 std::vector<const llvm::Type*> types; 706 std::vector<const LLType*> types;
707 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 707 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
708 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 708 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
709 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 709 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
710 } 710 }
711 711
714 ///////////////////////////////////////////////////////////////////////////////////// 714 /////////////////////////////////////////////////////////////////////////////////////
715 715
716 // Object _d_toObject(void* p) 716 // Object _d_toObject(void* p)
717 { 717 {
718 std::string fname("_d_toObject"); 718 std::string fname("_d_toObject");
719 std::vector<const llvm::Type*> types; 719 std::vector<const LLType*> types;
720 types.push_back(voidPtrTy); 720 types.push_back(voidPtrTy);
721 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 721 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
722 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 722 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
723 } 723 }
724 724
725 // Object _d_dynamic_cast(Object o, ClassInfo c) 725 // Object _d_dynamic_cast(Object o, ClassInfo c)
726 { 726 {
727 std::string fname("_d_dynamic_cast"); 727 std::string fname("_d_dynamic_cast");
728 std::vector<const llvm::Type*> types; 728 std::vector<const LLType*> types;
729 types.push_back(objectTy); 729 types.push_back(objectTy);
730 types.push_back(classInfoTy); 730 types.push_back(classInfoTy);
731 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 731 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
732 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 732 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
733 } 733 }
734 734
735 // Object _d_interface_cast(void* p, ClassInfo c) 735 // Object _d_interface_cast(void* p, ClassInfo c)
736 { 736 {
737 std::string fname("_d_interface_cast"); 737 std::string fname("_d_interface_cast");
738 std::vector<const llvm::Type*> types; 738 std::vector<const LLType*> types;
739 types.push_back(voidPtrTy); 739 types.push_back(voidPtrTy);
740 types.push_back(classInfoTy); 740 types.push_back(classInfoTy);
741 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); 741 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
742 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 742 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
743 } 743 }
747 ///////////////////////////////////////////////////////////////////////////////////// 747 /////////////////////////////////////////////////////////////////////////////////////
748 748
749 // void _d_throw_exception(Object e) 749 // void _d_throw_exception(Object e)
750 { 750 {
751 std::string fname("_d_throw_exception"); 751 std::string fname("_d_throw_exception");
752 std::vector<const llvm::Type*> types; 752 std::vector<const LLType*> types;
753 types.push_back(objectTy); 753 types.push_back(objectTy);
754 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 754 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
755 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 755 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
756 } 756 }
757 757
760 ///////////////////////////////////////////////////////////////////////////////////// 760 /////////////////////////////////////////////////////////////////////////////////////
761 761
762 // int _d_switch_string(char[][] table, char[] ca) 762 // int _d_switch_string(char[][] table, char[] ca)
763 { 763 {
764 std::string fname("_d_switch_string"); 764 std::string fname("_d_switch_string");
765 std::vector<const llvm::Type*> types; 765 std::vector<const LLType*> types;
766 types.push_back(rt_array(rt_array2(byteTy))); 766 types.push_back(rt_array(rt_array2(byteTy)));
767 types.push_back(stringTy); 767 types.push_back(stringTy);
768 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 768 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
769 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 769 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
770 } 770 }
771 771
772 // int _d_switch_ustring(wchar[][] table, wchar[] ca) 772 // int _d_switch_ustring(wchar[][] table, wchar[] ca)
773 { 773 {
774 std::string fname("_d_switch_ustring"); 774 std::string fname("_d_switch_ustring");
775 std::vector<const llvm::Type*> types; 775 std::vector<const LLType*> types;
776 types.push_back(rt_array(rt_array2(shortTy))); 776 types.push_back(rt_array(rt_array2(shortTy)));
777 types.push_back(wstringTy); 777 types.push_back(wstringTy);
778 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 778 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
779 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 779 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
780 } 780 }
781 781
782 // int _d_switch_dstring(dchar[][] table, dchar[] ca) 782 // int _d_switch_dstring(dchar[][] table, dchar[] ca)
783 { 783 {
784 std::string fname("_d_switch_dstring"); 784 std::string fname("_d_switch_dstring");
785 std::vector<const llvm::Type*> types; 785 std::vector<const LLType*> types;
786 types.push_back(rt_array(rt_array2(intTy))); 786 types.push_back(rt_array(rt_array2(intTy)));
787 types.push_back(dstringTy); 787 types.push_back(dstringTy);
788 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); 788 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
789 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 789 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
790 } 790 }