Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 309:d59c363fccad trunk
[svn r330] Implemented synchronized statements.
Changed the tryfinally handlers to a more generalized EnclosingHandler.
Changed ClassInfoS to be mutable so they can be used as locks.
Added new BB after throw ala return/break etc.
author | lindquist |
---|---|
date | Sat, 28 Jun 2008 11:37:53 +0200 |
parents | 6b62e8cdf970 |
children | a9697749e898 |
comparison
equal
deleted
inserted
replaced
308:6b62e8cdf970 | 309:d59c363fccad |
---|---|
635 return gTargetData->getTypeStoreSize(t); | 635 return gTargetData->getTypeStoreSize(t); |
636 } | 636 } |
637 | 637 |
638 size_t getABITypeSize(const LLType* t) | 638 size_t getABITypeSize(const LLType* t) |
639 { | 639 { |
640 Logger::cout() << "getting abi type of: " << *t << '\n'; | |
640 return gTargetData->getABITypeSize(t); | 641 return gTargetData->getABITypeSize(t); |
641 } | 642 } |
642 | 643 |
643 unsigned char getABITypeAlign(const LLType* t) | 644 unsigned char getABITypeAlign(const LLType* t) |
644 { | 645 { |
675 gIR->interfaceInfoType = LLStructType::get(types); | 676 gIR->interfaceInfoType = LLStructType::get(types); |
676 | 677 |
677 return gIR->interfaceInfoType; | 678 return gIR->interfaceInfoType; |
678 } | 679 } |
679 | 680 |
680 | 681 ////////////////////////////////////////////////////////////////////////////////////////// |
681 | 682 |
682 | 683 const LLStructType* DtoMutexType() |
683 | 684 { |
684 | 685 if (gIR->mutexType) |
685 | 686 return gIR->mutexType; |
686 | 687 |
687 | 688 // win32 |
688 | 689 if (global.params.isWindows) |
690 { | |
691 // CRITICAL_SECTION.sizeof == 68 | |
692 std::vector<const LLType*> types(17, LLType::Int32Ty); | |
693 return LLStructType::get(types); | |
694 } | |
695 | |
696 // pthread_fastlock | |
697 std::vector<const LLType*> types2; | |
698 types2.push_back(DtoSize_t()); | |
699 types2.push_back(LLType::Int32Ty); | |
700 const LLStructType* fastlock = LLStructType::get(types2); | |
701 | |
702 // pthread_mutex | |
703 std::vector<const LLType*> types1; | |
704 types1.push_back(LLType::Int32Ty); | |
705 types1.push_back(LLType::Int32Ty); | |
706 types1.push_back(getVoidPtrType()); | |
707 types1.push_back(LLType::Int32Ty); | |
708 types1.push_back(fastlock); | |
709 const LLStructType* pmutex = LLStructType::get(types1); | |
710 | |
711 // D_CRITICAL_SECTION | |
712 LLOpaqueType* opaque = LLOpaqueType::get(); | |
713 std::vector<const LLType*> types; | |
714 types.push_back(getPtrToType(opaque)); | |
715 types.push_back(pmutex); | |
716 | |
717 // resolve type | |
718 pmutex = LLStructType::get(types); | |
719 LLPATypeHolder pa(pmutex); | |
720 opaque->refineAbstractTypeTo(pa.get()); | |
721 pmutex = isaStruct(pa.get()); | |
722 | |
723 gIR->mutexType = pmutex; | |
724 gIR->module->addTypeName("D_CRITICAL_SECTION", pmutex); | |
725 return pmutex; | |
726 } |