comparison gen/functions.cpp @ 254:8187884566fa trunk

[svn r271] Fixed debug info for implicit 'this' param. Fixed debug info for arguments passed byval (ref and out params still missing).
author lindquist
date Thu, 12 Jun 2008 18:04:28 +0200
parents fc9c1a0eabbd
children 8dbddae09152
comparison
equal deleted inserted replaced
253:c6f25edd6ef3 254:8187884566fa
585 Logger::println("non-nested vresult value"); 585 Logger::println("non-nested vresult value");
586 fd->vresult->ir.irLocal = new IrLocal(fd->vresult); 586 fd->vresult->ir.irLocal = new IrLocal(fd->vresult);
587 fd->vresult->ir.irLocal->value = new llvm::AllocaInst(DtoType(fd->vresult->type),"function_vresult",allocaPoint); 587 fd->vresult->ir.irLocal->value = new llvm::AllocaInst(DtoType(fd->vresult->type),"function_vresult",allocaPoint);
588 } 588 }
589 589
590 // give 'this' argument debug info (and storage)
591 if (f->llvmUsesThis && global.params.symdebug)
592 {
593 LLValue** thisvar = &fd->ir.irFunc->thisVar;
594 assert(*thisvar);
595 LLValue* thismem = new llvm::AllocaInst((*thisvar)->getType(), "newthis", allocaPoint);
596 DtoDwarfLocalVariable(thismem, fd->vthis);
597 gIR->ir->CreateStore(*thisvar, thismem);
598 *thisvar = thismem;
599 }
600
590 // give arguments storage 601 // give arguments storage
591 if (fd->parameters) 602 if (fd->parameters)
592 { 603 {
593 size_t n = fd->parameters->dim; 604 size_t n = fd->parameters->dim;
594 for (int i=0; i < n; ++i) 605 for (int i=0; i < n; ++i)
595 { 606 {
596 Dsymbol* argsym = (Dsymbol*)fd->parameters->data[i]; 607 Dsymbol* argsym = (Dsymbol*)fd->parameters->data[i];
597 VarDeclaration* vd = argsym->isVarDeclaration(); 608 VarDeclaration* vd = argsym->isVarDeclaration();
598 assert(vd); 609 assert(vd);
599 610
600 if (!vd->needsStorage || vd->nestedref || vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type)) 611 // FIXME: llvm seems to want an alloca for debug info
612 if (!vd->needsStorage || vd->nestedref || vd->isRef() || vd->isOut())
601 continue; 613 continue;
614 // debug info for normal aggr params seem to work fine
615 else if (DtoIsPassedByRef(vd->type))
616 {
617 if (global.params.symdebug)
618 DtoDwarfLocalVariable(vd->ir.getIrValue(), vd);
619 continue;
620 }
602 621
603 LLValue* a = vd->ir.irLocal->value; 622 LLValue* a = vd->ir.irLocal->value;
604 assert(a); 623 assert(a);
605 std::string s(a->getName()); 624 std::string s(a->getName());
606 Logger::println("giving argument '%s' storage", s.c_str()); 625 Logger::println("giving argument '%s' storage", s.c_str());