diff --git a/gen/asmstmt.cpp b/gen/asmstmt.cpp index 44a4cac1..08b3d228 100644 --- a/gen/asmstmt.cpp +++ b/gen/asmstmt.cpp @@ -540,7 +540,7 @@ void AsmBlockStatement::toIR(IRState* p) // initialize the setter statement we're going to build IRAsmStmt* outSetterStmt = new IRAsmStmt; - std::string asmGotoEnd = "jmp "+asmGotoEndLabel.str()+" ; "; + std::string asmGotoEnd = "\n\tjmp "+asmGotoEndLabel.str()+"\n"; std::ostringstream code; code << asmGotoEnd; @@ -574,8 +574,8 @@ void AsmBlockStatement::toIR(IRState* p) // provide an in-asm target for the branch and set value Logger::println("statement '%s' references outer label '%s': creating forwarder", a->code.c_str(), a->isBranchToLabel->string); - code << fdmangle << '_' << a->isBranchToLabel->string << ": ; "; - code << "movl $<>, $<> ; "; + code << fdmangle << '_' << a->isBranchToLabel->string << ":\n\t"; + code << "movl $<>, $<>\n"; //FIXME: Store the value -> label mapping somewhere, so it can be referenced later outSetterStmt->in.push_back(DtoConstUint(n_goto)); outSetterStmt->in_c += "i,"; @@ -587,7 +587,7 @@ void AsmBlockStatement::toIR(IRState* p) { // finalize code outSetterStmt->code = code.str(); - outSetterStmt->code += asmGotoEndLabel.str()+": ; "; + outSetterStmt->code += asmGotoEndLabel.str()+":\n"; // create storage for and initialize the temporary jump_target = DtoAlloca(LLType::Int32Ty, "__llvm_jump_target"); diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 70d1e229..76a325ad 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -191,7 +191,7 @@ void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosinghandler, T std::string labelname = gIR->func()->getScopedLabelName(target->toChars()); llvm::BasicBlock*& targetBB = gIR->func()->labelToBB[labelname]; if (targetBB == NULL) - targetBB = llvm::BasicBlock::Create("label", gIR->topfunc()); + targetBB = llvm::BasicBlock::Create("label_" + labelname, gIR->topfunc()); // find finallys between goto and label EnclosingHandler* endfinally = enclosinghandler; diff --git a/gen/statements.cpp b/gen/statements.cpp index 79bfd4a7..cb2f23c4 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -1224,13 +1224,13 @@ void LabelStatement::toIR(IRState* p) llvm::BasicBlock* oldend = gIR->scopeend(); if (labelBB != NULL) { - labelBB->moveBefore(oldend); + labelBB->moveBefore(oldend); } else { - labelBB = llvm::BasicBlock::Create("label", p->topfunc(), oldend); + labelBB = llvm::BasicBlock::Create("label_" + labelname, p->topfunc(), oldend); } if (!p->scopereturned()) - llvm::BranchInst::Create(labelBB, p->scopebb()); + llvm::BranchInst::Create(labelBB, p->scopebb()); p->scope() = IRScope(labelBB,oldend); }