comparison 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
comparison
equal deleted inserted replaced
1503:cc5fee7836dc 1508:e1e93343fc11
22 #else 22 #else
23 if(!catchstmt->var->nestedref) { 23 if(!catchstmt->var->nestedref) {
24 #endif 24 #endif
25 assert(!catchstmt->var->ir.irLocal); 25 assert(!catchstmt->var->ir.irLocal);
26 catchstmt->var->ir.irLocal = new IrLocal(catchstmt->var); 26 catchstmt->var->ir.irLocal = new IrLocal(catchstmt->var);
27 LLValue* catch_var = gIR->func()->landingPadInfo.getExceptionStorage(); 27 LLValue* catch_var = gIR->func()->gen->landingPadInfo.getExceptionStorage();
28 catchstmt->var->ir.irLocal->value = gIR->ir->CreateBitCast(catch_var, getPtrToType(DtoType(catchstmt->var->type))); 28 catchstmt->var->ir.irLocal->value = gIR->ir->CreateBitCast(catch_var, getPtrToType(DtoType(catchstmt->var->type)));
29 } 29 }
30 30
31 // this will alloca if we haven't already and take care of nested refs 31 // this will alloca if we haven't already and take care of nested refs
32 DtoDeclarationExp(catchstmt->var); 32 DtoDeclarationExp(catchstmt->var);
33 33
34 // the exception will only be stored in catch_var. copy it over if necessary 34 // the exception will only be stored in catch_var. copy it over if necessary
35 if(catchstmt->var->ir.irLocal->value != gIR->func()->landingPadInfo.getExceptionStorage()) { 35 if(catchstmt->var->ir.irLocal->value != gIR->func()->gen->landingPadInfo.getExceptionStorage()) {
36 LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->landingPadInfo.getExceptionStorage()), DtoType(catchstmt->var->type)); 36 LLValue* exc = gIR->ir->CreateBitCast(DtoLoad(gIR->func()->gen->landingPadInfo.getExceptionStorage()), DtoType(catchstmt->var->type));
37 DtoStore(exc, catchstmt->var->ir.irLocal->value); 37 DtoStore(exc, catchstmt->var->ir.irLocal->value);
38 } 38 }
39 } 39 }
40 40
41 // emit handler, if there is one 41 // emit handler, if there is one
170 if(switchinst) 170 if(switchinst)
171 switchinst = NULL; 171 switchinst = NULL;
172 172
173 // since this may be emitted multiple times 173 // since this may be emitted multiple times
174 // give the labels a new scope 174 // give the labels a new scope
175 gIR->func()->pushUniqueLabelScope("finally"); 175 gIR->func()->gen->pushUniqueLabelScope("finally");
176 rit->finallyBody->toIR(gIR); 176 rit->finallyBody->toIR(gIR);
177 gIR->func()->popLabelScope(); 177 gIR->func()->gen->popLabelScope();
178 } 178 }
179 // otherwise it's a catch and we'll add a switch case 179 // otherwise it's a catch and we'll add a switch case
180 else 180 else
181 { 181 {
182 if(!switchinst) 182 if(!switchinst)