mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-19 18:29:03 +02:00
[svn r374] Move label target basic block from AST to IRFunction. This is a first step to allowing labels to be emitted multiple times. (for instance within finally blocks)
This commit is contained in:
@@ -186,8 +186,11 @@ void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosinghandler)
|
||||
if(lblstmt->asmLabel)
|
||||
error("cannot goto into inline asm block", loc->toChars());
|
||||
|
||||
if (lblstmt->llvmBB == NULL)
|
||||
lblstmt->llvmBB = llvm::BasicBlock::Create("label", gIR->topfunc());
|
||||
// find target basic block
|
||||
std::string labelname = target->toChars();
|
||||
llvm::BasicBlock*& targetBB = gIR->func()->labelToBB[labelname];
|
||||
if (targetBB == NULL)
|
||||
targetBB = llvm::BasicBlock::Create("label", gIR->topfunc());
|
||||
|
||||
// find finallys between goto and label
|
||||
EnclosingHandler* endfinally = enclosinghandler;
|
||||
@@ -202,7 +205,7 @@ void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosinghandler)
|
||||
// emit code for finallys between goto and label
|
||||
DtoEnclosingHandlers(enclosinghandler, endfinally);
|
||||
|
||||
llvm::BranchInst::Create(lblstmt->llvmBB, gIR->scopebb());
|
||||
llvm::BranchInst::Create(targetBB, gIR->scopebb());
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user