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 )
{
llvm::StringRef fname("_d_assert");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(stringTy);
types.push_back(intTy);
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 fname2("_d_switch_error");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
#if DMDV2
types.push_back(getPtrToType(DtoType(Module::moduleinfo->type)));
#else
@ -342,7 +342,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_assert_msg( char[] msg, char[] file, uint line )
{
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(intTy);
@ -358,7 +358,7 @@ static void LLVM_D_BuildRuntimeModule()
// void* _d_allocmemory(size_t sz)
{
llvm::StringRef fname("_d_allocmemory");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -368,7 +368,7 @@ static void LLVM_D_BuildRuntimeModule()
// void* _d_allocmemoryT(TypeInfo ti)
{
llvm::StringRef fname("_d_allocmemoryT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
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 fname2("_d_newarrayiT");
llvm::StringRef fname3("_d_newarrayvT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy);
types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
@ -400,7 +400,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_d_newarraymT");
llvm::StringRef fname2("_d_newarraymiT");
llvm::StringRef fname3("_d_newarraymvT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
types.push_back(sizeTy);
types.push_back(rt_ptr(sizeTy));
@ -418,7 +418,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_d_newarrayT");
llvm::StringRef fname2("_d_newarrayiT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy);
types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, false);
@ -430,7 +430,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_d_newarraymT");
llvm::StringRef fname2("_d_newarraymiT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy);
types.push_back(sizeTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, true);
@ -448,7 +448,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_d_arraysetlengthT");
llvm::StringRef fname2("_d_arraysetlengthiT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 4> types;
types.push_back(typeInfoTy);
types.push_back(sizeTy);
#if DMDV2
@ -467,7 +467,7 @@ static void LLVM_D_BuildRuntimeModule()
// byte[] _d_arrayappendcTX(TypeInfo ti, ref byte[] px, size_t n)
{
llvm::StringRef fname("_d_arrayappendcTX");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
types.push_back(voidArrayPtrTy);
types.push_back(sizeTy);
@ -477,7 +477,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _d_arrayappendT(TypeInfo ti, byte[]* px, byte[] y)
{
llvm::StringRef fname("_d_arrayappendT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
types.push_back(voidArrayPtrTy);
types.push_back(voidArrayTy);
@ -487,7 +487,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _d_arrayappendcd(ref char[] x, dchar c)
{
llvm::StringRef fname("_d_arrayappendcd");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(getPtrToType(stringTy));
types.push_back(intTy);
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)
{
llvm::StringRef fname("_d_arrayappendwd");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(getPtrToType(wstringTy));
types.push_back(intTy);
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)
{
llvm::StringRef fname("_d_arraycatT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
types.push_back(voidArrayTy);
types.push_back(voidArrayTy);
@ -515,7 +515,7 @@ static void LLVM_D_BuildRuntimeModule()
// byte[] _d_arraycatnT(TypeInfo ti, uint n, ...)
{
llvm::StringRef fname("_d_arraycatnT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidArrayTy, types, true);
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)
{
llvm::StringRef fname("_d_arrayappendcT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
types.push_back(voidPtrTy);
types.push_back(voidPtrTy);
@ -536,7 +536,7 @@ static void LLVM_D_BuildRuntimeModule()
// Object _d_allocclass(ClassInfo ci)
{
llvm::StringRef fname(_d_allocclass);
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(classInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
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)
{
llvm::StringRef fname("_d_delarray_t");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(voidArrayPtrTy);
types.push_back(typeInfoTy);
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)
{
llvm::StringRef fname("_d_delarray");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(sizeTy);
types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
@ -581,7 +581,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_d_delmemory");
llvm::StringRef fname2("_d_delinterface");
llvm::StringRef fname3("_d_callfinalizer");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -593,7 +593,7 @@ static void LLVM_D_BuildRuntimeModule()
// D2: void _d_delclass(Object* p)
{
llvm::StringRef fname("_d_delclass");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
#if DMDV2
types.push_back(rt_ptr(objectTy));
#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)
{
llvm::StringRef fname("_d_array_slice_copy");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 4> types;
types.push_back(voidPtrTy);
types.push_back(sizeTy);
types.push_back(voidPtrTy);
@ -630,7 +630,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \
llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \
std::vector<LLType*> types; \
llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \
types.push_back(rt_dg1()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -647,7 +647,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \
llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \
std::vector<LLType*> types; \
llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \
types.push_back(rt_dg2()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -663,7 +663,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \
llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \
std::vector<LLType*> types; \
llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \
types.push_back(rt_dg1()); \
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
@ -679,7 +679,7 @@ static void LLVM_D_BuildRuntimeModule()
{ \
llvm::StringRef fname(a); \
llvm::StringRef fname2(b); \
std::vector<LLType*> types; \
llvm::SmallVector<LLType*, 2> types; \
types.push_back(TY); \
types.push_back(rt_dg2()); \
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)
{
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);
@ -719,7 +719,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_d_arrayassign");
llvm::StringRef fname2("_d_arrayctor");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
types.push_back(voidArrayTy);
types.push_back(voidArrayTy);
@ -733,7 +733,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_d_arraysetassign");
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(sizeTy);
@ -755,7 +755,7 @@ static void LLVM_D_BuildRuntimeModule()
// Object _d_toObject(void* p)
{
llvm::StringRef fname("_d_toObject");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
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)
{
llvm::StringRef fname("_d_interface_cast");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(voidPtrTy);
types.push_back(classInfoTy);
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)
{
llvm::StringRef fname("_d_dynamic_cast");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(objectTy);
types.push_back(classInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
@ -795,7 +795,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_adReverseChar");
llvm::StringRef fname2("_adSortChar");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(stringTy);
LLFunctionType* fty = llvm::FunctionType::get(stringTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -807,7 +807,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_adReverseWchar");
llvm::StringRef fname2("_adSortWchar");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(wstringTy);
LLFunctionType* fty = llvm::FunctionType::get(wstringTy, types, false);
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)
{
llvm::StringRef fname("_adReverse");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(byteTy));
types.push_back(sizeTy);
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)
{
llvm::StringRef fname("_adDupT");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(typeInfoTy);
types.push_back(rt_array(byteTy));
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 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(typeInfoTy);
@ -854,7 +854,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _adCmpChar(void[] a1, void[] a2)
{
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));
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false);
@ -865,7 +865,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _adSort(void[] a, TypeInfo ti)
{
llvm::StringRef fname("_adSort");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(byteTy));
types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
@ -879,7 +879,7 @@ static void LLVM_D_BuildRuntimeModule()
// size_t _aaLen(AA aa)
{
llvm::StringRef fname("_aaLen");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(aaTy);
LLFunctionType* fty = llvm::FunctionType::get(sizeTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
@ -896,7 +896,7 @@ static void LLVM_D_BuildRuntimeModule()
#else
llvm::StringRef fname("_aaGet");
#endif
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 4> types;
types.push_back(aaTy);
types.push_back(typeInfoTy);
types.push_back(sizeTy);
@ -916,7 +916,7 @@ static void LLVM_D_BuildRuntimeModule()
#else
llvm::StringRef fname("_aaIn");
#endif
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy);
types.push_back(typeInfoTy);
types.push_back(voidPtrTy);
@ -937,7 +937,7 @@ static void LLVM_D_BuildRuntimeModule()
llvm::StringRef fname("_aaDel");
LLType *retType = voidTy;
#endif
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy);
types.push_back(typeInfoTy);
types.push_back(voidPtrTy);
@ -949,7 +949,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _aaValues(AA aa, size_t keysize, size_t valuesize)
{
llvm::StringRef fname("_aaValues");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy);
types.push_back(sizeTy);
types.push_back(sizeTy);
@ -961,7 +961,7 @@ static void LLVM_D_BuildRuntimeModule()
// void* _aaRehash(AA* paa, TypeInfo keyti)
{
llvm::StringRef fname("_aaRehash");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(aaTy);
types.push_back(typeInfoTy);
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
@ -971,7 +971,7 @@ static void LLVM_D_BuildRuntimeModule()
// void[] _aaKeys(AA aa, size_t keysize)
{
llvm::StringRef fname("_aaKeys");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(aaTy);
types.push_back(sizeTy);
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)
{
llvm::StringRef fname("_aaApply");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy);
types.push_back(sizeTy);
types.push_back(rt_dg1());
@ -994,7 +994,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _aaApply2(AA aa, size_t keysize, dg2_t dg)
{
llvm::StringRef fname("_aaApply2");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy);
types.push_back(sizeTy);
types.push_back(rt_dg2());
@ -1007,7 +1007,7 @@ static void LLVM_D_BuildRuntimeModule()
// int _aaEqual(TypeInfo_AssociativeArray ti, AA e1, AA e2)
{
llvm::StringRef fname("_aaEqual");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(typeInfoTy);
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)
{
llvm::StringRef fname("_d_assocarrayliteralTX");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTypeInfoTy);
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)
{
llvm::StringRef fname("_aaEq");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 3> types;
types.push_back(aaTy);
types.push_back(aaTy);
types.push_back(typeInfoTy);
@ -1048,8 +1048,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_moduleCtor");
llvm::StringRef fname2("_moduleDtor");
std::vector<LLType*> types;
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, 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)
{
llvm::StringRef fname("_d_throw_exception");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(objectTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
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)
{
llvm::StringRef fname("_d_switch_string");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(stringTy));
types.push_back(stringTy);
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)
{
llvm::StringRef fname("_d_switch_ustring");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(wstringTy));
types.push_back(wstringTy);
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)
{
llvm::StringRef fname("_d_switch_dstring");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 2> types;
types.push_back(rt_array(dstringTy));
types.push_back(dstringTy);
LLFunctionType* fty = llvm::FunctionType::get(intTy, types, false);
@ -1113,7 +1112,7 @@ static void LLVM_D_BuildRuntimeModule()
{
llvm::StringRef fname("_d_criticalenter");
llvm::StringRef fname2("_d_criticalexit");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(rt_ptr(DtoMutexType()));
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
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 fname2("_d_monitorexit");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(objectTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
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)
{
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(longTy);
@ -1154,7 +1153,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_eh_resume_unwind(ptr exc_struct)
{
llvm::StringRef fname("_d_eh_resume_unwind");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(voidPtrTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
@ -1167,7 +1166,7 @@ static void LLVM_D_BuildRuntimeModule()
// void _d_invariant(Object o)
{
llvm::StringRef fname("_d_invariant");
std::vector<LLType*> types;
llvm::SmallVector<LLType*, 1> types;
types.push_back(objectTy);
LLFunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
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)
{
LLSmallVector<LLValue*,2> v(2);
v[0] = i0;
v[1] = i1;
LLValue* v[2] = { i0, i1 };
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)
{
LLSmallVector<LLValue*,2> v(2);
v[0] = DtoConstUint(i0);
v[1] = DtoConstUint(i1);
LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) };
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)
{
dst = DtoBitCast(dst,getVoidPtrType());
LLType* intTy = DtoSize_t();
LLType* VoidPtrTy = getVoidPtrType();
LLType *Tys[2] ={VoidPtrTy, intTy};
dst = DtoBitCast(dst, VoidPtrTy);
LLType* Tys[] = { VoidPtrTy, DtoSize_t() };
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), "");
}
@ -572,14 +568,14 @@ void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
void DtoMemCpy(LLValue* dst, LLValue* src, LLValue* nbytes, unsigned align)
{
dst = DtoBitCast(dst,getVoidPtrType());
src = DtoBitCast(src,getVoidPtrType());
LLType* intTy = DtoSize_t();
LLType* VoidPtrTy = getVoidPtrType();
LLType *Tys[3] ={VoidPtrTy, VoidPtrTy, intTy};
dst = DtoBitCast(dst, VoidPtrTy);
src = DtoBitCast(src, VoidPtrTy);
LLType* Tys[] ={ VoidPtrTy, VoidPtrTy, DtoSize_t() };
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), "");
}
@ -590,19 +586,18 @@ LLValue* DtoMemCmp(LLValue* lhs, LLValue* rhs, LLValue* nbytes)
{
// int memcmp ( const void * ptr1, const void * ptr2, size_t num );
LLType* VoidPtrTy = getVoidPtrType();
LLFunction* fn = gIR->module->getFunction("memcmp");
if (!fn)
{
std::vector<LLType*> params(3);
params[0] = getVoidPtrType();
params[1] = getVoidPtrType();
params[2] = DtoSize_t();
LLFunctionType* fty = LLFunctionType::get(LLType::getInt32Ty(gIR->context()), params, false);
LLType* Tys[] = { VoidPtrTy, VoidPtrTy, DtoSize_t() };
LLFunctionType* fty = LLFunctionType::get(LLType::getInt32Ty(gIR->context()),
Tys, false);
fn = LLFunction::Create(fty, LLGlobalValue::ExternalLinkage, "memcmp", gIR->module);
}
lhs = DtoBitCast(lhs,getVoidPtrType());
rhs = DtoBitCast(rhs,getVoidPtrType());
lhs = DtoBitCast(lhs, VoidPtrTy);
rhs = DtoBitCast(rhs, VoidPtrTy);
return gIR->ir->CreateCall3(fn, lhs, rhs, nbytes, "tmp");
}
@ -971,13 +966,13 @@ LLStructType* DtoInterfaceInfoType()
return gIR->interfaceInfoType;
// build interface info type
std::vector<LLType*> types;
LLSmallVector<LLType*, 3> types;
// ClassInfo classinfo
ClassDeclaration* cd2 = ClassDeclaration::classinfo;
DtoResolveClass(cd2);
types.push_back(DtoType(cd2->type));
// void*[] vtbl
std::vector<LLType*> vtbltypes;
LLSmallVector<LLType*, 2> vtbltypes;
vtbltypes.push_back(DtoSize_t());
LLType* byteptrptrty = getPtrToType(getPtrToType(LLType::getInt8Ty(gIR->context())));
vtbltypes.push_back(byteptrptrty);
@ -1006,20 +1001,19 @@ LLStructType* DtoMutexType()
llvm::Type *Int32Ty = llvm::Type::getInt32Ty(gIR->context());
// Build RTL_CRITICAL_SECTION; size is 24 (32bit) or 40 (64bit)
std::vector<LLType*> rtl_types;
rtl_types.push_back(VoidPtrTy); // Pointer to DebugInfo
rtl_types.push_back(Int32Ty); // LockCount
rtl_types.push_back(Int32Ty); // RecursionCount
rtl_types.push_back(VoidPtrTy); // Handle of OwningThread
rtl_types.push_back(VoidPtrTy); // Handle of LockSemaphore
rtl_types.push_back(VoidPtrTy); // SpinCount
LLType *rtl_types[] = {
VoidPtrTy, // Pointer to DebugInfo
Int32Ty, // LockCount
Int32Ty, // RecursionCount
VoidPtrTy, // Handle of OwningThread
VoidPtrTy, // Handle of LockSemaphore
VoidPtrTy // SpinCount
};
LLStructType* rtl = LLStructType::create(gIR->context(), rtl_types, "RTL_CRITICAL_SECTION");
// Build D_CRITICAL_SECTION; size is 28 (32bit) or 48 (64bit)
LLStructType *mutex = LLStructType::create(gIR->context(), "D_CRITICAL_SECTION");
std::vector<LLType*> types;
types.push_back(getPtrToType(mutex));
types.push_back(rtl);
LLType *types[] = { getPtrToType(mutex), rtl };
mutex->setBody(types);
// Cache type
@ -1035,25 +1029,25 @@ LLStructType* DtoMutexType()
}
// pthread_fastlock
std::vector<LLType*> types2;
types2.push_back(DtoSize_t());
types2.push_back(LLType::getInt32Ty(gIR->context()));
LLType *types2[] = {
DtoSize_t(),
LLType::getInt32Ty(gIR->context()
};
LLStructType* fastlock = LLStructType::get(gIR->context(), types2);
// pthread_mutex
std::vector<LLType*> types1;
types1.push_back(LLType::getInt32Ty(gIR->context()));
types1.push_back(LLType::getInt32Ty(gIR->context()));
types1.push_back(getVoidPtrType());
types1.push_back(LLType::getInt32Ty(gIR->context()));
types1.push_back(fastlock);
LLType *types1[] = {
LLType::getInt32Ty(gIR->context()),
LLType::getInt32Ty(gIR->context()),
getVoidPtrType(),
LLType::getInt32Ty(gIR->context()),
fastlock
};
LLStructType* pmutex = LLStructType::get(gIR->context(), types1);
// D_CRITICAL_SECTION
LLStructType* mutex = LLStructType::create(gIR->context(), "D_CRITICAL_SECTION");
std::vector<LLType*> types;
types.push_back(getPtrToType(mutex));
types.push_back(pmutex);
LLType *types[] = { getPtrToType(mutex), pmutex };
mutex->setBody(types);
// Cache type
@ -1073,13 +1067,14 @@ LLStructType* DtoModuleReferenceType()
LLStructType* st = LLStructType::create(gIR->context(), "ModuleReference");
// add members
std::vector<LLType*> types;
types.push_back(getPtrToType(st));
LLType *types[] = {
getPtrToType(st),
#if DMDV1
types.push_back(DtoType(Module::moduleinfo->type));
DtoType(Module::moduleinfo->type)
#else
types.push_back(DtoType(Module::moduleinfo->type->pointerTo()));
DtoType(Module::moduleinfo->type->pointerTo())
#endif
};
// resolve type
st->setBody(types);
@ -1100,9 +1095,7 @@ LLValue* DtoAggrPair(LLType* type, LLValue* V1, LLValue* V2, const char* name)
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name)
{
llvm::SmallVector<LLType*, 2> types;
types.push_back(V1->getType());
types.push_back(V2->getType());
LLType *types[] = { V1->getType(), V2->getType() };
LLType *t = LLStructType::get(gIR->context(), types);
return DtoAggrPair(t, V1, V2, name);
}