Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
274:9f228c1e5311 | 275:665b81613475 |
---|---|
122 } | 122 } |
123 // typedef | 123 // typedef |
124 else if (TypedefDeclaration* tdef = declaration->isTypedefDeclaration()) | 124 else if (TypedefDeclaration* tdef = declaration->isTypedefDeclaration()) |
125 { | 125 { |
126 Logger::println("TypedefDeclaration"); | 126 Logger::println("TypedefDeclaration"); |
127 tdef->type->getTypeInfo(NULL); | 127 DtoTypeInfoOf(tdef->type, false); |
128 } | 128 } |
129 // attribute declaration | 129 // attribute declaration |
130 else if (AttribDeclaration* a = declaration->isAttribDeclaration()) | 130 else if (AttribDeclaration* a = declaration->isAttribDeclaration()) |
131 { | 131 { |
132 Logger::println("AttribDeclaration"); | 132 Logger::println("AttribDeclaration"); |
285 assert(ts->sym->ir.irStruct->constInit); | 285 assert(ts->sym->ir.irStruct->constInit); |
286 return ts->sym->ir.irStruct->constInit; | 286 return ts->sym->ir.irStruct->constInit; |
287 } | 287 } |
288 else if (TypeInfoDeclaration* ti = var->isTypeInfoDeclaration()) | 288 else if (TypeInfoDeclaration* ti = var->isTypeInfoDeclaration()) |
289 { | 289 { |
290 DtoForceDeclareDsymbol(ti); | |
291 assert(ti->ir.getIrValue()); | |
292 const LLType* vartype = DtoType(type); | 290 const LLType* vartype = DtoType(type); |
293 LLConstant* m = isaConstant(ti->ir.getIrValue()); | 291 LLConstant* m = DtoTypeInfoOf(ti->tinfo, false); |
294 assert(m); | 292 if (m->getType() != getPtrToType(vartype)) |
295 if (ti->ir.getIrValue()->getType() != getPtrToType(vartype)) | |
296 m = llvm::ConstantExpr::getBitCast(m, vartype); | 293 m = llvm::ConstantExpr::getBitCast(m, vartype); |
297 return m; | 294 return m; |
298 } | 295 } |
299 assert(0 && "Unsupported const VarExp kind"); | 296 assert(0 && "Unsupported const VarExp kind"); |
300 return NULL; | 297 return NULL; |
1510 } | 1507 } |
1511 else if (e1type->ty == Tsarray) { | 1508 else if (e1type->ty == Tsarray) { |
1512 arrptr = DtoGEP(l->getRVal(), zero, r->getRVal()); | 1509 arrptr = DtoGEP(l->getRVal(), zero, r->getRVal()); |
1513 } | 1510 } |
1514 else if (e1type->ty == Tarray) { | 1511 else if (e1type->ty == Tarray) { |
1515 arrptr = DtoGEP(l->getRVal(),zero,one); | 1512 arrptr = DtoArrayPtr(l); |
1516 arrptr = DtoLoad(arrptr); | |
1517 arrptr = DtoGEP1(arrptr,r->getRVal()); | 1513 arrptr = DtoGEP1(arrptr,r->getRVal()); |
1518 } | 1514 } |
1519 else if (e1type->ty == Taarray) { | 1515 else if (e1type->ty == Taarray) { |
1520 return DtoAAIndex(type, l, r); | 1516 return DtoAAIndex(type, l, r); |
1521 } | 1517 } |
1980 DtoDeleteInterface(dval->getRVal()); | 1976 DtoDeleteInterface(dval->getRVal()); |
1981 onstack = true; | 1977 onstack = true; |
1982 } | 1978 } |
1983 else if (DVarValue* vv = dval->isVar()) { | 1979 else if (DVarValue* vv = dval->isVar()) { |
1984 if (vv->var && vv->var->onstack) { | 1980 if (vv->var && vv->var->onstack) { |
1985 if (tc->sym->dtors.dim > 0) { | 1981 if (tc->sym->dtors.dim > 0) |
1986 DtoFinalizeClass(dval->getRVal()); | 1982 DtoFinalizeClass(dval->getRVal()); |
1987 onstack = true; | 1983 onstack = true; |
1988 } | |
1989 } | 1984 } |
1990 } | 1985 } |
1991 if (!onstack) { | 1986 if (!onstack) { |
1992 LLValue* rval = dval->getRVal(); | 1987 LLValue* rval = dval->getRVal(); |
1993 DtoDeleteClass(rval); | 1988 DtoDeleteClass(rval); |
2494 // element ~ array | 2489 // element ~ array |
2495 else | 2490 else |
2496 { | 2491 { |
2497 return DtoCatArrayElement(type, e1, e2); | 2492 return DtoCatArrayElement(type, e1, e2); |
2498 } | 2493 } |
2499 | |
2500 /* | |
2501 IRExp* ex = p->topexp(); | |
2502 if (ex && ex->e2 == this) { | |
2503 assert(ex->v); | |
2504 if (arrNarr) | |
2505 DtoCatArrays(ex->v->getLVal(),e1,e2); | |
2506 else | |
2507 DtoCatArrayElement(ex->v->getLVal(),e1,e2); | |
2508 return new DImValue(type, ex->v->getLVal(), true); | |
2509 } | |
2510 else { | |
2511 assert(t->ty == Tarray); | |
2512 const LLType* arrty = DtoType(t); | |
2513 LLValue* dst = new llvm::AllocaInst(arrty, "tmpmem", p->topallocapoint()); | |
2514 if (arrNarr) | |
2515 DtoCatAr | |
2516 DtoCatArrays(dst,e1,e2); | |
2517 else | |
2518 DtoCatArrayElement(dst,e1,e2); | |
2519 return new DVarValue(type, dst, true); | |
2520 } | |
2521 */ | |
2522 } | 2494 } |
2523 | 2495 |
2524 ////////////////////////////////////////////////////////////////////////////////////////// | 2496 ////////////////////////////////////////////////////////////////////////////////////////// |
2525 | 2497 |
2526 DValue* CatAssignExp::toElem(IRState* p) | 2498 DValue* CatAssignExp::toElem(IRState* p) |