Mercurial > projects > ldc
comparison gen/runtime.cpp @ 1572:30bdcfb8299e
Avoid some unecessary heap allocations by using llvm's StringRef class.
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Fri, 14 Aug 2009 01:43:30 +0200 |
parents | 8d086d552909 |
children | 5c0cebff9be8 |
comparison
equal
deleted
inserted
replaced
1571:8d086d552909 | 1572:30bdcfb8299e |
---|---|
233 | 233 |
234 // void _d_assert( char[] file, uint line ) | 234 // void _d_assert( char[] file, uint line ) |
235 // void _d_array_bounds( char[] file, uint line ) | 235 // void _d_array_bounds( char[] file, uint line ) |
236 // void _d_switch_error( char[] file, uint line ) | 236 // void _d_switch_error( char[] file, uint line ) |
237 { | 237 { |
238 std::string fname("_d_assert"); | 238 llvm::StringRef fname("_d_assert"); |
239 std::string fname2("_d_array_bounds"); | 239 llvm::StringRef fname2("_d_array_bounds"); |
240 std::string fname3("_d_switch_error"); | 240 llvm::StringRef fname3("_d_switch_error"); |
241 std::vector<const LLType*> types; | 241 std::vector<const LLType*> types; |
242 types.push_back(stringTy); | 242 types.push_back(stringTy); |
243 types.push_back(intTy); | 243 types.push_back(intTy); |
244 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 244 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
245 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 245 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
247 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); | 247 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); |
248 } | 248 } |
249 | 249 |
250 // void _d_assert_msg( char[] msg, char[] file, uint line ) | 250 // void _d_assert_msg( char[] msg, char[] file, uint line ) |
251 { | 251 { |
252 std::string fname("_d_assert_msg"); | 252 llvm::StringRef fname("_d_assert_msg"); |
253 std::vector<const LLType*> types; | 253 std::vector<const LLType*> types; |
254 types.push_back(stringTy); | 254 types.push_back(stringTy); |
255 types.push_back(stringTy); | 255 types.push_back(stringTy); |
256 types.push_back(intTy); | 256 types.push_back(intTy); |
257 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 257 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
262 ///////////////////////////////////////////////////////////////////////////////////// | 262 ///////////////////////////////////////////////////////////////////////////////////// |
263 ///////////////////////////////////////////////////////////////////////////////////// | 263 ///////////////////////////////////////////////////////////////////////////////////// |
264 | 264 |
265 // void* _d_allocmemoryT(TypeInfo ti) | 265 // void* _d_allocmemoryT(TypeInfo ti) |
266 { | 266 { |
267 std::string fname("_d_allocmemoryT"); | 267 llvm::StringRef fname("_d_allocmemoryT"); |
268 std::vector<const LLType*> types; | 268 std::vector<const LLType*> types; |
269 types.push_back(typeInfoTy); | 269 types.push_back(typeInfoTy); |
270 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 270 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
271 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 271 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
272 ->setAttributes(Attr_NoAlias); | 272 ->setAttributes(Attr_NoAlias); |
274 | 274 |
275 // void* _d_newarrayT(TypeInfo ti, size_t length) | 275 // void* _d_newarrayT(TypeInfo ti, size_t length) |
276 // void* _d_newarrayiT(TypeInfo ti, size_t length) | 276 // void* _d_newarrayiT(TypeInfo ti, size_t length) |
277 // void* _d_newarrayvT(TypeInfo ti, size_t length) | 277 // void* _d_newarrayvT(TypeInfo ti, size_t length) |
278 { | 278 { |
279 std::string fname("_d_newarrayT"); | 279 llvm::StringRef fname("_d_newarrayT"); |
280 std::string fname2("_d_newarrayiT"); | 280 llvm::StringRef fname2("_d_newarrayiT"); |
281 std::string fname3("_d_newarrayvT"); | 281 llvm::StringRef fname3("_d_newarrayvT"); |
282 std::vector<const LLType*> types; | 282 std::vector<const LLType*> types; |
283 types.push_back(typeInfoTy); | 283 types.push_back(typeInfoTy); |
284 types.push_back(sizeTy); | 284 types.push_back(sizeTy); |
285 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 285 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
286 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 286 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
293 | 293 |
294 // void* _d_newarraymT(TypeInfo ti, size_t length, size_t* dims) | 294 // void* _d_newarraymT(TypeInfo ti, size_t length, size_t* dims) |
295 // void* _d_newarraymiT(TypeInfo ti, size_t length, size_t* dims) | 295 // void* _d_newarraymiT(TypeInfo ti, size_t length, size_t* dims) |
296 // void* _d_newarraymvT(TypeInfo ti, size_t length, size_t* dims) | 296 // void* _d_newarraymvT(TypeInfo ti, size_t length, size_t* dims) |
297 { | 297 { |
298 std::string fname("_d_newarraymT"); | 298 llvm::StringRef fname("_d_newarraymT"); |
299 std::string fname2("_d_newarraymiT"); | 299 llvm::StringRef fname2("_d_newarraymiT"); |
300 std::string fname3("_d_newarraymvT"); | 300 llvm::StringRef fname3("_d_newarraymvT"); |
301 std::vector<const LLType*> types; | 301 std::vector<const LLType*> types; |
302 types.push_back(typeInfoTy); | 302 types.push_back(typeInfoTy); |
303 types.push_back(sizeTy); | 303 types.push_back(sizeTy); |
304 types.push_back(rt_ptr(sizeTy)); | 304 types.push_back(rt_ptr(sizeTy)); |
305 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 305 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
312 } | 312 } |
313 | 313 |
314 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) | 314 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) |
315 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) | 315 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) |
316 { | 316 { |
317 std::string fname("_d_arraysetlengthT"); | 317 llvm::StringRef fname("_d_arraysetlengthT"); |
318 std::string fname2("_d_arraysetlengthiT"); | 318 llvm::StringRef fname2("_d_arraysetlengthiT"); |
319 std::vector<const LLType*> types; | 319 std::vector<const LLType*> types; |
320 types.push_back(typeInfoTy); | 320 types.push_back(typeInfoTy); |
321 types.push_back(sizeTy); | 321 types.push_back(sizeTy); |
322 types.push_back(sizeTy); | 322 types.push_back(sizeTy); |
323 types.push_back(voidPtrTy); | 323 types.push_back(voidPtrTy); |
326 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | 326 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
327 } | 327 } |
328 | 328 |
329 // Object _d_allocclass(ClassInfo ci) | 329 // Object _d_allocclass(ClassInfo ci) |
330 { | 330 { |
331 std::string fname("_d_allocclass"); | 331 llvm::StringRef fname("_d_allocclass"); |
332 std::vector<const LLType*> types; | 332 std::vector<const LLType*> types; |
333 types.push_back(classInfoTy); | 333 types.push_back(classInfoTy); |
334 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 334 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
335 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 335 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
336 ->setAttributes(Attr_NoAlias); | 336 ->setAttributes(Attr_NoAlias); |
337 } | 337 } |
338 | 338 |
339 // void _d_delarray(size_t plength, void* pdata) | 339 // void _d_delarray(size_t plength, void* pdata) |
340 { | 340 { |
341 std::string fname("_d_delarray"); | 341 llvm::StringRef fname("_d_delarray"); |
342 std::vector<const LLType*> types; | 342 std::vector<const LLType*> types; |
343 types.push_back(sizeTy); | 343 types.push_back(sizeTy); |
344 types.push_back(voidPtrTy); | 344 types.push_back(voidPtrTy); |
345 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 345 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
346 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 346 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
348 | 348 |
349 // void _d_delmemory(void* p) | 349 // void _d_delmemory(void* p) |
350 // void _d_delinterface(void* p) | 350 // void _d_delinterface(void* p) |
351 // void _d_callfinalizer(void* p) | 351 // void _d_callfinalizer(void* p) |
352 { | 352 { |
353 std::string fname("_d_delmemory"); | 353 llvm::StringRef fname("_d_delmemory"); |
354 std::string fname2("_d_delinterface"); | 354 llvm::StringRef fname2("_d_delinterface"); |
355 std::string fname3("_d_callfinalizer"); | 355 llvm::StringRef fname3("_d_callfinalizer"); |
356 std::vector<const LLType*> types; | 356 std::vector<const LLType*> types; |
357 types.push_back(voidPtrTy); | 357 types.push_back(voidPtrTy); |
358 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 358 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
359 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 359 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
360 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | 360 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
361 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); | 361 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M); |
362 } | 362 } |
363 | 363 |
364 // void _d_delclass(Object p) | 364 // void _d_delclass(Object p) |
365 { | 365 { |
366 std::string fname("_d_delclass"); | 366 llvm::StringRef fname("_d_delclass"); |
367 std::vector<const LLType*> types; | 367 std::vector<const LLType*> types; |
368 types.push_back(objectTy); | 368 types.push_back(objectTy); |
369 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 369 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
370 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 370 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
371 } | 371 } |
374 ///////////////////////////////////////////////////////////////////////////////////// | 374 ///////////////////////////////////////////////////////////////////////////////////// |
375 ///////////////////////////////////////////////////////////////////////////////////// | 375 ///////////////////////////////////////////////////////////////////////////////////// |
376 | 376 |
377 #define ARRAY_INIT(TY,suffix) \ | 377 #define ARRAY_INIT(TY,suffix) \ |
378 { \ | 378 { \ |
379 std::string fname("_d_array_init_"); \ | 379 std::string fname = (llvm::StringRef("_d_array_init_") + llvm::StringRef(suffix)).str(); \ |
380 fname.append(suffix); \ | |
381 std::vector<const LLType*> types; \ | 380 std::vector<const LLType*> types; \ |
382 types.push_back(rt_ptr(TY)); \ | 381 types.push_back(rt_ptr(TY)); \ |
383 types.push_back(sizeTy); \ | 382 types.push_back(sizeTy); \ |
384 types.push_back(TY); \ | 383 types.push_back(TY); \ |
385 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); \ | 384 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); \ |
404 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) | 403 // void _d_array_init_mem(void* a, size_t na, void* v, size_t nv) |
405 // + | 404 // + |
406 // array slice copy when assertions are on! | 405 // array slice copy when assertions are on! |
407 // void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen) | 406 // void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen) |
408 { | 407 { |
409 std::string fname("_d_array_init_mem"); | 408 llvm::StringRef fname("_d_array_init_mem"); |
410 std::string fname2("_d_array_slice_copy"); | 409 llvm::StringRef fname2("_d_array_slice_copy"); |
411 std::vector<const LLType*> types; | 410 std::vector<const LLType*> types; |
412 types.push_back(voidPtrTy); | 411 types.push_back(voidPtrTy); |
413 types.push_back(sizeTy); | 412 types.push_back(sizeTy); |
414 types.push_back(voidPtrTy); | 413 types.push_back(voidPtrTy); |
415 types.push_back(sizeTy); | 414 types.push_back(sizeTy); |
425 ///////////////////////////////////////////////////////////////////////////////////// | 424 ///////////////////////////////////////////////////////////////////////////////////// |
426 | 425 |
427 // int _aApplycd1(char[] aa, dg_t dg) | 426 // int _aApplycd1(char[] aa, dg_t dg) |
428 #define STR_APPLY1(TY,a,b) \ | 427 #define STR_APPLY1(TY,a,b) \ |
429 { \ | 428 { \ |
430 std::string fname(a); \ | 429 llvm::StringRef fname(a); \ |
431 std::string fname2(b); \ | 430 llvm::StringRef fname2(b); \ |
432 std::vector<const LLType*> types; \ | 431 std::vector<const LLType*> types; \ |
433 types.push_back(TY); \ | 432 types.push_back(TY); \ |
434 types.push_back(rt_dg1()); \ | 433 types.push_back(rt_dg1()); \ |
435 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | 434 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ |
436 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ | 435 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
442 #undef STR_APPLY | 441 #undef STR_APPLY |
443 | 442 |
444 // int _aApplycd2(char[] aa, dg2_t dg) | 443 // int _aApplycd2(char[] aa, dg2_t dg) |
445 #define STR_APPLY2(TY,a,b) \ | 444 #define STR_APPLY2(TY,a,b) \ |
446 { \ | 445 { \ |
447 std::string fname(a); \ | 446 llvm::StringRef fname(a); \ |
448 std::string fname2(b); \ | 447 llvm::StringRef fname2(b); \ |
449 std::vector<const LLType*> types; \ | 448 std::vector<const LLType*> types; \ |
450 types.push_back(TY); \ | 449 types.push_back(TY); \ |
451 types.push_back(rt_dg2()); \ | 450 types.push_back(rt_dg2()); \ |
452 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | 451 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ |
453 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ | 452 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
458 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") | 457 STR_APPLY2(dstringTy, "_aApplydc2", "_aApplydw2") |
459 #undef STR_APPLY2 | 458 #undef STR_APPLY2 |
460 | 459 |
461 #define STR_APPLY_R1(TY,a,b) \ | 460 #define STR_APPLY_R1(TY,a,b) \ |
462 { \ | 461 { \ |
463 std::string fname(a); \ | 462 llvm::StringRef fname(a); \ |
464 std::string fname2(b); \ | 463 llvm::StringRef fname2(b); \ |
465 std::vector<const LLType*> types; \ | 464 std::vector<const LLType*> types; \ |
466 types.push_back(TY); \ | 465 types.push_back(TY); \ |
467 types.push_back(rt_dg1()); \ | 466 types.push_back(rt_dg1()); \ |
468 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | 467 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ |
469 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ | 468 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
474 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") | 473 STR_APPLY_R1(dstringTy, "_aApplyRdc1", "_aApplyRdw1") |
475 #undef STR_APPLY | 474 #undef STR_APPLY |
476 | 475 |
477 #define STR_APPLY_R2(TY,a,b) \ | 476 #define STR_APPLY_R2(TY,a,b) \ |
478 { \ | 477 { \ |
479 std::string fname(a); \ | 478 llvm::StringRef fname(a); \ |
480 std::string fname2(b); \ | 479 llvm::StringRef fname2(b); \ |
481 std::vector<const LLType*> types; \ | 480 std::vector<const LLType*> types; \ |
482 types.push_back(TY); \ | 481 types.push_back(TY); \ |
483 types.push_back(rt_dg2()); \ | 482 types.push_back(rt_dg2()); \ |
484 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ | 483 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ |
485 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ | 484 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); \ |
495 ///////////////////////////////////////////////////////////////////////////////////// | 494 ///////////////////////////////////////////////////////////////////////////////////// |
496 | 495 |
497 // fixes the length for dynamic array casts | 496 // fixes the length for dynamic array casts |
498 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) | 497 // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) |
499 { | 498 { |
500 std::string fname("_d_array_cast_len"); | 499 llvm::StringRef fname("_d_array_cast_len"); |
501 std::vector<const LLType*> types; | 500 std::vector<const LLType*> types; |
502 types.push_back(sizeTy); | 501 types.push_back(sizeTy); |
503 types.push_back(sizeTy); | 502 types.push_back(sizeTy); |
504 types.push_back(sizeTy); | 503 types.push_back(sizeTy); |
505 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); | 504 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); |
512 ///////////////////////////////////////////////////////////////////////////////////// | 511 ///////////////////////////////////////////////////////////////////////////////////// |
513 | 512 |
514 // cast to object | 513 // cast to object |
515 // Object _d_toObject(void* p) | 514 // Object _d_toObject(void* p) |
516 { | 515 { |
517 std::string fname("_d_toObject"); | 516 llvm::StringRef fname("_d_toObject"); |
518 std::vector<const LLType*> types; | 517 std::vector<const LLType*> types; |
519 types.push_back(voidPtrTy); | 518 types.push_back(voidPtrTy); |
520 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | 519 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
521 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 520 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
522 ->setAttributes(Attr_ReadOnly_NoUnwind); | 521 ->setAttributes(Attr_ReadOnly_NoUnwind); |
523 } | 522 } |
524 | 523 |
525 // cast interface | 524 // cast interface |
526 // Object _d_interface_cast(void* p, ClassInfo c) | 525 // Object _d_interface_cast(void* p, ClassInfo c) |
527 { | 526 { |
528 std::string fname("_d_interface_cast"); | 527 llvm::StringRef fname("_d_interface_cast"); |
529 std::vector<const LLType*> types; | 528 std::vector<const LLType*> types; |
530 types.push_back(voidPtrTy); | 529 types.push_back(voidPtrTy); |
531 types.push_back(classInfoTy); | 530 types.push_back(classInfoTy); |
532 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | 531 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
533 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 532 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
535 } | 534 } |
536 | 535 |
537 // dynamic cast | 536 // dynamic cast |
538 // Object _d_dynamic_cast(Object o, ClassInfo c) | 537 // Object _d_dynamic_cast(Object o, ClassInfo c) |
539 { | 538 { |
540 std::string fname("_d_dynamic_cast"); | 539 llvm::StringRef fname("_d_dynamic_cast"); |
541 std::vector<const LLType*> types; | 540 std::vector<const LLType*> types; |
542 types.push_back(objectTy); | 541 types.push_back(objectTy); |
543 types.push_back(classInfoTy); | 542 types.push_back(classInfoTy); |
544 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); | 543 const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
545 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 544 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
551 ///////////////////////////////////////////////////////////////////////////////////// | 550 ///////////////////////////////////////////////////////////////////////////////////// |
552 | 551 |
553 // char[] _adReverseChar(char[] a) | 552 // char[] _adReverseChar(char[] a) |
554 // char[] _adSortChar(char[] a) | 553 // char[] _adSortChar(char[] a) |
555 { | 554 { |
556 std::string fname("_adReverseChar"); | 555 llvm::StringRef fname("_adReverseChar"); |
557 std::string fname2("_adSortChar"); | 556 llvm::StringRef fname2("_adSortChar"); |
558 std::vector<const LLType*> types; | 557 std::vector<const LLType*> types; |
559 types.push_back(stringTy); | 558 types.push_back(stringTy); |
560 const llvm::FunctionType* fty = llvm::FunctionType::get(stringTy, types, false); | 559 const llvm::FunctionType* fty = llvm::FunctionType::get(stringTy, types, false); |
561 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 560 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
562 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | 561 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
563 } | 562 } |
564 | 563 |
565 // wchar[] _adReverseWchar(wchar[] a) | 564 // wchar[] _adReverseWchar(wchar[] a) |
566 // wchar[] _adSortWchar(wchar[] a) | 565 // wchar[] _adSortWchar(wchar[] a) |
567 { | 566 { |
568 std::string fname("_adReverseWchar"); | 567 llvm::StringRef fname("_adReverseWchar"); |
569 std::string fname2("_adSortWchar"); | 568 llvm::StringRef fname2("_adSortWchar"); |
570 std::vector<const LLType*> types; | 569 std::vector<const LLType*> types; |
571 types.push_back(wstringTy); | 570 types.push_back(wstringTy); |
572 const llvm::FunctionType* fty = llvm::FunctionType::get(wstringTy, types, false); | 571 const llvm::FunctionType* fty = llvm::FunctionType::get(wstringTy, types, false); |
573 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 572 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
574 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | 573 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
575 } | 574 } |
576 | 575 |
577 // void[] _adReverse(void[] a, size_t szelem) | 576 // void[] _adReverse(void[] a, size_t szelem) |
578 { | 577 { |
579 std::string fname("_adReverse"); | 578 llvm::StringRef fname("_adReverse"); |
580 std::vector<const LLType*> types; | 579 std::vector<const LLType*> types; |
581 types.push_back(rt_array(byteTy)); | 580 types.push_back(rt_array(byteTy)); |
582 types.push_back(sizeTy); | 581 types.push_back(sizeTy); |
583 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); | 582 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
584 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 583 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
585 ->setAttributes(Attr_NoUnwind); | 584 ->setAttributes(Attr_NoUnwind); |
586 } | 585 } |
587 | 586 |
588 // void[] _adDupT(TypeInfo ti, void[] a) | 587 // void[] _adDupT(TypeInfo ti, void[] a) |
589 { | 588 { |
590 std::string fname("_adDupT"); | 589 llvm::StringRef fname("_adDupT"); |
591 std::vector<const LLType*> types; | 590 std::vector<const LLType*> types; |
592 types.push_back(typeInfoTy); | 591 types.push_back(typeInfoTy); |
593 types.push_back(rt_array(byteTy)); | 592 types.push_back(rt_array(byteTy)); |
594 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); | 593 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
595 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 594 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
596 } | 595 } |
597 | 596 |
598 // int _adEq(void[] a1, void[] a2, TypeInfo ti) | 597 // int _adEq(void[] a1, void[] a2, TypeInfo ti) |
599 // int _adCmp(void[] a1, void[] a2, TypeInfo ti) | 598 // int _adCmp(void[] a1, void[] a2, TypeInfo ti) |
600 { | 599 { |
601 std::string fname("_adEq"); | 600 llvm::StringRef fname("_adEq"); |
602 std::string fname2("_adCmp"); | 601 llvm::StringRef fname2("_adCmp"); |
603 std::vector<const LLType*> types; | 602 std::vector<const LLType*> types; |
604 types.push_back(rt_array(byteTy)); | 603 types.push_back(rt_array(byteTy)); |
605 types.push_back(rt_array(byteTy)); | 604 types.push_back(rt_array(byteTy)); |
606 types.push_back(typeInfoTy); | 605 types.push_back(typeInfoTy); |
607 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 606 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
611 ->setAttributes(Attr_ReadOnly); | 610 ->setAttributes(Attr_ReadOnly); |
612 } | 611 } |
613 | 612 |
614 // int _adCmpChar(void[] a1, void[] a2) | 613 // int _adCmpChar(void[] a1, void[] a2) |
615 { | 614 { |
616 std::string fname("_adCmpChar"); | 615 llvm::StringRef fname("_adCmpChar"); |
617 std::vector<const LLType*> types; | 616 std::vector<const LLType*> types; |
618 types.push_back(rt_array(byteTy)); | 617 types.push_back(rt_array(byteTy)); |
619 types.push_back(rt_array(byteTy)); | 618 types.push_back(rt_array(byteTy)); |
620 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 619 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
621 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 620 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
622 ->setAttributes(Attr_ReadOnly_NoUnwind); | 621 ->setAttributes(Attr_ReadOnly_NoUnwind); |
623 } | 622 } |
624 | 623 |
625 // void[] _adSort(void[] a, TypeInfo ti) | 624 // void[] _adSort(void[] a, TypeInfo ti) |
626 { | 625 { |
627 std::string fname("_adSort"); | 626 llvm::StringRef fname("_adSort"); |
628 std::vector<const LLType*> types; | 627 std::vector<const LLType*> types; |
629 types.push_back(rt_array(byteTy)); | 628 types.push_back(rt_array(byteTy)); |
630 types.push_back(typeInfoTy); | 629 types.push_back(typeInfoTy); |
631 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); | 630 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
632 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 631 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
636 ///////////////////////////////////////////////////////////////////////////////////// | 635 ///////////////////////////////////////////////////////////////////////////////////// |
637 ///////////////////////////////////////////////////////////////////////////////////// | 636 ///////////////////////////////////////////////////////////////////////////////////// |
638 | 637 |
639 // size_t _aaLen(AA aa) | 638 // size_t _aaLen(AA aa) |
640 { | 639 { |
641 std::string fname("_aaLen"); | 640 llvm::StringRef fname("_aaLen"); |
642 std::vector<const LLType*> types; | 641 std::vector<const LLType*> types; |
643 types.push_back(aaTy); | 642 types.push_back(aaTy); |
644 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); | 643 const llvm::FunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); |
645 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 644 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
646 ->setAttributes(Attr_ReadOnly_NoUnwind_1_NoCapture); | 645 ->setAttributes(Attr_ReadOnly_NoUnwind_1_NoCapture); |
647 } | 646 } |
648 | 647 |
649 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) | 648 // void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) |
650 { | 649 { |
651 std::string fname("_aaGet"); | 650 llvm::StringRef fname("_aaGet"); |
652 std::vector<const LLType*> types; | 651 std::vector<const LLType*> types; |
653 types.push_back(aaTy); | 652 types.push_back(aaTy); |
654 types.push_back(typeInfoTy); | 653 types.push_back(typeInfoTy); |
655 types.push_back(sizeTy); | 654 types.push_back(sizeTy); |
656 types.push_back(voidPtrTy); | 655 types.push_back(voidPtrTy); |
659 ->setAttributes(Attr_1_4_NoCapture); | 658 ->setAttributes(Attr_1_4_NoCapture); |
660 } | 659 } |
661 | 660 |
662 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) | 661 // void* _aaIn(AA aa, TypeInfo keyti, void* pkey) |
663 { | 662 { |
664 std::string fname("_aaIn"); | 663 llvm::StringRef fname("_aaIn"); |
665 std::vector<const LLType*> types; | 664 std::vector<const LLType*> types; |
666 types.push_back(aaTy); | 665 types.push_back(aaTy); |
667 types.push_back(typeInfoTy); | 666 types.push_back(typeInfoTy); |
668 types.push_back(voidPtrTy); | 667 types.push_back(voidPtrTy); |
669 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 668 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
671 ->setAttributes(Attr_ReadOnly_1_3_NoCapture); | 670 ->setAttributes(Attr_ReadOnly_1_3_NoCapture); |
672 } | 671 } |
673 | 672 |
674 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) | 673 // void _aaDel(AA aa, TypeInfo keyti, void* pkey) |
675 { | 674 { |
676 std::string fname("_aaDel"); | 675 llvm::StringRef fname("_aaDel"); |
677 std::vector<const LLType*> types; | 676 std::vector<const LLType*> types; |
678 types.push_back(aaTy); | 677 types.push_back(aaTy); |
679 types.push_back(typeInfoTy); | 678 types.push_back(typeInfoTy); |
680 types.push_back(voidPtrTy); | 679 types.push_back(voidPtrTy); |
681 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 680 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
683 ->setAttributes(Attr_1_3_NoCapture); | 682 ->setAttributes(Attr_1_3_NoCapture); |
684 } | 683 } |
685 | 684 |
686 // void[] _aaValues(AA aa, size_t keysize, size_t valuesize) | 685 // void[] _aaValues(AA aa, size_t keysize, size_t valuesize) |
687 { | 686 { |
688 std::string fname("_aaValues"); | 687 llvm::StringRef fname("_aaValues"); |
689 std::vector<const LLType*> types; | 688 std::vector<const LLType*> types; |
690 types.push_back(aaTy); | 689 types.push_back(aaTy); |
691 types.push_back(sizeTy); | 690 types.push_back(sizeTy); |
692 types.push_back(sizeTy); | 691 types.push_back(sizeTy); |
693 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); | 692 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
695 ->setAttributes(Attr_NoAlias_1_NoCapture); | 694 ->setAttributes(Attr_NoAlias_1_NoCapture); |
696 } | 695 } |
697 | 696 |
698 // void* _aaRehash(AA* paa, TypeInfo keyti) | 697 // void* _aaRehash(AA* paa, TypeInfo keyti) |
699 { | 698 { |
700 std::string fname("_aaRehash"); | 699 llvm::StringRef fname("_aaRehash"); |
701 std::vector<const LLType*> types; | 700 std::vector<const LLType*> types; |
702 types.push_back(aaTy); | 701 types.push_back(aaTy); |
703 types.push_back(typeInfoTy); | 702 types.push_back(typeInfoTy); |
704 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); | 703 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
705 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 704 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
706 } | 705 } |
707 | 706 |
708 // void[] _aaKeys(AA aa, size_t keysize) | 707 // void[] _aaKeys(AA aa, size_t keysize) |
709 { | 708 { |
710 std::string fname("_aaKeys"); | 709 llvm::StringRef fname("_aaKeys"); |
711 std::vector<const LLType*> types; | 710 std::vector<const LLType*> types; |
712 types.push_back(aaTy); | 711 types.push_back(aaTy); |
713 types.push_back(sizeTy); | 712 types.push_back(sizeTy); |
714 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); | 713 const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); |
715 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 714 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
716 ->setAttributes(Attr_NoAlias_1_NoCapture); | 715 ->setAttributes(Attr_NoAlias_1_NoCapture); |
717 } | 716 } |
718 | 717 |
719 // int _aaApply(AA aa, size_t keysize, dg_t dg) | 718 // int _aaApply(AA aa, size_t keysize, dg_t dg) |
720 { | 719 { |
721 std::string fname("_aaApply"); | 720 llvm::StringRef fname("_aaApply"); |
722 std::vector<const LLType*> types; | 721 std::vector<const LLType*> types; |
723 types.push_back(aaTy); | 722 types.push_back(aaTy); |
724 types.push_back(sizeTy); | 723 types.push_back(sizeTy); |
725 types.push_back(rt_dg1()); | 724 types.push_back(rt_dg1()); |
726 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 725 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
728 ->setAttributes(Attr_1_NoCapture); | 727 ->setAttributes(Attr_1_NoCapture); |
729 } | 728 } |
730 | 729 |
731 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) | 730 // int _aaApply2(AA aa, size_t keysize, dg2_t dg) |
732 { | 731 { |
733 std::string fname("_aaApply2"); | 732 llvm::StringRef fname("_aaApply2"); |
734 std::vector<const LLType*> types; | 733 std::vector<const LLType*> types; |
735 types.push_back(aaTy); | 734 types.push_back(aaTy); |
736 types.push_back(sizeTy); | 735 types.push_back(sizeTy); |
737 types.push_back(rt_dg2()); | 736 types.push_back(rt_dg2()); |
738 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 737 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
740 ->setAttributes(Attr_1_NoCapture); | 739 ->setAttributes(Attr_1_NoCapture); |
741 } | 740 } |
742 | 741 |
743 // int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti) | 742 // int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti) |
744 { | 743 { |
745 std::string fname("_aaEq"); | 744 llvm::StringRef fname("_aaEq"); |
746 std::vector<const LLType*> types; | 745 std::vector<const LLType*> types; |
747 types.push_back(aaTy); | 746 types.push_back(aaTy); |
748 types.push_back(aaTy); | 747 types.push_back(aaTy); |
749 types.push_back(typeInfoTy); | 748 types.push_back(typeInfoTy); |
750 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 749 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
757 ///////////////////////////////////////////////////////////////////////////////////// | 756 ///////////////////////////////////////////////////////////////////////////////////// |
758 | 757 |
759 // void _moduleCtor() | 758 // void _moduleCtor() |
760 // void _moduleDtor() | 759 // void _moduleDtor() |
761 { | 760 { |
762 std::string fname("_moduleCtor"); | 761 llvm::StringRef fname("_moduleCtor"); |
763 std::string fname2("_moduleDtor"); | 762 llvm::StringRef fname2("_moduleDtor"); |
764 std::vector<const LLType*> types; | 763 std::vector<const LLType*> types; |
765 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 764 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
766 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 765 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
767 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | 766 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
768 } | 767 } |
771 ///////////////////////////////////////////////////////////////////////////////////// | 770 ///////////////////////////////////////////////////////////////////////////////////// |
772 ///////////////////////////////////////////////////////////////////////////////////// | 771 ///////////////////////////////////////////////////////////////////////////////////// |
773 | 772 |
774 // void _d_throw_exception(Object e) | 773 // void _d_throw_exception(Object e) |
775 { | 774 { |
776 std::string fname("_d_throw_exception"); | 775 llvm::StringRef fname("_d_throw_exception"); |
777 std::vector<const LLType*> types; | 776 std::vector<const LLType*> types; |
778 types.push_back(objectTy); | 777 types.push_back(objectTy); |
779 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 778 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
780 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 779 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
781 } | 780 } |
784 ///////////////////////////////////////////////////////////////////////////////////// | 783 ///////////////////////////////////////////////////////////////////////////////////// |
785 ///////////////////////////////////////////////////////////////////////////////////// | 784 ///////////////////////////////////////////////////////////////////////////////////// |
786 | 785 |
787 // int _d_switch_string(char[][] table, char[] ca) | 786 // int _d_switch_string(char[][] table, char[] ca) |
788 { | 787 { |
789 std::string fname("_d_switch_string"); | 788 llvm::StringRef fname("_d_switch_string"); |
790 std::vector<const LLType*> types; | 789 std::vector<const LLType*> types; |
791 types.push_back(rt_array(stringTy)); | 790 types.push_back(rt_array(stringTy)); |
792 types.push_back(stringTy); | 791 types.push_back(stringTy); |
793 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 792 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
794 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 793 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
795 ->setAttributes(Attr_ReadOnly); | 794 ->setAttributes(Attr_ReadOnly); |
796 } | 795 } |
797 | 796 |
798 // int _d_switch_ustring(wchar[][] table, wchar[] ca) | 797 // int _d_switch_ustring(wchar[][] table, wchar[] ca) |
799 { | 798 { |
800 std::string fname("_d_switch_ustring"); | 799 llvm::StringRef fname("_d_switch_ustring"); |
801 std::vector<const LLType*> types; | 800 std::vector<const LLType*> types; |
802 types.push_back(rt_array(wstringTy)); | 801 types.push_back(rt_array(wstringTy)); |
803 types.push_back(wstringTy); | 802 types.push_back(wstringTy); |
804 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 803 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
805 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 804 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
806 ->setAttributes(Attr_ReadOnly); | 805 ->setAttributes(Attr_ReadOnly); |
807 } | 806 } |
808 | 807 |
809 // int _d_switch_dstring(dchar[][] table, dchar[] ca) | 808 // int _d_switch_dstring(dchar[][] table, dchar[] ca) |
810 { | 809 { |
811 std::string fname("_d_switch_dstring"); | 810 llvm::StringRef fname("_d_switch_dstring"); |
812 std::vector<const LLType*> types; | 811 std::vector<const LLType*> types; |
813 types.push_back(rt_array(dstringTy)); | 812 types.push_back(rt_array(dstringTy)); |
814 types.push_back(dstringTy); | 813 types.push_back(dstringTy); |
815 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); | 814 const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); |
816 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 815 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
822 ///////////////////////////////////////////////////////////////////////////////////// | 821 ///////////////////////////////////////////////////////////////////////////////////// |
823 | 822 |
824 // void _d_criticalenter(D_CRITICAL_SECTION *dcs) | 823 // void _d_criticalenter(D_CRITICAL_SECTION *dcs) |
825 // void _d_criticalexit(D_CRITICAL_SECTION *dcs) | 824 // void _d_criticalexit(D_CRITICAL_SECTION *dcs) |
826 { | 825 { |
827 std::string fname("_d_criticalenter"); | 826 llvm::StringRef fname("_d_criticalenter"); |
828 std::string fname2("_d_criticalexit"); | 827 llvm::StringRef fname2("_d_criticalexit"); |
829 std::vector<const LLType*> types; | 828 std::vector<const LLType*> types; |
830 types.push_back(rt_ptr(DtoMutexType())); | 829 types.push_back(rt_ptr(DtoMutexType())); |
831 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 830 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
832 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 831 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
833 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); | 832 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); |
834 } | 833 } |
835 | 834 |
836 // void _d_monitorenter(Object h) | 835 // void _d_monitorenter(Object h) |
837 // void _d_monitorexit(Object h) | 836 // void _d_monitorexit(Object h) |
838 { | 837 { |
839 std::string fname("_d_monitorenter"); | 838 llvm::StringRef fname("_d_monitorenter"); |
840 std::string fname2("_d_monitorexit"); | 839 llvm::StringRef fname2("_d_monitorexit"); |
841 std::vector<const LLType*> types; | 840 std::vector<const LLType*> types; |
842 types.push_back(objectTy); | 841 types.push_back(objectTy); |
843 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 842 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
844 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) | 843 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
845 ->setAttributes(Attr_1_NoCapture); | 844 ->setAttributes(Attr_1_NoCapture); |
851 ///////////////////////////////////////////////////////////////////////////////////// | 850 ///////////////////////////////////////////////////////////////////////////////////// |
852 ///////////////////////////////////////////////////////////////////////////////////// | 851 ///////////////////////////////////////////////////////////////////////////////////// |
853 | 852 |
854 // int _d_eh_personality(int ver, int actions, ulong eh_class, ptr eh_info, ptr context) | 853 // int _d_eh_personality(int ver, int actions, ulong eh_class, ptr eh_info, ptr context) |
855 { | 854 { |
856 std::string fname("_d_eh_personality"); | 855 llvm::StringRef fname("_d_eh_personality"); |
857 std::vector<const LLType*> types; | 856 std::vector<const LLType*> types; |
858 types.push_back(intTy); | 857 types.push_back(intTy); |
859 types.push_back(intTy); | 858 types.push_back(intTy); |
860 types.push_back(longTy); | 859 types.push_back(longTy); |
861 types.push_back(voidPtrTy); | 860 types.push_back(voidPtrTy); |
864 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 863 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
865 } | 864 } |
866 | 865 |
867 // void _d_eh_resume_unwind(ptr exc_struct) | 866 // void _d_eh_resume_unwind(ptr exc_struct) |
868 { | 867 { |
869 std::string fname("_d_eh_resume_unwind"); | 868 llvm::StringRef fname("_d_eh_resume_unwind"); |
870 std::vector<const LLType*> types; | 869 std::vector<const LLType*> types; |
871 types.push_back(voidPtrTy); | 870 types.push_back(voidPtrTy); |
872 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 871 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
873 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 872 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
874 } | 873 } |
877 ///////////////////////////////////////////////////////////////////////////////////// | 876 ///////////////////////////////////////////////////////////////////////////////////// |
878 ///////////////////////////////////////////////////////////////////////////////////// | 877 ///////////////////////////////////////////////////////////////////////////////////// |
879 | 878 |
880 // void _d_invariant(Object o) | 879 // void _d_invariant(Object o) |
881 { | 880 { |
882 std::string fname("_d_invariant"); | 881 llvm::StringRef fname("_d_invariant"); |
883 std::vector<const LLType*> types; | 882 std::vector<const LLType*> types; |
884 types.push_back(objectTy); | 883 types.push_back(objectTy); |
885 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); | 884 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); |
886 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); | 885 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); |
887 } | 886 } |