Merge branch 'master' into merge-2.061-2

Conflicts:
	gen/runtime.cpp
This commit is contained in:
kai 2013-01-27 00:20:21 +01:00
commit a3fcdafd1f
2 changed files with 112 additions and 120 deletions

View file

@ -311,7 +311,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_assert( char[] file, uint line ) // void _d_assert( char[] file, uint line )
{ {
llvm::StringRef fname("_d_assert"); llvm::StringRef fname("_d_assert");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(stringTy); types.push_back(stringTy);
types.push_back(intTy); types.push_back(intTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
@ -327,7 +327,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_array_bounds"); llvm::StringRef fname("_d_array_bounds");
llvm::StringRef fname2("_d_switch_error"); llvm::StringRef fname2("_d_switch_error");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
#if DMDV2 #if DMDV2
types.push_back(getPtrToType(DtoType(Module::moduleinfo->type))); types.push_back(getPtrToType(DtoType(Module::moduleinfo->type)));
#else #else
@ -342,7 +342,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_assert_msg( char[] msg, char[] file, uint line ) // void _d_assert_msg( char[] msg, char[] file, uint line )
{ {
llvm::StringRef fname("_d_assert_msg"); llvm::StringRef fname("_d_assert_msg");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(stringTy); types.push_back(stringTy);
types.push_back(stringTy); types.push_back(stringTy);
types.push_back(intTy); types.push_back(intTy);
@ -358,7 +358,7 @@ static void LLVM_D_BuildRuntimeModule()
// void* _d_allocmemory(size_t sz) // void* _d_allocmemory(size_t sz)
{ {
llvm::StringRef fname("_d_allocmemory"); llvm::StringRef fname("_d_allocmemory");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(sizeTy); types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -368,7 +368,7 @@ static void LLVM_D_BuildRuntimeModule()
// void* _d_allocmemoryT(TypeInfo ti) // void* _d_allocmemoryT(TypeInfo ti)
{ {
llvm::StringRef fname("_d_allocmemoryT"); llvm::StringRef fname("_d_allocmemoryT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -382,7 +382,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_d_newarrayT"); llvm::StringRef fname("_d_newarrayT");
llvm::StringRef fname2("_d_newarrayiT"); llvm::StringRef fname2("_d_newarrayiT");
llvm::StringRef fname3("_d_newarrayvT"); llvm::StringRef fname3("_d_newarrayvT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(sizeTy); types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
@ -400,7 +400,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_d_newarraymT"); llvm::StringRef fname("_d_newarraymT");
llvm::StringRef fname2("_d_newarraymiT"); llvm::StringRef fname2("_d_newarraymiT");
llvm::StringRef fname3("_d_newarraymvT"); llvm::StringRef fname3("_d_newarraymvT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(rt_ptr(sizeTy)); types.push_back(rt_ptr(sizeTy));
@ -418,7 +418,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_newarrayT"); llvm::StringRef fname("_d_newarrayT");
llvm::StringRef fname2("_d_newarrayiT"); llvm::StringRef fname2("_d_newarrayiT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(sizeTy); types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false);
@ -430,7 +430,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_newarraymT"); llvm::StringRef fname("_d_newarraymT");
llvm::StringRef fname2("_d_newarraymiT"); llvm::StringRef fname2("_d_newarraymiT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(sizeTy); types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, true); LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, true);
@ -448,7 +448,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_arraysetlengthT"); llvm::StringRef fname("_d_arraysetlengthT");
llvm::StringRef fname2("_d_arraysetlengthiT"); llvm::StringRef fname2("_d_arraysetlengthiT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 4> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(sizeTy); types.push_back(sizeTy);
#if DMDV2 #if DMDV2
@ -467,7 +467,7 @@ static void LLVM_D_BuildRuntimeModule()
// byte[] _d_arrayappendcTX(TypeInfo ti, ref byte[] px, size_t n) // byte[] _d_arrayappendcTX(TypeInfo ti, ref byte[] px, size_t n)
{ {
llvm::StringRef fname("_d_arrayappendcTX"); llvm::StringRef fname("_d_arrayappendcTX");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidArrayPtrTy); types.push_back(voidArrayPtrTy);
types.push_back(sizeTy); types.push_back(sizeTy);
@ -477,7 +477,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _d_arrayappendT(TypeInfo ti, byte[]* px, byte[] y) // void[] _d_arrayappendT(TypeInfo ti, byte[]* px, byte[] y)
{ {
llvm::StringRef fname("_d_arrayappendT"); llvm::StringRef fname("_d_arrayappendT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidArrayPtrTy); types.push_back(voidArrayPtrTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
@ -487,7 +487,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _d_arrayappendcd(ref char[] x, dchar c) // void[] _d_arrayappendcd(ref char[] x, dchar c)
{ {
llvm::StringRef fname("_d_arrayappendcd"); llvm::StringRef fname("_d_arrayappendcd");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(getPtrToType(stringTy)); types.push_back(getPtrToType(stringTy));
types.push_back(intTy); types.push_back(intTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false);
@ -496,7 +496,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _d_arrayappendwd(ref wchar[] x, dchar c) // void[] _d_arrayappendwd(ref wchar[] x, dchar c)
{ {
llvm::StringRef fname("_d_arrayappendwd"); llvm::StringRef fname("_d_arrayappendwd");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(getPtrToType(wstringTy)); types.push_back(getPtrToType(wstringTy));
types.push_back(intTy); types.push_back(intTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false);
@ -505,7 +505,7 @@ static void LLVM_D_BuildRuntimeModule()
// byte[] _d_arraycatT(TypeInfo ti, byte[] x, byte[] y) // byte[] _d_arraycatT(TypeInfo ti, byte[] x, byte[] y)
{ {
llvm::StringRef fname("_d_arraycatT"); llvm::StringRef fname("_d_arraycatT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
@ -515,7 +515,7 @@ static void LLVM_D_BuildRuntimeModule()
// byte[] _d_arraycatnT(TypeInfo ti, uint n, ...) // byte[] _d_arraycatnT(TypeInfo ti, uint n, ...)
{ {
llvm::StringRef fname("_d_arraycatnT"); llvm::StringRef fname("_d_arraycatnT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, true); LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, true);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -524,7 +524,7 @@ static void LLVM_D_BuildRuntimeModule()
// byte[] _d_arrayappendcT(TypeInfo ti, void* array, void* element) // byte[] _d_arrayappendcT(TypeInfo ti, void* array, void* element)
{ {
llvm::StringRef fname("_d_arrayappendcT"); llvm::StringRef fname("_d_arrayappendcT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
@ -536,7 +536,7 @@ static void LLVM_D_BuildRuntimeModule()
// Object _d_allocclass(ClassInfo ci) // Object _d_allocclass(ClassInfo ci)
{ {
llvm::StringRef fname(_d_allocclass); llvm::StringRef fname(_d_allocclass);
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(classInfoTy); types.push_back(classInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -548,7 +548,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_delarray_t(Array *p, TypeInfo ti) // void _d_delarray_t(Array *p, TypeInfo ti)
{ {
llvm::StringRef fname("_d_delarray_t"); llvm::StringRef fname("_d_delarray_t");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(voidArrayPtrTy); types.push_back(voidArrayPtrTy);
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
@ -560,7 +560,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_delarray(size_t plength, void* pdata) // void _d_delarray(size_t plength, void* pdata)
{ {
llvm::StringRef fname("_d_delarray"); llvm::StringRef fname("_d_delarray");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
@ -581,7 +581,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_d_delmemory"); llvm::StringRef fname("_d_delmemory");
llvm::StringRef fname2("_d_delinterface"); llvm::StringRef fname2("_d_delinterface");
llvm::StringRef fname3("_d_callfinalizer"); llvm::StringRef fname3("_d_callfinalizer");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -593,7 +593,7 @@ static void LLVM_D_BuildRuntimeModule()
// D2: void _d_delclass(Object* p) // D2: void _d_delclass(Object* p)
{ {
llvm::StringRef fname("_d_delclass"); llvm::StringRef fname("_d_delclass");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
#if DMDV2 #if DMDV2
types.push_back(rt_ptr(objectTy)); types.push_back(rt_ptr(objectTy));
#else #else
@ -611,7 +611,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen) // void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen)
{ {
llvm::StringRef fname("_d_array_slice_copy"); llvm::StringRef fname("_d_array_slice_copy");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 4> types;
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
@ -630,7 +630,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \ { \
llvm::StringRef fname(a); \ llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \ llvm::StringRef fname2(b); \
std::vector<LLType*> types; \ llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \ types.push_back(TY); \
types.push_back(rt_dg1()); \ types.push_back(rt_dg1()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -647,7 +647,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \ { \
llvm::StringRef fname(a); \ llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \ llvm::StringRef fname2(b); \
std::vector<LLType*> types; \ llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \ types.push_back(TY); \
types.push_back(rt_dg2()); \ types.push_back(rt_dg2()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -663,7 +663,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \ { \
llvm::StringRef fname(a); \ llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \ llvm::StringRef fname2(b); \
std::vector<LLType*> types; \ llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \ types.push_back(TY); \
types.push_back(rt_dg1()); \ types.push_back(rt_dg1()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -679,7 +679,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \ { \
llvm::StringRef fname(a); \ llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \ llvm::StringRef fname2(b); \
std::vector<LLType*> types; \ llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \ types.push_back(TY); \
types.push_back(rt_dg2()); \ types.push_back(rt_dg2()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \ LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -699,7 +699,7 @@ static void LLVM_D_BuildRuntimeModule()
// size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz) // size_t _d_array_cast_len(size_t len, size_t elemsz, size_t newelemsz)
{ {
llvm::StringRef fname("_d_array_cast_len"); llvm::StringRef fname("_d_array_cast_len");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(sizeTy); types.push_back(sizeTy);
@ -719,7 +719,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_arrayassign"); llvm::StringRef fname("_d_arrayassign");
llvm::StringRef fname2("_d_arrayctor"); llvm::StringRef fname2("_d_arrayctor");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
@ -733,7 +733,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_arraysetassign"); llvm::StringRef fname("_d_arraysetassign");
llvm::StringRef fname2("_d_arraysetctor"); llvm::StringRef fname2("_d_arraysetctor");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 4> types;
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
types.push_back(sizeTy); types.push_back(sizeTy);
@ -755,7 +755,7 @@ static void LLVM_D_BuildRuntimeModule()
// Object _d_toObject(void* p) // Object _d_toObject(void* p)
{ {
llvm::StringRef fname("_d_toObject"); llvm::StringRef fname("_d_toObject");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -766,7 +766,7 @@ static void LLVM_D_BuildRuntimeModule()
// Object _d_interface_cast(void* p, ClassInfo c) // Object _d_interface_cast(void* p, ClassInfo c)
{ {
llvm::StringRef fname("_d_interface_cast"); llvm::StringRef fname("_d_interface_cast");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
types.push_back(classInfoTy); types.push_back(classInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
@ -778,7 +778,7 @@ static void LLVM_D_BuildRuntimeModule()
// Object _d_dynamic_cast(Object o, ClassInfo c) // Object _d_dynamic_cast(Object o, ClassInfo c)
{ {
llvm::StringRef fname("_d_dynamic_cast"); llvm::StringRef fname("_d_dynamic_cast");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(objectTy); types.push_back(objectTy);
types.push_back(classInfoTy); types.push_back(classInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
@ -795,7 +795,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_adReverseChar"); llvm::StringRef fname("_adReverseChar");
llvm::StringRef fname2("_adSortChar"); llvm::StringRef fname2("_adSortChar");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(stringTy); types.push_back(stringTy);
LLFunctionType* fty = llvm::FunctionType::get(stringTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(stringTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -807,7 +807,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_adReverseWchar"); llvm::StringRef fname("_adReverseWchar");
llvm::StringRef fname2("_adSortWchar"); llvm::StringRef fname2("_adSortWchar");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(wstringTy); types.push_back(wstringTy);
LLFunctionType* fty = llvm::FunctionType::get(wstringTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(wstringTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -817,7 +817,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _adReverse(void[] a, size_t szelem) // void[] _adReverse(void[] a, size_t szelem)
{ {
llvm::StringRef fname("_adReverse"); llvm::StringRef fname("_adReverse");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
types.push_back(sizeTy); types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
@ -828,7 +828,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _adDupT(TypeInfo ti, void[] a) // void[] _adDupT(TypeInfo ti, void[] a)
{ {
llvm::StringRef fname("_adDupT"); llvm::StringRef fname("_adDupT");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
@ -840,7 +840,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname(_adEq); llvm::StringRef fname(_adEq);
llvm::StringRef fname2(_adCmp); llvm::StringRef fname2(_adCmp);
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
@ -854,7 +854,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _adCmpChar(void[] a1, void[] a2) // int _adCmpChar(void[] a1, void[] a2)
{ {
llvm::StringRef fname("_adCmpChar"); llvm::StringRef fname("_adCmpChar");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false);
@ -865,7 +865,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _adSort(void[] a, TypeInfo ti) // void[] _adSort(void[] a, TypeInfo ti)
{ {
llvm::StringRef fname("_adSort"); llvm::StringRef fname("_adSort");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(byteTy)); types.push_back(rt_array(byteTy));
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
@ -879,7 +879,7 @@ static void LLVM_D_BuildRuntimeModule()
// size_t _aaLen(AA aa) // size_t _aaLen(AA aa)
{ {
llvm::StringRef fname("_aaLen"); llvm::StringRef fname("_aaLen");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(aaTy); types.push_back(aaTy);
LLFunctionType* fty = llvm::FunctionType::get(sizeTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(sizeTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -896,7 +896,7 @@ static void LLVM_D_BuildRuntimeModule()
#else #else
llvm::StringRef fname("_aaGet"); llvm::StringRef fname("_aaGet");
#endif #endif
std::vector<LLType*> types; llvm::SmallVector<LLType*, 4> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(sizeTy); types.push_back(sizeTy);
@ -916,7 +916,7 @@ static void LLVM_D_BuildRuntimeModule()
#else #else
llvm::StringRef fname("_aaIn"); llvm::StringRef fname("_aaIn");
#endif #endif
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
@ -937,7 +937,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_aaDel"); llvm::StringRef fname("_aaDel");
LLType *retType = voidTy; LLType *retType = voidTy;
#endif #endif
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
@ -949,7 +949,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _aaValues(AA aa, size_t keysize, size_t valuesize) // void[] _aaValues(AA aa, size_t keysize, size_t valuesize)
{ {
llvm::StringRef fname("_aaValues"); llvm::StringRef fname("_aaValues");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(sizeTy); types.push_back(sizeTy);
@ -961,7 +961,7 @@ static void LLVM_D_BuildRuntimeModule()
// void* _aaRehash(AA* paa, TypeInfo keyti) // void* _aaRehash(AA* paa, TypeInfo keyti)
{ {
llvm::StringRef fname("_aaRehash"); llvm::StringRef fname("_aaRehash");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
@ -971,7 +971,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _aaKeys(AA aa, size_t keysize) // void[] _aaKeys(AA aa, size_t keysize)
{ {
llvm::StringRef fname("_aaKeys"); llvm::StringRef fname("_aaKeys");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(sizeTy); types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false); LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
@ -982,7 +982,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _aaApply(AA aa, size_t keysize, dg_t dg) // int _aaApply(AA aa, size_t keysize, dg_t dg)
{ {
llvm::StringRef fname("_aaApply"); llvm::StringRef fname("_aaApply");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(rt_dg1()); types.push_back(rt_dg1());
@ -994,7 +994,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _aaApply2(AA aa, size_t keysize, dg2_t dg) // int _aaApply2(AA aa, size_t keysize, dg2_t dg)
{ {
llvm::StringRef fname("_aaApply2"); llvm::StringRef fname("_aaApply2");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(rt_dg2()); types.push_back(rt_dg2());
@ -1007,7 +1007,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _aaEqual(TypeInfo_AssociativeArray ti, AA e1, AA e2) // int _aaEqual(TypeInfo_AssociativeArray ti, AA e1, AA e2)
{ {
llvm::StringRef fname("_aaEqual"); llvm::StringRef fname("_aaEqual");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(aaTy); types.push_back(aaTy);
@ -1018,7 +1018,7 @@ static void LLVM_D_BuildRuntimeModule()
// BB* _d_assocarrayliteralTX(TypeInfo_AssociativeArray ti, void[] keys, void[] values) // BB* _d_assocarrayliteralTX(TypeInfo_AssociativeArray ti, void[] keys, void[] values)
{ {
llvm::StringRef fname("_d_assocarrayliteralTX"); llvm::StringRef fname("_d_assocarrayliteralTX");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTypeInfoTy); types.push_back(aaTypeInfoTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
types.push_back(voidArrayTy); types.push_back(voidArrayTy);
@ -1029,7 +1029,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti) // int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti)
{ {
llvm::StringRef fname("_aaEq"); llvm::StringRef fname("_aaEq");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(aaTy); types.push_back(aaTy);
types.push_back(typeInfoTy); types.push_back(typeInfoTy);
@ -1048,8 +1048,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_moduleCtor"); llvm::StringRef fname("_moduleCtor");
llvm::StringRef fname2("_moduleDtor"); llvm::StringRef fname2("_moduleDtor");
std::vector<LLType*> types; LLFunctionType* fty = llvm::FunctionType::get(voidTy, false);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
} }
@ -1061,7 +1060,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_throw_exception(Object e) // void _d_throw_exception(Object e)
{ {
llvm::StringRef fname("_d_throw_exception"); llvm::StringRef fname("_d_throw_exception");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(objectTy); types.push_back(objectTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -1074,7 +1073,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _d_switch_string(char[][] table, char[] ca) // int _d_switch_string(char[][] table, char[] ca)
{ {
llvm::StringRef fname("_d_switch_string"); llvm::StringRef fname("_d_switch_string");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(stringTy)); types.push_back(rt_array(stringTy));
types.push_back(stringTy); types.push_back(stringTy);
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false);
@ -1085,7 +1084,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _d_switch_ustring(wchar[][] table, wchar[] ca) // int _d_switch_ustring(wchar[][] table, wchar[] ca)
{ {
llvm::StringRef fname("_d_switch_ustring"); llvm::StringRef fname("_d_switch_ustring");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(wstringTy)); types.push_back(rt_array(wstringTy));
types.push_back(wstringTy); types.push_back(wstringTy);
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false);
@ -1096,7 +1095,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _d_switch_dstring(dchar[][] table, dchar[] ca) // int _d_switch_dstring(dchar[][] table, dchar[] ca)
{ {
llvm::StringRef fname("_d_switch_dstring"); llvm::StringRef fname("_d_switch_dstring");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(dstringTy)); types.push_back(rt_array(dstringTy));
types.push_back(dstringTy); types.push_back(dstringTy);
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false);
@ -1113,7 +1112,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_criticalenter"); llvm::StringRef fname("_d_criticalenter");
llvm::StringRef fname2("_d_criticalexit"); llvm::StringRef fname2("_d_criticalexit");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(rt_ptr(DtoMutexType())); types.push_back(rt_ptr(DtoMutexType()));
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -1125,7 +1124,7 @@ static void LLVM_D_BuildRuntimeModule()
{ {
llvm::StringRef fname("_d_monitorenter"); llvm::StringRef fname("_d_monitorenter");
llvm::StringRef fname2("_d_monitorexit"); llvm::StringRef fname2("_d_monitorexit");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(objectTy); types.push_back(objectTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -1141,7 +1140,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _d_eh_personality(int ver, int actions, ulong eh_class, ptr eh_info, ptr context) // int _d_eh_personality(int ver, int actions, ulong eh_class, ptr eh_info, ptr context)
{ {
llvm::StringRef fname("_d_eh_personality"); llvm::StringRef fname("_d_eh_personality");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 5> types;
types.push_back(intTy); types.push_back(intTy);
types.push_back(intTy); types.push_back(intTy);
types.push_back(longTy); types.push_back(longTy);
@ -1154,7 +1153,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_eh_resume_unwind(ptr exc_struct) // void _d_eh_resume_unwind(ptr exc_struct)
{ {
llvm::StringRef fname("_d_eh_resume_unwind"); llvm::StringRef fname("_d_eh_resume_unwind");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -1167,7 +1166,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_invariant(Object o) // void _d_invariant(Object o)
{ {
llvm::StringRef fname("_d_invariant"); llvm::StringRef fname("_d_invariant");
std::vector<LLType*> types; llvm::SmallVector<LLType*, 1> types;
types.push_back(objectTy); types.push_back(objectTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);

View file

@ -515,9 +515,7 @@ LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* b
LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb) LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb)
{ {
LLSmallVector<LLValue*,2> v(2); LLValue* v[2] = { i0, i1 };
v[0] = i0;
v[1] = i1;
return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb()); return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb());
} }
@ -532,9 +530,7 @@ LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* b
LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb) LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb)
{ {
LLSmallVector<LLValue*,2> v(2); LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) };
v[0] = DtoConstUint(i0);
v[1] = DtoConstUint(i1);
return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb()); return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb());
} }
@ -550,13 +546,13 @@ LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1)
void DtoMemSet(LLValue* dst, LLValue* val, LLValue* nbytes) void DtoMemSet(LLValue* dst, LLValue* val, LLValue* nbytes)
{ {
dst = DtoBitCast(dst,getVoidPtrType()); LLType* VoidPtrTy = getVoidPtrType();
LLType* intTy = DtoSize_t(); dst = DtoBitCast(dst, VoidPtrTy);
LLType *VoidPtrTy = getVoidPtrType();
LLType *Tys[2] ={VoidPtrTy, intTy}; LLType* Tys[] = { VoidPtrTy, DtoSize_t() };
llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module, llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module,
llvm::Intrinsic::memset, llvm::makeArrayRef(Tys, 2)); llvm::Intrinsic::memset, Tys);
gIR->ir->CreateCall5(fn, dst, val, nbytes, DtoConstUint(1), DtoConstBool(false), ""); gIR->ir->CreateCall5(fn, dst, val, nbytes, DtoConstUint(1), DtoConstBool(false), "");
} }
@ -572,14 +568,14 @@ void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
void DtoMemCpy(LLValue* dst, LLValue* src, LLValue* nbytes, unsigned align) void DtoMemCpy(LLValue* dst, LLValue* src, LLValue* nbytes, unsigned align)
{ {
dst = DtoBitCast(dst,getVoidPtrType()); LLType* VoidPtrTy = getVoidPtrType();
src = DtoBitCast(src,getVoidPtrType());
LLType* intTy = DtoSize_t(); dst = DtoBitCast(dst, VoidPtrTy);
LLType *VoidPtrTy = getVoidPtrType(); src = DtoBitCast(src, VoidPtrTy);
LLType *Tys[3] ={VoidPtrTy, VoidPtrTy, intTy};
LLType* Tys[] ={ VoidPtrTy, VoidPtrTy, DtoSize_t() };
llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module, llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module,
llvm::Intrinsic::memcpy, llvm::makeArrayRef(Tys, 3)); llvm::Intrinsic::memcpy, Tys);
gIR->ir->CreateCall5(fn, dst, src, nbytes, DtoConstUint(align), DtoConstBool(false), ""); gIR->ir->CreateCall5(fn, dst, src, nbytes, DtoConstUint(align), DtoConstBool(false), "");
} }
@ -590,19 +586,18 @@ LLValue* DtoMemCmp(LLValue* lhs, LLValue* rhs, LLValue* nbytes)
{ {
// int memcmp ( const void * ptr1, const void * ptr2, size_t num ); // int memcmp ( const void * ptr1, const void * ptr2, size_t num );
LLType* VoidPtrTy = getVoidPtrType();
LLFunction* fn = gIR->module->getFunction("memcmp"); LLFunction* fn = gIR->module->getFunction("memcmp");
if (!fn) if (!fn)
{ {
std::vector<LLType*> params(3); LLType* Tys[] = { VoidPtrTy, VoidPtrTy, DtoSize_t() };
params[0] = getVoidPtrType(); LLFunctionType* fty = LLFunctionType::get(LLType::getInt32Ty(gIR->context()),
params[1] = getVoidPtrType(); Tys, false);
params[2] = DtoSize_t();
LLFunctionType* fty = LLFunctionType::get(LLType::getInt32Ty(gIR->context()), params, false);
fn = LLFunction::Create(fty, LLGlobalValue::ExternalLinkage, "memcmp", gIR->module); fn = LLFunction::Create(fty, LLGlobalValue::ExternalLinkage, "memcmp", gIR->module);
} }
lhs = DtoBitCast(lhs,getVoidPtrType()); lhs = DtoBitCast(lhs, VoidPtrTy);
rhs = DtoBitCast(rhs,getVoidPtrType()); rhs = DtoBitCast(rhs, VoidPtrTy);
return gIR->ir->CreateCall3(fn, lhs, rhs, nbytes, "tmp"); return gIR->ir->CreateCall3(fn, lhs, rhs, nbytes, "tmp");
} }
@ -971,13 +966,13 @@ LLStructType* DtoInterfaceInfoType()
return gIR->interfaceInfoType; return gIR->interfaceInfoType;
// build interface info type // build interface info type
std::vector<LLType*> types; LLSmallVector<LLType*, 3> types;
// ClassInfo classinfo // ClassInfo classinfo
ClassDeclaration* cd2 = ClassDeclaration::classinfo; ClassDeclaration* cd2 = ClassDeclaration::classinfo;
DtoResolveClass(cd2); DtoResolveClass(cd2);
types.push_back(DtoType(cd2->type)); types.push_back(DtoType(cd2->type));
// void*[] vtbl // void*[] vtbl
std::vector<LLType*> vtbltypes; LLSmallVector<LLType*, 2> vtbltypes;
vtbltypes.push_back(DtoSize_t()); vtbltypes.push_back(DtoSize_t());
LLType* byteptrptrty = getPtrToType(getPtrToType(LLType::getInt8Ty(gIR->context()))); LLType* byteptrptrty = getPtrToType(getPtrToType(LLType::getInt8Ty(gIR->context())));
vtbltypes.push_back(byteptrptrty); vtbltypes.push_back(byteptrptrty);
@ -1006,20 +1001,19 @@ LLStructType* DtoMutexType()
llvm::Type *Int32Ty = llvm::Type::getInt32Ty(gIR->context()); llvm::Type *Int32Ty = llvm::Type::getInt32Ty(gIR->context());
// Build RTL_CRITICAL_SECTION; size is 24 (32bit) or 40 (64bit) // Build RTL_CRITICAL_SECTION; size is 24 (32bit) or 40 (64bit)
std::vector<LLType*> rtl_types; LLType *rtl_types[] = {
rtl_types.push_back(VoidPtrTy); // Pointer to DebugInfo VoidPtrTy, // Pointer to DebugInfo
rtl_types.push_back(Int32Ty); // LockCount Int32Ty, // LockCount
rtl_types.push_back(Int32Ty); // RecursionCount Int32Ty, // RecursionCount
rtl_types.push_back(VoidPtrTy); // Handle of OwningThread VoidPtrTy, // Handle of OwningThread
rtl_types.push_back(VoidPtrTy); // Handle of LockSemaphore VoidPtrTy, // Handle of LockSemaphore
rtl_types.push_back(VoidPtrTy); // SpinCount VoidPtrTy // SpinCount
};
LLStructType* rtl = LLStructType::create(gIR->context(), rtl_types, "RTL_CRITICAL_SECTION"); LLStructType* rtl = LLStructType::create(gIR->context(), rtl_types, "RTL_CRITICAL_SECTION");
// Build D_CRITICAL_SECTION; size is 28 (32bit) or 48 (64bit) // Build D_CRITICAL_SECTION; size is 28 (32bit) or 48 (64bit)
LLStructType* mutex = LLStructType::create(gIR->context(), "D_CRITICAL_SECTION"); LLStructType *mutex = LLStructType::create(gIR->context(), "D_CRITICAL_SECTION");
std::vector<LLType*> types; LLType *types[] = { getPtrToType(mutex), rtl };
types.push_back(getPtrToType(mutex));
types.push_back(rtl);
mutex->setBody(types); mutex->setBody(types);
// Cache type // Cache type
@ -1035,25 +1029,25 @@ LLStructType* DtoMutexType()
} }
// pthread_fastlock // pthread_fastlock
std::vector<LLType*> types2; LLType *types2[] = {
types2.push_back(DtoSize_t()); DtoSize_t(),
types2.push_back(LLType::getInt32Ty(gIR->context())); LLType::getInt32Ty(gIR->context()
};
LLStructType* fastlock = LLStructType::get(gIR->context(), types2); LLStructType* fastlock = LLStructType::get(gIR->context(), types2);
// pthread_mutex // pthread_mutex
std::vector<LLType*> types1; LLType *types1[] = {
types1.push_back(LLType::getInt32Ty(gIR->context())); LLType::getInt32Ty(gIR->context()),
types1.push_back(LLType::getInt32Ty(gIR->context())); LLType::getInt32Ty(gIR->context()),
types1.push_back(getVoidPtrType()); getVoidPtrType(),
types1.push_back(LLType::getInt32Ty(gIR->context())); LLType::getInt32Ty(gIR->context()),
types1.push_back(fastlock); fastlock
};
LLStructType* pmutex = LLStructType::get(gIR->context(), types1); LLStructType* pmutex = LLStructType::get(gIR->context(), types1);
// D_CRITICAL_SECTION // D_CRITICAL_SECTION
LLStructType* mutex = LLStructType::create(gIR->context(), "D_CRITICAL_SECTION"); LLStructType* mutex = LLStructType::create(gIR->context(), "D_CRITICAL_SECTION");
std::vector<LLType*> types; LLType *types[] = { getPtrToType(mutex), pmutex };
types.push_back(getPtrToType(mutex));
types.push_back(pmutex);
mutex->setBody(types); mutex->setBody(types);
// Cache type // Cache type
@ -1073,13 +1067,14 @@ LLStructType* DtoModuleReferenceType()
LLStructType* st = LLStructType::create(gIR->context(), "ModuleReference"); LLStructType* st = LLStructType::create(gIR->context(), "ModuleReference");
// add members // add members
std::vector<LLType*> types; LLType *types[] = {
types.push_back(getPtrToType(st)); getPtrToType(st),
#if DMDV1 #if DMDV1
types.push_back(DtoType(Module::moduleinfo->type)); DtoType(Module::moduleinfo->type)
#else #else
types.push_back(DtoType(Module::moduleinfo->type->pointerTo())); DtoType(Module::moduleinfo->type->pointerTo())
#endif #endif
};
// resolve type // resolve type
st->setBody(types); st->setBody(types);
@ -1100,10 +1095,8 @@ LLValue* DtoAggrPair(LLType* type, LLValue* V1, LLValue* V2, const char* name)
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name) LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name)
{ {
llvm::SmallVector<LLType*, 2> types; LLType *types[] = { V1->getType(), V2->getType() };
types.push_back(V1->getType()); LLType *t = LLStructType::get(gIR->context(), types);
types.push_back(V2->getType());
LLType* t = LLStructType::get(gIR->context(), types);
return DtoAggrPair(t, V1, V2, name); return DtoAggrPair(t, V1, V2, name);
} }