Mercurial > projects > ldc
diff gen/toir.cpp @ 378:d8234836b40f
Get rid of runTimeHack and instead add proper argument info to the frontend
declatation.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 22 Jul 2008 19:24:40 +0200 |
parents | 519adb3128b1 |
children | d632801b15f0 |
line wrap: on
line diff
--- a/gen/toir.cpp Mon Jul 21 20:36:03 2008 +0200 +++ b/gen/toir.cpp Tue Jul 22 19:24:40 2008 +0200 @@ -1001,16 +1001,6 @@ // TODO: use sret param attr if (retinptr) { llargs[j] = new llvm::AllocaInst(argiter->get()->getContainedType(0),"rettmp",p->topallocapoint()); - - if (dfn && dfn->func && dfn->func->runTimeHack) { - const LLType* rettype = getPtrToType(DtoType(type)); - if (llargs[j]->getType() != llfnty->getParamType(j)) { - Logger::println("llvmRunTimeHack==true - force casting return value param"); - Logger::cout() << "casting: " << *llargs[j] << " to type: " << *llfnty->getParamType(j) << '\n'; - llargs[j] = DtoBitCast(llargs[j], llfnty->getParamType(j)); - } - } - ++j; ++argiter; } @@ -1164,24 +1154,6 @@ if (fnarg && fnarg->llvmByVal) palist = palist.addAttr(j+1, llvm::ParamAttr::ByVal); - - // this hack is necessary :/ - // thing is DMD doesn't create correct signatures for the DMD generated calls to the runtime. - // only the return type is right, no arguments (parameters==NULL) ... - if (dfn && dfn->func && dfn->func->runTimeHack) { - llvm::Function* fn = dfn->func->ir.irFunc->func; - assert(fn); - if (fn->getParamAttrs().paramHasAttr(j+1, llvm::ParamAttr::ByVal)) - palist = palist.addAttr(j+1, llvm::ParamAttr::ByVal); - - if (llfnty->getParamType(j) != NULL) { - if (llargs[j]->getType() != llfnty->getParamType(j)) { - Logger::println("llvmRunTimeHack==true - force casting argument"); - Logger::cout() << "casting: " << *llargs[j] << " to type: " << *llfnty->getParamType(j) << '\n'; - llargs[j] = DtoBitCast(llargs[j], llfnty->getParamType(j)); - } - } - } } } @@ -1205,15 +1177,6 @@ LLValue* retllval = (retinptr) ? llargs[0] : call->get(); - if (retinptr && dfn && dfn->func && dfn->func->runTimeHack) { - const LLType* rettype = getPtrToType(DtoType(type)); - if (retllval->getType() != rettype) { - Logger::println("llvmRunTimeHack==true - force casting return value"); - Logger::cout() << "from: " << *retllval->getType() << " to: " << *rettype << '\n'; - retllval = DtoBitCast(retllval, rettype); - } - } - // set calling convention if (dfn && dfn->func) { int li = dfn->func->llvmInternal;