comparison gen/tollvm.cpp @ 323:0d52412d5b1a trunk

[svn r344] Fixed some very minor issues with the usage listing when calling llvmdc with no arguments. Changed the way moduleinfo is registered to use the same approach as DMD, this eliminates the need for correct linking order and should make the way for using a natively compiled runtime library. This should speed up linking tremendously and should now be possible. Fixed the llvm.used array to only be emitted if really necessary.
author lindquist
date Wed, 09 Jul 2008 23:43:51 +0200
parents 1a2777460bd5
children 7086a84ab3d6
comparison
equal deleted inserted replaced
322:1aaf6ff7f685 323:0d52412d5b1a
4 4
5 #include "dsymbol.h" 5 #include "dsymbol.h"
6 #include "aggregate.h" 6 #include "aggregate.h"
7 #include "declaration.h" 7 #include "declaration.h"
8 #include "init.h" 8 #include "init.h"
9 #include "module.h"
9 10
10 #include "gen/tollvm.h" 11 #include "gen/tollvm.h"
11 #include "gen/irstate.h" 12 #include "gen/irstate.h"
12 #include "gen/logger.h" 13 #include "gen/logger.h"
13 #include "gen/runtime.h" 14 #include "gen/runtime.h"
722 723
723 gIR->mutexType = pmutex; 724 gIR->mutexType = pmutex;
724 gIR->module->addTypeName("D_CRITICAL_SECTION", pmutex); 725 gIR->module->addTypeName("D_CRITICAL_SECTION", pmutex);
725 return pmutex; 726 return pmutex;
726 } 727 }
728
729 //////////////////////////////////////////////////////////////////////////////////////////
730
731 const LLStructType* DtoModuleReferenceType()
732 {
733 if (gIR->moduleRefType)
734 return gIR->moduleRefType;
735
736 // this is a recursive type so start out with the opaque
737 LLOpaqueType* opaque = LLOpaqueType::get();
738
739 // add members
740 std::vector<const LLType*> types;
741 types.push_back(getPtrToType(opaque));
742 types.push_back(DtoType(Module::moduleinfo->type));
743
744 // resolve type
745 const LLStructType* st = LLStructType::get(types);
746 LLPATypeHolder pa(st);
747 opaque->refineAbstractTypeTo(pa.get());
748 st = isaStruct(pa.get());
749
750 // done
751 gIR->moduleRefType = st;
752 gIR->module->addTypeName("ModuleReference", st);
753 return st;
754 }