Mercurial > projects > ldc
diff dmd/attrib.c @ 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 | dbe4af57b240 |
children | 4454126b4345 |
line wrap: on
line diff
--- a/dmd/attrib.c Sat Mar 28 05:00:43 2009 +0100 +++ b/dmd/attrib.c Sat Mar 28 06:32:06 2009 +0100 @@ -987,6 +987,17 @@ } } + // pragma(llvm_inline_asm) { templdecl(s) } + else if (ident == Id::llvm_inline_asm) + { + if (args && args->dim > 0) + { + error("takes no parameters"); + fatal(); + } + llvm_internal = LLVMinline_asm; + } + #endif // LDC else if (ignoreUnsupportedPragmas) @@ -1116,6 +1127,33 @@ } break; + case LLVMinline_asm: + if (TemplateDeclaration* td = s->isTemplateDeclaration()) + { + if (td->parameters->dim != 0) + { + error("the '%s' pragma template must have exactly zero template parameters", ident->toChars()); + fatal(); + } + else if (!td->onemember) + { + error("the '%s' pragma template must have exactly one member", ident->toChars()); + fatal(); + } + else if (td->overnext || td->overroot) + { + error("the '%s' pragma template must not be overloaded", ident->toChars()); + fatal(); + } + td->llvmInternal = llvm_internal; + } + else + { + error("the '%s' pragma is only allowed on template declarations", ident->toChars()); + fatal(); + } + break; + default: warning("the LDC specific pragma '%s' is not yet implemented, ignoring", ident->toChars()); }