diff gen/asmstmt.cpp @ 237:a168a2c3ea48 trunk

[svn r253] Removed -inlineasm option. inline asm is now enabled by default unless the new -noasm option is passed. Tried adding a stack trace print when compiler crashes, not sure it's working though. Changed data layouts to match that of llvm-gcc. Fixed casting function pointers. Added support checks in AsmStatement.
author lindquist
date Sun, 08 Jun 2008 19:09:24 +0200
parents 9760f54af0b7
children fa691b1c0498
line wrap: on
line diff
--- a/gen/asmstmt.cpp	Sun Jun 08 18:20:48 2008 +0200
+++ b/gen/asmstmt.cpp	Sun Jun 08 19:09:24 2008 +0200
@@ -198,7 +198,20 @@
 
 Statement *AsmStatement::semantic(Scope *sc)
 {
-    
+    bool err = false;
+    if (global.params.cpu != ARCHx86)
+    {
+        error("inline asm is not supported for the \"%s\" architecture", global.params.llvmArch);
+        err = true;
+    }
+    if (!global.params.useInlineAsm)
+    {
+        error("inline asm is not allowed when the -noasm switch is used");
+        err = true;
+    }
+    if (err)
+        fatal();
+
     sc->func->inlineAsm = 1;
     sc->func->inlineStatus = ILSno; // %% not sure
     // %% need to set DECL_UNINLINABLE too?
@@ -262,8 +275,6 @@
 	LLValue* arg_val = 0;
 	std::string cns;
 
-std::cout << std::endl;
-
 	switch (arg->type) {
 	case Arg_Integer:
 	    arg_val = arg->expr->toElem(irs)->getRVal();
@@ -379,7 +390,7 @@
 	++p;
     }
 
-    printf("final: %.*s\n", code->insnTemplateLen, code->insnTemplate);
+    Logger::println("final asm: %.*s", code->insnTemplateLen, code->insnTemplate);
 
     std::string insnt(code->insnTemplate, code->insnTemplateLen);