comparison gen/toir.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 f528e55fb32f
comparison
equal deleted inserted replaced
1151:3cf0066e6faf 1152:521dd1626d76
194 } 194 }
195 else if (FuncDeclaration* fdecl = var->isFuncDeclaration()) 195 else if (FuncDeclaration* fdecl = var->isFuncDeclaration())
196 { 196 {
197 Logger::println("FuncDeclaration"); 197 Logger::println("FuncDeclaration");
198 LLValue* func = 0; 198 LLValue* func = 0;
199 if (fdecl->llvmInternal != LLVMva_arg) { 199 if (fdecl->llvmInternal == LLVMinline_asm) {
200 error("special ldc inline asm is not a normal function");
201 fatal();
202 }
203 else if (fdecl->llvmInternal != LLVMva_arg) {
200 fdecl->codegen(Type::sir); 204 fdecl->codegen(Type::sir);
201 func = fdecl->ir.irFunc->func; 205 func = fdecl->ir.irFunc->func;
202 } 206 }
203 return new DFuncValue(fdecl, func); 207 return new DFuncValue(fdecl, func);
204 } 208 }
720 724
721 DValue* CallExp::toElem(IRState* p) 725 DValue* CallExp::toElem(IRState* p)
722 { 726 {
723 Logger::print("CallExp::toElem: %s @ %s\n", toChars(), type->toChars()); 727 Logger::print("CallExp::toElem: %s @ %s\n", toChars(), type->toChars());
724 LOG_SCOPE; 728 LOG_SCOPE;
729
730 // handle magic inline asm
731 if (e1->op == TOKvar)
732 {
733 VarExp* ve = (VarExp*)e1;
734 if (FuncDeclaration* fd = ve->var->isFuncDeclaration())
735 {
736 if (fd->llvmInternal == LLVMinline_asm)
737 {
738 return DtoInlineAsmExpr(loc, fd, arguments);
739 }
740 }
741 }
725 742
726 // get the callee value 743 // get the callee value
727 DValue* fnval = e1->toElem(p); 744 DValue* fnval = e1->toElem(p);
728 745
729 // get func value if any 746 // get func value if any