Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 1509:e07f15c4ab4d
Automated merge with http://hg.dsource.org/projects/ldc
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 20 Jun 2009 19:12:04 +0200 |
parents | 855f188aab7a e1e93343fc11 |
children | 0f08b145b878 |
comparison
equal
deleted
inserted
replaced
1507:f86fd3b77285 | 1509:e07f15c4ab4d |
---|---|
209 error(loc, "cannot goto to label %s inside an inline asm block", target->toChars()); | 209 error(loc, "cannot goto to label %s inside an inline asm block", target->toChars()); |
210 fatal(); | 210 fatal(); |
211 } | 211 } |
212 | 212 |
213 // find target basic block | 213 // find target basic block |
214 std::string labelname = gIR->func()->getScopedLabelName(target->toChars()); | 214 std::string labelname = gIR->func()->gen->getScopedLabelName(target->toChars()); |
215 llvm::BasicBlock*& targetBB = gIR->func()->labelToBB[labelname]; | 215 llvm::BasicBlock*& targetBB = gIR->func()->gen->labelToBB[labelname]; |
216 if (targetBB == NULL) | 216 if (targetBB == NULL) |
217 targetBB = llvm::BasicBlock::Create("label_" + labelname, gIR->topfunc()); | 217 targetBB = llvm::BasicBlock::Create("label_" + labelname, gIR->topfunc()); |
218 | 218 |
219 // emit code for finallys between goto and label | 219 // emit code for finallys between goto and label |
220 DtoEnclosingHandlers(loc, lblstmt); | 220 DtoEnclosingHandlers(loc, lblstmt); |
254 | 254 |
255 void EnclosingTryFinally::emitCode(IRState * p) | 255 void EnclosingTryFinally::emitCode(IRState * p) |
256 { | 256 { |
257 if (tf->finalbody) | 257 if (tf->finalbody) |
258 { | 258 { |
259 llvm::BasicBlock* oldpad = p->func()->landingPad; | 259 llvm::BasicBlock* oldpad = p->func()->gen->landingPad; |
260 p->func()->landingPad = landingPad; | 260 p->func()->gen->landingPad = landingPad; |
261 tf->finalbody->toIR(p); | 261 tf->finalbody->toIR(p); |
262 p->func()->landingPad = oldpad; | 262 p->func()->gen->landingPad = oldpad; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 //////////////////////////////////////////////////////////////////////////////////////// | 266 //////////////////////////////////////////////////////////////////////////////////////// |
267 | 267 |
272 LabelStatement* lblstmt = dynamic_cast<LabelStatement*>(target); | 272 LabelStatement* lblstmt = dynamic_cast<LabelStatement*>(target); |
273 if (lblstmt) | 273 if (lblstmt) |
274 target = lblstmt->enclosingScopeExit; | 274 target = lblstmt->enclosingScopeExit; |
275 | 275 |
276 // figure out up until what handler we need to emit | 276 // figure out up until what handler we need to emit |
277 IrFunction::TargetScopeVec::reverse_iterator targetit = gIR->func()->targetScopes.rbegin(); | 277 FuncGen::TargetScopeVec::reverse_iterator targetit = gIR->func()->gen->targetScopes.rbegin(); |
278 IrFunction::TargetScopeVec::reverse_iterator it_end = gIR->func()->targetScopes.rend(); | 278 FuncGen::TargetScopeVec::reverse_iterator it_end = gIR->func()->gen->targetScopes.rend(); |
279 while(targetit != it_end) { | 279 while(targetit != it_end) { |
280 if (targetit->s == target) { | 280 if (targetit->s == target) { |
281 break; | 281 break; |
282 } | 282 } |
283 ++targetit; | 283 ++targetit; |
295 // emit code for enclosing handlers | 295 // emit code for enclosing handlers |
296 // | 296 // |
297 | 297 |
298 // since the labelstatements possibly inside are private | 298 // since the labelstatements possibly inside are private |
299 // and might already exist push a label scope | 299 // and might already exist push a label scope |
300 gIR->func()->pushUniqueLabelScope("enclosing"); | 300 gIR->func()->gen->pushUniqueLabelScope("enclosing"); |
301 IrFunction::TargetScopeVec::reverse_iterator it = gIR->func()->targetScopes.rbegin(); | 301 FuncGen::TargetScopeVec::reverse_iterator it = gIR->func()->gen->targetScopes.rbegin(); |
302 while (it != targetit) { | 302 while (it != targetit) { |
303 if (it->enclosinghandler) | 303 if (it->enclosinghandler) |
304 it->enclosinghandler->emitCode(gIR); | 304 it->enclosinghandler->emitCode(gIR); |
305 ++it; | 305 ++it; |
306 } | 306 } |
307 gIR->func()->popLabelScope(); | 307 gIR->func()->gen->popLabelScope(); |
308 } | 308 } |
309 | 309 |
310 /****************************************************************************************/ | 310 /****************************************************************************************/ |
311 /*//////////////////////////////////////////////////////////////////////////////////////// | 311 /*//////////////////////////////////////////////////////////////////////////////////////// |
312 // SYNCHRONIZED SECTION HELPERS | 312 // SYNCHRONIZED SECTION HELPERS |