mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +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
|
@ -1033,16 +1033,20 @@ void LabelStatement::toIR(IRState* p)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string labelname = ident->toChars();
|
||||
llvm::BasicBlock*& labelBB = p->func()->labelToBB[labelname];
|
||||
|
||||
llvm::BasicBlock* oldend = gIR->scopeend();
|
||||
if (llvmBB)
|
||||
llvmBB->moveBefore(oldend);
|
||||
else
|
||||
llvmBB = llvm::BasicBlock::Create("label", p->topfunc(), oldend);
|
||||
if (labelBB != NULL) {
|
||||
labelBB->moveBefore(oldend);
|
||||
} else {
|
||||
labelBB = llvm::BasicBlock::Create("label", p->topfunc(), oldend);
|
||||
}
|
||||
|
||||
if (!p->scopereturned())
|
||||
llvm::BranchInst::Create(llvmBB, p->scopebb());
|
||||
llvm::BranchInst::Create(labelBB, p->scopebb());
|
||||
|
||||
p->scope() = IRScope(llvmBB,oldend);
|
||||
p->scope() = IRScope(labelBB,oldend);
|
||||
}
|
||||
|
||||
if (statement)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue