comparison gen/toir.cpp @ 163:a8cd9bc1021a trunk

[svn r179] lots and lots of fixes, much more of tango now compiles/works.
author lindquist
date Mon, 05 May 2008 07:36:29 +0200
parents 1856c62af24b
children a64becf2a702
comparison
equal deleted inserted replaced
162:1856c62af24b 163:a8cd9bc1021a
210 } 210 }
211 // function parameter 211 // function parameter
212 else if (vd->isParameter()) { 212 else if (vd->isParameter()) {
213 Logger::println("function param"); 213 Logger::println("function param");
214 if (!gIR->irDsymbol[vd].getIrValue()) { 214 if (!gIR->irDsymbol[vd].getIrValue()) {
215 assert(0); // should be fixed now
215 // TODO: determine this properly 216 // TODO: determine this properly
216 // this happens when the DMD frontend generates by pointer wrappers for struct opEquals(S) and opCmp(S) 217 // this happens when the DMD frontend generates by pointer wrappers for struct opEquals(S) and opCmp(S)
217 gIR->irDsymbol[vd].getIrValue() = &p->func()->func->getArgumentList().back(); 218 gIR->irDsymbol[vd].getIrValue() = &p->func()->func->getArgumentList().back();
218 } 219 }
219 if (vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type) || llvm::isa<llvm::AllocaInst>(gIR->irDsymbol[vd].getIrValue())) { 220 if (vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type) || llvm::isa<llvm::AllocaInst>(gIR->irDsymbol[vd].getIrValue())) {
228 // take care of forward references of global variables 229 // take care of forward references of global variables
229 if (vd->isDataseg() || (vd->storage_class & STCextern)) { 230 if (vd->isDataseg() || (vd->storage_class & STCextern)) {
230 vd->toObjFile(); 231 vd->toObjFile();
231 DtoConstInitGlobal(vd); 232 DtoConstInitGlobal(vd);
232 } 233 }
233 if (!gIR->irDsymbol[vd].getIrValue() || gIR->irDsymbol[vd].getIrValue()->getType()->isAbstract()) { 234 if (!gIR->irDsymbol[vd].getIrValue() || DtoType(vd->type)->isAbstract()) {
234 Logger::println("global variable not resolved :/ %s", vd->toChars()); 235 Logger::println("global variable not resolved :/ %s", vd->toChars());
236 Logger::cout() << *DtoType(vd->type) << '\n';
235 assert(0); 237 assert(0);
236 } 238 }
237 return new DVarValue(vd, gIR->irDsymbol[vd].getIrValue(), true); 239 return new DVarValue(vd, gIR->irDsymbol[vd].getIrValue(), true);
238 } 240 }
239 } 241 }
1501 } 1503 }
1502 else if (e1type->ty == Tsarray) { 1504 else if (e1type->ty == Tsarray) {
1503 arrptr = DtoGEP(l->getRVal(), zero, r->getRVal(),"tmp",p->scopebb()); 1505 arrptr = DtoGEP(l->getRVal(), zero, r->getRVal(),"tmp",p->scopebb());
1504 } 1506 }
1505 else if (e1type->ty == Tarray) { 1507 else if (e1type->ty == Tarray) {
1506 arrptr = DtoGEP(l->getLVal(),zero,one,"tmp",p->scopebb()); 1508 arrptr = DtoGEP(l->getRVal(),zero,one,"tmp",p->scopebb());
1507 arrptr = new llvm::LoadInst(arrptr,"tmp",p->scopebb()); 1509 arrptr = new llvm::LoadInst(arrptr,"tmp",p->scopebb());
1508 arrptr = new llvm::GetElementPtrInst(arrptr,r->getRVal(),"tmp",p->scopebb()); 1510 arrptr = new llvm::GetElementPtrInst(arrptr,r->getRVal(),"tmp",p->scopebb());
1509 } 1511 }
1510 else if (e1type->ty == Taarray) { 1512 else if (e1type->ty == Taarray) {
1511 return DtoAAIndex(type, l, r); 1513 return DtoAAIndex(type, l, r);