Mercurial > projects > ldc
diff gen/toir.cpp @ 1228:79758fd2f48a
Added Doxygen file.
Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Wed, 15 Apr 2009 20:06:25 +0200 |
parents | 50dc0db06238 |
children | 212ec2d9d176 |
line wrap: on
line diff
--- a/gen/toir.cpp Mon Apr 13 17:42:36 2009 +0200 +++ b/gen/toir.cpp Wed Apr 15 20:06:25 2009 +0200 @@ -131,8 +131,7 @@ { Logger::println("ClassInfoDeclaration: %s", cid->cd->toChars()); cid->cd->codegen(Type::sir);; - assert(cid->cd->ir.irStruct->classInfo); - return new DVarValue(type, vd, cid->cd->ir.irStruct->classInfo); + return new DVarValue(type, vd, cid->cd->ir.irStruct->getClassInfoSymbol()); } // nested variable #if DMDV2 @@ -216,8 +215,8 @@ TypeStruct* ts = (TypeStruct*)sdecltype; assert(ts->sym); ts->sym->codegen(Type::sir); - assert(ts->sym->ir.irStruct->init); - return new DVarValue(type, ts->sym->ir.irStruct->init); + + return new DVarValue(type, ts->sym->ir.irStruct->getInitSymbol()); } else { @@ -242,8 +241,8 @@ assert(sdecltype->ty == Tstruct); TypeStruct* ts = (TypeStruct*)sdecltype; ts->sym->codegen(Type::sir); - assert(ts->sym->ir.irStruct->constInit); - return ts->sym->ir.irStruct->constInit; + + return ts->sym->ir.irStruct->getDefaultInit(); } if (TypeInfoDeclaration* ti = var->isTypeInfoDeclaration()) @@ -1134,9 +1133,7 @@ size_t vtblidx = fdecl->vtblIndex; if (Logger::enabled()) Logger::cout() << "vthis: " << *vthis << '\n'; - funcval = vthis; - if (!fdecl->isMember2()->isInterfaceDeclaration()) - funcval = DtoGEP(funcval, zero, zero); + funcval = DtoGEP(vthis, zero, zero); funcval = DtoLoad(funcval); Logger::println("vtblidx = %lu", vtblidx); funcval = DtoGEP(funcval, zero, DtoConstUint(vtblidx), toChars()); @@ -1646,7 +1643,7 @@ else { assert(ts->sym); ts->sym->codegen(Type::sir); - DtoAggrCopy(mem,ts->sym->ir.irStruct->init); + DtoAggrCopy(mem,ts->sym->ir.irStruct->getInitSymbol()); } return new DImValue(type, mem); } @@ -1658,8 +1655,7 @@ DVarValue tmpvar(newtype, mem); // default initialize - // FIXME: should this use DtoConstExpInit instead ? - // or is static arrays the only troublemaker? + // static arrays never appear here, so using the defaultInit is ok! Expression* exp = newtype->defaultInit(loc); DValue* iv = exp->toElem(gIR); DtoAssign(loc, &tmpvar, iv); @@ -2413,7 +2409,8 @@ } // vector of values to build aggregate from - std::vector<LLValue*> values = DtoStructLiteralValues(sd, inits); + std::vector<LLValue*> values;// = DtoStructLiteralValues(sd, inits); + assert(0 && "struct literal exp todo"); // get the struct type from the values size_t n = values.size(); @@ -2462,7 +2459,8 @@ inits[i] = exprs[i]->toConstElem(p); // vector of values to build aggregate from - std::vector<LLValue*> values = DtoStructLiteralValues(sd, inits); + std::vector<LLValue*> values;// = DtoStructLiteralValues(sd, inits); + assert(0 && "struct literal const exp todo"); // we know those values are constants.. cast them std::vector<LLConstant*> constvals(values.size(), NULL);