diff gen/toir.cpp @ 275:665b81613475 trunk

[svn r296] Removed: the 'suite' dir, it never took off! Fixed: foreach statement, key-type checks were buggy. Fixed: setting LLVMDC versions on the command line is now an error. Fixed: array compare runtime had incorrect param attrs on call. Fixed: index expressions on dynamic array slices w/o storage was broken. Fixed: scope classes had incorrect finalization in some cases. Fixed: when outputting !ClassInfoS !OffsetTypeInfoS, static class members were trying to be included, crashing the compiler. Fixed: calling LLVMDC with -inline but not any -O option caused assertion failure. Changed: the runtime now uses a single interface to "get" to !TypeInfoS, part of eliminating duplicate !TypeInfo codegen.
author lindquist
date Thu, 19 Jun 2008 17:30:32 +0200
parents 23d0d9855cad
children f5f97ca47b33
line wrap: on
line diff
--- a/gen/toir.cpp	Thu Jun 19 13:54:31 2008 +0200
+++ b/gen/toir.cpp	Thu Jun 19 17:30:32 2008 +0200
@@ -124,7 +124,7 @@
     else if (TypedefDeclaration* tdef = declaration->isTypedefDeclaration())
     {
         Logger::println("TypedefDeclaration");
-        tdef->type->getTypeInfo(NULL);
+        DtoTypeInfoOf(tdef->type, false);
     }
     // attribute declaration
     else if (AttribDeclaration* a = declaration->isAttribDeclaration())
@@ -287,12 +287,9 @@
     }
     else if (TypeInfoDeclaration* ti = var->isTypeInfoDeclaration())
     {
-        DtoForceDeclareDsymbol(ti);
-        assert(ti->ir.getIrValue());
         const LLType* vartype = DtoType(type);
-        LLConstant* m = isaConstant(ti->ir.getIrValue());
-        assert(m);
-        if (ti->ir.getIrValue()->getType() != getPtrToType(vartype))
+        LLConstant* m = DtoTypeInfoOf(ti->tinfo, false);
+        if (m->getType() != getPtrToType(vartype))
             m = llvm::ConstantExpr::getBitCast(m, vartype);
         return m;
     }
@@ -1512,8 +1509,7 @@
         arrptr = DtoGEP(l->getRVal(), zero, r->getRVal());
     }
     else if (e1type->ty == Tarray) {
-        arrptr = DtoGEP(l->getRVal(),zero,one);
-        arrptr = DtoLoad(arrptr);
+        arrptr = DtoArrayPtr(l);
         arrptr = DtoGEP1(arrptr,r->getRVal());
     }
     else if (e1type->ty == Taarray) {
@@ -1982,10 +1978,9 @@
         }
         else if (DVarValue* vv = dval->isVar()) {
             if (vv->var && vv->var->onstack) {
-                if (tc->sym->dtors.dim > 0) {
+                if (tc->sym->dtors.dim > 0)
                     DtoFinalizeClass(dval->getRVal());
-                    onstack = true;
-                }
+                onstack = true;
             }
         }
         if (!onstack) {
@@ -2496,29 +2491,6 @@
     {
         return DtoCatArrayElement(type, e1, e2);
     }
-
-    /*
-    IRExp* ex = p->topexp();
-    if (ex && ex->e2 == this) {
-        assert(ex->v);
-        if (arrNarr)
-            DtoCatArrays(ex->v->getLVal(),e1,e2);
-        else
-            DtoCatArrayElement(ex->v->getLVal(),e1,e2);
-        return new DImValue(type, ex->v->getLVal(), true);
-    }
-    else {
-        assert(t->ty == Tarray);
-        const LLType* arrty = DtoType(t);
-        LLValue* dst = new llvm::AllocaInst(arrty, "tmpmem", p->topallocapoint());
-        if (arrNarr)
-            DtoCatAr
-            DtoCatArrays(dst,e1,e2);
-        else
-            DtoCatArrayElement(dst,e1,e2);
-        return new DVarValue(type, dst, true);
-    }
-    */
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////