comparison gen/statements.cpp @ 517:9534dbc70a56

Fix continue inside dowhile statements. Fixes: run/do_while_02
author Christian Kamm <kamm incasoftware de>
date Sat, 16 Aug 2008 11:19:34 +0200
parents a34078905d01
children 243485af6523
comparison
equal deleted inserted replaced
516:eada571dc8ff 517:9534dbc70a56
280 DtoDwarfStopPoint(loc.linnum); 280 DtoDwarfStopPoint(loc.linnum);
281 281
282 // create while blocks 282 // create while blocks
283 llvm::BasicBlock* oldend = gIR->scopeend(); 283 llvm::BasicBlock* oldend = gIR->scopeend();
284 llvm::BasicBlock* dowhilebb = llvm::BasicBlock::Create("dowhile", gIR->topfunc(), oldend); 284 llvm::BasicBlock* dowhilebb = llvm::BasicBlock::Create("dowhile", gIR->topfunc(), oldend);
285 llvm::BasicBlock* condbb = llvm::BasicBlock::Create("dowhilecond", gIR->topfunc(), oldend);
285 llvm::BasicBlock* endbb = llvm::BasicBlock::Create("enddowhile", gIR->topfunc(), oldend); 286 llvm::BasicBlock* endbb = llvm::BasicBlock::Create("enddowhile", gIR->topfunc(), oldend);
286 287
287 // move into the while block 288 // move into the while block
288 assert(!gIR->scopereturned()); 289 assert(!gIR->scopereturned());
289 llvm::BranchInst::Create(dowhilebb, gIR->scopebb()); 290 llvm::BranchInst::Create(dowhilebb, gIR->scopebb());
290 291
291 // replace current scope 292 // replace current scope
292 gIR->scope() = IRScope(dowhilebb,endbb); 293 gIR->scope() = IRScope(dowhilebb,condbb);
293 294
294 // do-while body code 295 // do-while body code
295 p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,dowhilebb,endbb)); 296 p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,condbb,endbb));
296 body->toIR(p); 297 body->toIR(p);
297 p->loopbbs.pop_back(); 298 p->loopbbs.pop_back();
299
300 // branch to condition block
301 llvm::BranchInst::Create(condbb, gIR->scopebb());
302 gIR->scope() = IRScope(condbb,endbb);
298 303
299 // create the condition 304 // create the condition
300 DValue* cond_e = condition->toElem(p); 305 DValue* cond_e = condition->toElem(p);
301 LLValue* cond_val = DtoBoolean(loc, cond_e); 306 LLValue* cond_val = DtoBoolean(loc, cond_e);
302 delete cond_e; 307 delete cond_e;