mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-31 03:53:14 +01:00
Fixed most regressions from last commit.
This commit is contained in:
@@ -194,6 +194,18 @@ void DtoArrayInit(Loc& loc, DValue* array, DValue* value)
|
||||
funcname = "_d_array_init_real";
|
||||
break;
|
||||
|
||||
case Tcomplex32:
|
||||
funcname = "_d_array_init_cfloat";
|
||||
break;
|
||||
|
||||
case Tcomplex64:
|
||||
funcname = "_d_array_init_cdouble";
|
||||
break;
|
||||
|
||||
case Tcomplex80:
|
||||
funcname = "_d_array_init_creal";
|
||||
break;
|
||||
|
||||
case Tpointer:
|
||||
case Tclass:
|
||||
funcname = "_d_array_init_pointer";
|
||||
@@ -207,9 +219,6 @@ void DtoArrayInit(Loc& loc, DValue* array, DValue* value)
|
||||
case Tdelegate:
|
||||
case Tarray:
|
||||
case Tsarray:
|
||||
case Tcomplex32:
|
||||
case Tcomplex64:
|
||||
case Tcomplex80:
|
||||
funcname = "_d_array_init_mem";
|
||||
args[0] = DtoBitCast(args[0], getVoidPtrType());
|
||||
args[2] = DtoBitCast(args[2], getVoidPtrType());
|
||||
|
||||
@@ -119,9 +119,12 @@ DValue* DtoComplex(Loc& loc, Type* to, DValue* val)
|
||||
if (t->isimaginary()) {
|
||||
res = DtoAggrPair(complexTy, LLConstant::getNullValue(DtoType(baserety)), DtoCastFloat(loc, val, baseimty)->getRVal());
|
||||
}
|
||||
else if (t->isfloating() || t->isintegral()) {
|
||||
else if (t->isfloating()) {
|
||||
res = DtoAggrPair(complexTy, DtoCastFloat(loc, val, baserety)->getRVal(), LLConstant::getNullValue(DtoType(baseimty)));
|
||||
}
|
||||
else if (t->isintegral()) {
|
||||
res = DtoAggrPair(complexTy, DtoCastInt(loc, val, baserety)->getRVal(), LLConstant::getNullValue(DtoType(baseimty)));
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
const LLType* shortTy = LLType::Int16Ty;
|
||||
const LLType* intTy = LLType::Int32Ty;
|
||||
const LLType* longTy = LLType::Int64Ty;
|
||||
const LLType* sizeTy = DtoSize_t();
|
||||
|
||||
const LLType* floatTy = LLType::FloatTy;
|
||||
const LLType* doubleTy = LLType::DoubleTy;
|
||||
const LLType* realTy;
|
||||
@@ -170,7 +172,11 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
realTy = LLType::X86_FP80Ty;
|
||||
else
|
||||
realTy = LLType::DoubleTy;
|
||||
const LLType* sizeTy = DtoSize_t();
|
||||
|
||||
const LLType* cfloatTy = llvm::StructType::get(floatTy, floatTy, 0);
|
||||
const LLType* cdoubleTy = llvm::StructType::get(doubleTy, doubleTy, 0);
|
||||
const LLType* crealTy = llvm::StructType::get(realTy, realTy, 0);
|
||||
|
||||
const LLType* voidPtrTy = rt_ptr(byteTy);
|
||||
const LLType* stringTy = rt_array(byteTy);
|
||||
const LLType* wstringTy = rt_array(shortTy);
|
||||
@@ -338,6 +344,9 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
ARRAY_INIT(floatTy,"float")
|
||||
ARRAY_INIT(doubleTy,"double")
|
||||
ARRAY_INIT(realTy,"real")
|
||||
ARRAY_INIT(cfloatTy,"cfloat")
|
||||
ARRAY_INIT(cdoubleTy,"cdouble")
|
||||
ARRAY_INIT(crealTy,"creal")
|
||||
ARRAY_INIT(voidPtrTy,"pointer")
|
||||
|
||||
#undef ARRAY_INIT
|
||||
|
||||
@@ -76,6 +76,30 @@ void _d_array_init_real(real* a, size_t n, real v)
|
||||
*p++ = v;
|
||||
}
|
||||
|
||||
void _d_array_init_cfloat(cfloat* a, size_t n, cfloat v)
|
||||
{
|
||||
auto p = a;
|
||||
auto end = a+n;
|
||||
while (p !is end)
|
||||
*p++ = v;
|
||||
}
|
||||
|
||||
void _d_array_init_cdouble(cdouble* a, size_t n, cdouble v)
|
||||
{
|
||||
auto p = a;
|
||||
auto end = a+n;
|
||||
while (p !is end)
|
||||
*p++ = v;
|
||||
}
|
||||
|
||||
void _d_array_init_creal(creal* a, size_t n, creal v)
|
||||
{
|
||||
auto p = a;
|
||||
auto end = a+n;
|
||||
while (p !is end)
|
||||
*p++ = v;
|
||||
}
|
||||
|
||||
void _d_array_init_pointer(void** a, size_t n, void* v)
|
||||
{
|
||||
auto p = a;
|
||||
|
||||
Reference in New Issue
Block a user