diff gen/functions.cpp @ 1152:521dd1626d76

Added initial support for raw LLVM inline asm.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Sat, 28 Mar 2009 06:32:06 +0100
parents 3cf0066e6faf
children ba9d6292572a
line wrap: on
line diff
--- a/gen/functions.cpp	Sat Mar 28 05:00:43 2009 +0100
+++ b/gen/functions.cpp	Sat Mar 28 06:32:06 2009 +0100
@@ -332,6 +332,22 @@
             fdecl->linkage = LINKintrinsic;
             ((TypeFunction*)fdecl->type)->linkage = LINKintrinsic;
         }
+        else if (tempdecl->llvmInternal == LLVMinline_asm)
+        {
+            Logger::println("magic inline asm found");
+            TypeFunction* tf = (TypeFunction*)fdecl->type;
+            if (tf->varargs != 1 || (fdecl->parameters && fdecl->parameters->dim != 0))
+            {
+                error("invalid __asm declaration, must be a D style variadic with no explicit parameters");
+                fatal();
+            }
+            fdecl->llvmInternal = LLVMinline_asm;
+            fdecl->ir.resolved = true;
+            fdecl->ir.declared = true;
+            fdecl->ir.initialized = true;
+            fdecl->ir.defined = true;
+            return; // this gets mapped to a special inline asm call, no point in going on.
+        }
     }
 
     DtoFunctionType(fdecl);