diff gen/asmstmt.cpp @ 980:ae710cba0884

Clean up the code generated when jumping out of inline asm and make label names more expressive.
author Frits van Bommel <fvbommel wxs.nl>
date Wed, 18 Feb 2009 22:50:22 +0100
parents 523bf4f166bc
children 18ad5601dff7
line wrap: on
line diff
--- a/gen/asmstmt.cpp	Wed Feb 18 21:46:14 2009 +0100
+++ b/gen/asmstmt.cpp	Wed Feb 18 22:50:22 2009 +0100
@@ -540,7 +540,7 @@
 
         // 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 @@
 
             // 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 @@
         {
             // 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");