Added initial support for raw LLVM inline asm.

This commit is contained in:
Tomas Lindquist Olsen
2009-03-28 06:32:06 +01:00
parent 36f6ebc77f
commit 99b863e2b1
9 changed files with 163 additions and 6 deletions
+18 -1
View File
@@ -196,7 +196,11 @@ DValue* VarExp::toElem(IRState* p)
{
Logger::println("FuncDeclaration");
LLValue* func = 0;
if (fdecl->llvmInternal != LLVMva_arg) {
if (fdecl->llvmInternal == LLVMinline_asm) {
error("special ldc inline asm is not a normal function");
fatal();
}
else if (fdecl->llvmInternal != LLVMva_arg) {
fdecl->codegen(Type::sir);
func = fdecl->ir.irFunc->func;
}
@@ -723,6 +727,19 @@ DValue* CallExp::toElem(IRState* p)
Logger::print("CallExp::toElem: %s @ %s\n", toChars(), type->toChars());
LOG_SCOPE;
// handle magic inline asm
if (e1->op == TOKvar)
{
VarExp* ve = (VarExp*)e1;
if (FuncDeclaration* fd = ve->var->isFuncDeclaration())
{
if (fd->llvmInternal == LLVMinline_asm)
{
return DtoInlineAsmExpr(loc, fd, arguments);
}
}
}
// get the callee value
DValue* fnval = e1->toElem(p);