mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03: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:
parent
80ba763fda
commit
7e7ac3a6f7
5 changed files with 20 additions and 11 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue