Mercurial > projects > ldc
changeset 586:192b82878b78
Fixed most regressions from last commit.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 10 Sep 2008 12:33:33 -0700 |
parents | fbb1a366cfbc |
children | 23538d0f0d5b |
files | gen/arrays.cpp gen/complex.cpp gen/runtime.cpp runtime/internal/arrayInit.d |
diffstat | 4 files changed, 50 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/arrays.cpp Tue Sep 09 16:49:47 2008 -0700 +++ b/gen/arrays.cpp Wed Sep 10 12:33:33 2008 -0700 @@ -194,6 +194,18 @@ 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 @@ 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());
--- a/gen/complex.cpp Tue Sep 09 16:49:47 2008 -0700 +++ b/gen/complex.cpp Wed Sep 10 12:33:33 2008 -0700 @@ -119,9 +119,12 @@ 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); }
--- a/gen/runtime.cpp Tue Sep 09 16:49:47 2008 -0700 +++ b/gen/runtime.cpp Wed Sep 10 12:33:33 2008 -0700 @@ -163,6 +163,8 @@ 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 @@ 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 @@ 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
--- a/runtime/internal/arrayInit.d Tue Sep 09 16:49:47 2008 -0700 +++ b/runtime/internal/arrayInit.d Wed Sep 10 12:33:33 2008 -0700 @@ -76,6 +76,30 @@ *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;