diff 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
line wrap: on
line diff
--- a/gen/functions.cpp	Sun Apr 12 16:22:21 2009 +0200
+++ b/gen/functions.cpp	Sun Apr 12 20:23:00 2009 +0200
@@ -673,13 +673,6 @@
     // debug info - after all allocas, but before any llvm.dbg.declare etc
     if (global.params.symdebug) DtoDwarfFuncStart(fd);
 
-    // need result variable?
-    if (fd->vresult) {
-        Logger::println("vresult value");
-        fd->vresult->ir.irLocal = new IrLocal(fd->vresult);
-        fd->vresult->ir.irLocal->value = DtoAlloca(DtoType(fd->vresult->type), "function_vresult");
-    }
-    
     // this hack makes sure the frame pointer elimination optimization is disabled.
     // this this eliminates a bunch of inline asm related issues.
     if (fd->inlineAsm)
@@ -778,6 +771,18 @@
 
     DtoCreateNestedContext(fd);
 
+#if DMDV2
+    if (fd->vresult && fd->vresult->nestedrefs.dim)
+#else
+    if (fd->vresult && fd->vresult->nestedref)
+#endif
+    {
+        DtoNestedInit(fd->vresult);
+    } else if (fd->vresult) {
+        fd->vresult->ir.irLocal = new IrLocal(fd->vresult);
+        fd->vresult->ir.irLocal->value = DtoAlloca(DtoType(fd->vresult->type), fd->vresult->toChars());
+    }
+    
     // copy _argptr and _arguments to a memory location
     if (f->linkage == LINKd && f->varargs == 1)
     {