Clean up the code generated when jumping out of inline asm and make label names more expressive.

This commit is contained in:
Frits van Bommel
2009-02-18 22:50:22 +01:00
parent e3d6b1c051
commit 8ce2c9773e
3 changed files with 8 additions and 8 deletions

View File

@@ -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 $<<in" << n_goto << ">>, $<<out0>> ; ";
code << fdmangle << '_' << a->isBranchToLabel->string << ":\n\t";
code << "movl $<<in" << n_goto << ">>, $<<out0>>\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");