diff ir/irlandingpad.cpp @ 1508:e1e93343fc11

Move function codegen data from IrFunction to new FuncGen. This change reduces memory consumption significantly by releasing the memory held by the STL containers that are now inside FuncGen.
author Christian Kamm <kamm incasoftware de>
date Sat, 20 Jun 2009 19:11:44 +0200
parents 3f5ea912149d
children 7fcb72d518f6
line wrap: on
line diff
--- a/ir/irlandingpad.cpp	Tue Jun 16 23:00:27 2009 +0200
+++ b/ir/irlandingpad.cpp	Sat Jun 20 19:11:44 2009 +0200
@@ -24,7 +24,7 @@
     #endif
             assert(!catchstmt->var->ir.irLocal);
             catchstmt->var->ir.irLocal = new IrLocal(catchstmt->var);
-            LLValue* catch_var = gIR->func()->landingPadInfo.getExceptionStorage();
+            LLValue* catch_var = gIR->func()->gen->landingPadInfo.getExceptionStorage();
             catchstmt->var->ir.irLocal->value = gIR->ir->CreateBitCast(catch_var, getPtrToType(DtoType(catchstmt->var->type)));
         }
 
@@ -32,8 +32,8 @@
         DtoDeclarationExp(catchstmt->var);
 
         // the exception will only be stored in catch_var. copy it over if necessary
-        if(catchstmt->var->ir.irLocal->value != gIR->func()->landingPadInfo.getExceptionStorage()) {
-            LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->landingPadInfo.getExceptionStorage()), DtoType(catchstmt->var->type));
+        if(catchstmt->var->ir.irLocal->value != gIR->func()->gen->landingPadInfo.getExceptionStorage()) {
+            LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->gen->landingPadInfo.getExceptionStorage()), DtoType(catchstmt->var->type));
             DtoStore(exc, catchstmt->var->ir.irLocal->value);
         }
     }
@@ -172,9 +172,9 @@
 
             // since this may be emitted multiple times
             // give the labels a new scope
-            gIR->func()->pushUniqueLabelScope("finally");
+            gIR->func()->gen->pushUniqueLabelScope("finally");
             rit->finallyBody->toIR(gIR);
-            gIR->func()->popLabelScope();
+            gIR->func()->gen->popLabelScope();
         }
         // otherwise it's a catch and we'll add a switch case
         else