Fixed issue with internal real representation, incorrect for non x86-32 architectures.

Cleaned up CallExp::toElem, moved implementation to tocall.cpp providing a single procedure to call arbitrary D functions fairly easily.
This commit is contained in:
Tomas Lindquist Olsen
2008-07-28 02:11:34 +02:00
parent 8485be7238
commit 8c98499193
7 changed files with 392 additions and 392 deletions

View File

@@ -791,20 +791,22 @@ DValue* DtoNewClass(TypeClass* tc, NewExp* newexp)
LLValue* mem;
if (newexp->onstack)
{
mem = new llvm::AllocaInst(DtoType(tc)->getContainedType(0), "newclass_alloca", gIR->topallocapoint());
mem = new llvm::AllocaInst(DtoType(tc)->getContainedType(0), ".newclass_alloca", gIR->topallocapoint());
}
// custom allocator
else if (newexp->allocator)
{
DValue* res = DtoCallDFunc(newexp->allocator, newexp->newargs);
mem = DtoBitCast(res->getRVal(), DtoType(tc), "newclass_custom");
DtoForceDeclareDsymbol(newexp->allocator);
DFuncValue dfn(newexp->allocator, newexp->allocator->ir.irFunc->func);
DValue* res = DtoCallFunction(NULL, &dfn, newexp->newargs);
mem = DtoBitCast(res->getRVal(), DtoType(tc), ".newclass_custom");
}
// default allocator
else
{
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_newclass");
mem = gIR->CreateCallOrInvoke(fn, tc->sym->ir.irStruct->classInfo, "newclass_gc_alloc")->get();
mem = DtoBitCast(mem, DtoType(tc), "newclass_gc");
mem = gIR->CreateCallOrInvoke(fn, tc->sym->ir.irStruct->classInfo, ".newclass_gc_alloc")->get();
mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc");
}
// init
@@ -848,7 +850,9 @@ DValue* DtoNewClass(TypeClass* tc, NewExp* newexp)
if (newexp->member)
{
assert(newexp->arguments != NULL);
return DtoCallDFunc(newexp->member, newexp->arguments, tc, mem);
DtoForceDeclareDsymbol(newexp->member);
DFuncValue dfn(newexp->member, newexp->member->ir.irFunc->func, mem);
return DtoCallFunction(tc, &dfn, newexp->arguments);
}
// return default constructed class