diff gen/toir.c @ 51:61bc1b4ad3c4 trunk

[svn r55] Foreach was always generating code as if the value variable was 'ref' Other not-so-major improvements
author lindquist
date Mon, 22 Oct 2007 17:25:44 +0200
parents 6fcc08a4d406
children 0c77619e803b
line wrap: on
line diff
--- a/gen/toir.c	Mon Oct 22 15:40:56 2007 +0200
+++ b/gen/toir.c	Mon Oct 22 17:25:44 2007 +0200
@@ -499,8 +499,7 @@
         if (e2ty == Tstruct) {
             // struct literals do the assignment themselvs (in place)
             if (!r->inplace) {
-                TypeStruct* ts = (TypeStruct*)e2type;
-                LLVM_DtoStructCopy(ts,l->mem,r->getValue());
+                LLVM_DtoStructCopy(l->mem,r->getValue());
             }
             else {
                 e->inplace = true;
@@ -510,8 +509,7 @@
         else if (e2type->isintegral()){
             IntegerExp* iexp = (IntegerExp*)e2;
             assert(iexp->value == 0 && "Only integral struct initializer allowed is zero");
-            TypeStruct* st = (TypeStruct*)e1type;
-            LLVM_DtoStructZeroInit(st, l->mem);
+            LLVM_DtoStructZeroInit(l->mem);
         }
         // :x
         else
@@ -1550,18 +1548,7 @@
                 Logger::cout() << *val << " | " << *arrptr << '\n';
 
                 Type* vxtype = LLVM_DtoDType(vx->type);
-                if (vxtype->ty == Tstruct) {
-                    TypeStruct* ts = (TypeStruct*)vxtype;
-                    LLVM_DtoStructCopy(ts,arrptr,val);
-                }
-                else if (vxtype->ty == Tarray) {
-                    LLVM_DtoArrayAssign(arrptr,val);
-                }
-                else if (vxtype->ty == Tsarray) {
-                    LLVM_DtoStaticArrayCopy(arrptr,val);
-                }
-                else
-                    new llvm::StoreInst(val, arrptr, p->scopebb());
+                LLVM_DtoAssign(vxtype, arrptr, val);
             }
             delete ve;
         }
@@ -2058,10 +2045,10 @@
     else if (ntype->ty == Tstruct) {
         TypeStruct* ts = (TypeStruct*)ntype;
         if (ts->isZeroInit()) {
-            LLVM_DtoStructZeroInit(ts,e->mem);
+            LLVM_DtoStructZeroInit(e->mem);
         }
         else {
-            LLVM_DtoStructCopy(ts,e->mem,ts->llvmInit);
+            LLVM_DtoStructCopy(e->mem,ts->llvmInit);
         }
     }