[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.
This commit is contained in:
Tomas Lindquist Olsen
2008-07-09 23:43:51 +02:00
parent 64ab226a4b
commit 2dfb2fcf19
10 changed files with 129 additions and 60 deletions

View File

@@ -6,6 +6,7 @@
#include "aggregate.h"
#include "declaration.h"
#include "init.h"
#include "module.h"
#include "gen/tollvm.h"
#include "gen/irstate.h"
@@ -724,3 +725,30 @@ const LLStructType* DtoMutexType()
gIR->module->addTypeName("D_CRITICAL_SECTION", pmutex);
return pmutex;
}
//////////////////////////////////////////////////////////////////////////////////////////
const LLStructType* DtoModuleReferenceType()
{
if (gIR->moduleRefType)
return gIR->moduleRefType;
// this is a recursive type so start out with the opaque
LLOpaqueType* opaque = LLOpaqueType::get();
// add members
std::vector<const LLType*> types;
types.push_back(getPtrToType(opaque));
types.push_back(DtoType(Module::moduleinfo->type));
// resolve type
const LLStructType* st = LLStructType::get(types);
LLPATypeHolder pa(st);
opaque->refineAbstractTypeTo(pa.get());
st = isaStruct(pa.get());
// done
gIR->moduleRefType = st;
gIR->module->addTypeName("ModuleReference", st);
return st;
}