changeset 201:8f9191180c7a trunk

[svn r217] Updated: the rebuild profiles. Fixed: way to find class data fields was too strict type wise. Fixed: foreach resulting in an implicit delegate could fail.
author lindquist
date Mon, 12 May 2008 22:44:25 +0200
parents e937752e4541
children 56e0c5b1d428
files gen/classes.cpp gen/statements.cpp gen/toir.cpp gen/tollvm.cpp llvmdc-posix-internal llvmdc-tango
diffstat 6 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/gen/classes.cpp	Mon May 12 22:27:05 2008 +0200
+++ b/gen/classes.cpp	Mon May 12 22:44:25 2008 +0200
@@ -1153,7 +1153,7 @@
         Type* vdtype = DtoDType(vd->type);
         //Logger::println("found %u type %s", vd->offset, vdtype->toChars());
         assert(vd->ir.irField->index >= 0);
-        if (os == vd->offset && vdtype == t) {
+        if (os == vd->offset && vdtype->toBasetype() == t->toBasetype()) {
             Logger::println("found %s %s", vdtype->toChars(), vd->toChars());
             idxs.push_back(vd->ir.irField->index + dataoffset);
             //Logger::cout() << "indexing: " << *ptr << '\n';
--- a/gen/statements.cpp	Mon May 12 22:27:05 2008 +0200
+++ b/gen/statements.cpp	Mon May 12 22:44:25 2008 +0200
@@ -842,12 +842,13 @@
     llvm::Value* zerokey = llvm::ConstantInt::get(keytype,0,false);
 
     // value
+    Logger::println("value = %s", value->toPrettyChars());
     const llvm::Type* valtype = DtoType(value->type);
     llvm::Value* valvar = NULL;
     if (!value->isRef() && !value->isOut())
         valvar = new llvm::AllocaInst(valtype, "foreachval", p->topallocapoint());
-    assert(!value->ir.irLocal);
-    value->ir.irLocal = new IrLocal(value);
+    if (!value->ir.irLocal)
+        value->ir.irLocal = new IrLocal(value);
 
     // what to iterate
     DValue* aggrval = aggr->toElem(p);
--- a/gen/toir.cpp	Mon May 12 22:27:05 2008 +0200
+++ b/gen/toir.cpp	Mon May 12 22:44:25 2008 +0200
@@ -1246,7 +1246,10 @@
         return v;
     }
 
-    else if (u->isLRValue() || (u->isVar() && u->isVar()->lval))
+    else if (DLRValue* lr = u->isLRValue())
+        return new DLRValue(lr->getLType(), lr->getLVal(), to, v->getRVal());
+
+    else if (u->isVar() && u->isVar()->lval)
         return new DLRValue(e1->type, u->getLVal(), to, v->getRVal());
 
     else if (gIR->topexp() && gIR->topexp()->e1 == this)
--- a/gen/tollvm.cpp	Mon May 12 22:27:05 2008 +0200
+++ b/gen/tollvm.cpp	Mon May 12 22:44:25 2008 +0200
@@ -1006,11 +1006,16 @@
         Logger::cout() << "assign\nlhs: " << *l << "rhs: " << *r << '\n';
         const llvm::Type* lit = l->getType()->getContainedType(0);
         if (r->getType() != lit) {
-            if (DLRValue* lr = lhs->isLRValue()) // handle lvalue cast assignments
+            // handle lvalue cast assignments
+            if (DLRValue* lr = lhs->isLRValue()) {
+                Logger::println("lvalue cast!");
                 r = DtoCast(rhs, lr->getLType())->getRVal();
-            else
+            }
+            else {
                 r = DtoCast(rhs, lhs->getType())->getRVal();
+            }
             Logger::cout() << "really assign\nlhs: " << *l << "rhs: " << *r << '\n';
+            assert(r->getType() == l->getType()->getContainedType(0));
         }
         gIR->ir->CreateStore(r, l);
     }
--- a/llvmdc-posix-internal	Mon May 12 22:27:05 2008 +0200
+++ b/llvmdc-posix-internal	Mon May 12 22:44:25 2008 +0200
@@ -43,7 +43,7 @@
 
 
 [link]
-oneatatime=yes
+#oneatatime=yes
 cmd=llvmdc $i -of$o
 
 libdir=-L-L$i
@@ -53,7 +53,7 @@
 
 [liblink]
 safe=yes
-oneatatime=yes
+#oneatatime=yes
 cmd=llvm-link -f -o=$o $i
 
 libdir=
@@ -67,7 +67,7 @@
 
 [shliblink]
 shlibs=no
-oneatatime=yes
+#oneatatime=yes
 cmd=llvm-link $i | llc -filetype=dynlib -f -o=$o
 
 libdir=
--- a/llvmdc-tango	Mon May 12 22:27:05 2008 +0200
+++ b/llvmdc-tango	Mon May 12 22:44:25 2008 +0200
@@ -7,12 +7,13 @@
 objext=bc
 
 
+version=LLVM
 version=LLVMDC
 noversion=DigitalMars
 noversion=GNU
 testversion=linux
 testversion=Unix
-testversion=Posix
+version=Posix
 testversion=Windows
 testversion=Win32
 testversion=Win64
@@ -41,7 +42,7 @@
 
 
 [link]
-oneatatime=yes
+#oneatatime=yes
 cmd=llvmdc $i -of$o
 
 libdir=-L-L=$i
@@ -51,7 +52,7 @@
 
 [liblink]
 safe=yes
-oneatatime=yes
+#oneatatime=yes
 cmd=llvm-ar rsc $o $i
 
 libdir=-L=$i