Work on support for variadic arguments. Updated headers in druntime/import.

This commit is contained in:
Alexey Prokhin
2011-01-02 19:14:52 +03:00
parent 8a49067776
commit 47239d9058
2 changed files with 4095 additions and 77 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -835,9 +835,17 @@ DValue* CallExp::toElem(IRState* p)
if (fndecl->llvmInternal == LLVMva_start) {
// llvm doesn't need the second param hence the override
Expression* exp = (Expression*)arguments->data[0];
DValue* expv = exp->toElem(p);
LLValue* arg = DtoBitCast(expv->getLVal(), getVoidPtrType());
return new DImValue(type, gIR->ir->CreateCall(GET_INTRINSIC_DECL(vastart), arg, ""));
LLValue* arg = exp->toElem(p)->getLVal();
#if DMDV2
if (LLValue *argptr = gIR->func()->_argptr) {
DtoStore(DtoLoad(argptr), DtoBitCast(arg, getPtrToType(getVoidPtrType())));
return new DImValue(type, arg);
} else
#endif
{
arg = DtoBitCast(arg, getVoidPtrType());
return new DImValue(type, gIR->ir->CreateCall(GET_INTRINSIC_DECL(vastart), arg, ""));
}
}
// va_arg instruction
else if (fndecl->llvmInternal == LLVMva_arg) {