Mercurial > projects > ldc
comparison gen/functions.cpp @ 1209:8699c450a1a0
Implement -nested-ctx=hybrid
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 12 Apr 2009 20:23:00 +0200 |
parents | 83d3b25c2213 |
children | 00a84912c689 79758fd2f48a |
comparison
equal
deleted
inserted
replaced
1208:2a37f4745ddd | 1209:8699c450a1a0 |
---|---|
671 irfunction->allocapoint = allocaPoint; | 671 irfunction->allocapoint = allocaPoint; |
672 | 672 |
673 // debug info - after all allocas, but before any llvm.dbg.declare etc | 673 // debug info - after all allocas, but before any llvm.dbg.declare etc |
674 if (global.params.symdebug) DtoDwarfFuncStart(fd); | 674 if (global.params.symdebug) DtoDwarfFuncStart(fd); |
675 | 675 |
676 // need result variable? | |
677 if (fd->vresult) { | |
678 Logger::println("vresult value"); | |
679 fd->vresult->ir.irLocal = new IrLocal(fd->vresult); | |
680 fd->vresult->ir.irLocal->value = DtoAlloca(DtoType(fd->vresult->type), "function_vresult"); | |
681 } | |
682 | |
683 // this hack makes sure the frame pointer elimination optimization is disabled. | 676 // this hack makes sure the frame pointer elimination optimization is disabled. |
684 // this this eliminates a bunch of inline asm related issues. | 677 // this this eliminates a bunch of inline asm related issues. |
685 if (fd->inlineAsm) | 678 if (fd->inlineAsm) |
686 { | 679 { |
687 // emit a call to llvm_eh_unwind_init | 680 // emit a call to llvm_eh_unwind_init |
776 fd->nestedVars.insert(fd->vresult); | 769 fd->nestedVars.insert(fd->vresult); |
777 } | 770 } |
778 | 771 |
779 DtoCreateNestedContext(fd); | 772 DtoCreateNestedContext(fd); |
780 | 773 |
774 #if DMDV2 | |
775 if (fd->vresult && fd->vresult->nestedrefs.dim) | |
776 #else | |
777 if (fd->vresult && fd->vresult->nestedref) | |
778 #endif | |
779 { | |
780 DtoNestedInit(fd->vresult); | |
781 } else if (fd->vresult) { | |
782 fd->vresult->ir.irLocal = new IrLocal(fd->vresult); | |
783 fd->vresult->ir.irLocal->value = DtoAlloca(DtoType(fd->vresult->type), fd->vresult->toChars()); | |
784 } | |
785 | |
781 // copy _argptr and _arguments to a memory location | 786 // copy _argptr and _arguments to a memory location |
782 if (f->linkage == LINKd && f->varargs == 1) | 787 if (f->linkage == LINKd && f->varargs == 1) |
783 { | 788 { |
784 // _argptr | 789 // _argptr |
785 LLValue* argptrmem = DtoAlloca(fd->ir.irFunc->_argptr->getType(), "_argptr_mem"); | 790 LLValue* argptrmem = DtoAlloca(fd->ir.irFunc->_argptr->getType(), "_argptr_mem"); |