comparison gen/functions.cpp @ 452:30ef3c7bddca

Fixed problems with nested 'this'. Fixes #39 . Fixed problem with debug info order of intrinsic calls (func.start after declare).
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sat, 02 Aug 2008 00:50:39 +0200
parents 56265fa07c7d
children 283d113d4753
comparison
equal deleted inserted replaced
451:4d9108f1fbf4 452:30ef3c7bddca
557 557
558 // create alloca point 558 // create alloca point
559 llvm::Instruction* allocaPoint = new llvm::AllocaInst(LLType::Int32Ty, "alloca point", beginbb); 559 llvm::Instruction* allocaPoint = new llvm::AllocaInst(LLType::Int32Ty, "alloca point", beginbb);
560 gIR->func()->allocapoint = allocaPoint; 560 gIR->func()->allocapoint = allocaPoint;
561 561
562 // debug info - after all allocas, but before any llvm.dbg.declare etc
563 if (global.params.symdebug) DtoDwarfFuncStart(fd);
564
562 // need result variable? (not nested) 565 // need result variable? (not nested)
563 if (fd->vresult && !fd->vresult->nestedref) { 566 if (fd->vresult && !fd->vresult->nestedref) {
564 Logger::println("non-nested vresult value"); 567 Logger::println("non-nested vresult value");
565 fd->vresult->ir.irLocal = new IrLocal(fd->vresult); 568 fd->vresult->ir.irLocal = new IrLocal(fd->vresult);
566 fd->vresult->ir.irLocal->value = new llvm::AllocaInst(DtoType(fd->vresult->type),"function_vresult",allocaPoint); 569 fd->vresult->ir.irLocal->value = new llvm::AllocaInst(DtoType(fd->vresult->type),"function_vresult",allocaPoint);
622 625
623 gIR->ir->CreateStore(a,v); 626 gIR->ir->CreateStore(a,v);
624 vd->ir.irLocal->value = v; 627 vd->ir.irLocal->value = v;
625 } 628 }
626 } 629 }
627
628 // debug info
629 if (global.params.symdebug) DtoDwarfFuncStart(fd);
630 630
631 LLValue* parentNested = NULL; 631 LLValue* parentNested = NULL;
632 if (FuncDeclaration* fd2 = fd->toParent2()->isFuncDeclaration()) { 632 if (FuncDeclaration* fd2 = fd->toParent2()->isFuncDeclaration()) {
633 if (!fd->isStatic()) // huh? 633 if (!fd->isStatic()) // huh?
634 parentNested = fd2->ir.irFunc->nestedVar; 634 parentNested = fd2->ir.irFunc->nestedVar;