mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-06 06:20:04 +02:00
Added initial support for raw LLVM inline asm.
This commit is contained in:
38
dmd/attrib.c
38
dmd/attrib.c
@@ -987,6 +987,17 @@ void PragmaDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
}
|
||||
|
||||
// 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 @@ void PragmaDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -1863,12 +1863,8 @@ struct GEPExp : UnaExp
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
Expression *toLvalue(Scope *sc, Expression *e);
|
||||
|
||||
#if IN_DMD
|
||||
elem *toElem(IRState *irs);
|
||||
#elif IN_LLVM
|
||||
DValue* toElem(IRState* irs);
|
||||
llvm::Constant *toConstElem(IRState *irs);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -225,6 +225,7 @@ Msgtable msgtable[] =
|
||||
{ "vaarg", "va_arg" },
|
||||
{ "ldc" },
|
||||
{ "allow_inline" },
|
||||
{ "llvm_inline_asm" },
|
||||
|
||||
// For special functions
|
||||
{ "tohash", "toHash" },
|
||||
|
||||
Reference in New Issue
Block a user