Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.

This commit is contained in:
Tomas Lindquist Olsen
2009-03-04 17:24:25 +01:00
parent ca41cb29d9
commit 65ba1d4d88
7 changed files with 112 additions and 61 deletions

View File

@@ -68,6 +68,8 @@ void ReturnStatement::toIR(IRState* p)
// emit dbg line
if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum);
// FIXME: is there ever a case where a sret return needs to be rewritten for the ABI?
// get return pointer
DValue* rvar = new DVarValue(f->type->next, f->decl->ir.irFunc->retArg);
DValue* e = exp->toElem(p);
@@ -88,12 +90,9 @@ void ReturnStatement::toIR(IRState* p)
else
{
if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum);
DValue* e = exp->toElem(p);
LLValue* v = e->getRVal();
delete e;
// do abi specific transformations on the return value
v = p->func()->type->fty->putRet(exp->type, v);
LLValue* v = p->func()->type->fty->putRet(exp->type, exp->toElem(p));
if (Logger::enabled())
Logger::cout() << "return value is '" <<*v << "'\n";