comparison gen/tocall.cpp @ 1042:45af482e3832

Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 04 Mar 2009 17:24:25 +0100
parents 3ead5c40b7d6
children 6bb04dbee21f
comparison
equal deleted inserted replaced
1041:9dca7182aa75 1042:45af482e3832
378 for (int i=0; i<n; i++) 378 for (int i=0; i<n; i++)
379 { 379 {
380 Argument* fnarg = Argument::getNth(tf->parameters, i); 380 Argument* fnarg = Argument::getNth(tf->parameters, i);
381 assert(fnarg); 381 assert(fnarg);
382 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); 382 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
383 LLValue* arg = argval->getRVal(); 383
384 // give the ABI a say
385 LLValue* arg = tf->fty->putParam(argval->getType(), i, argval);
384 386
385 int j = tf->fty->reverseParams ? beg + n - i - 1 : beg + i; 387 int j = tf->fty->reverseParams ? beg + n - i - 1 : beg + i;
386
387 // give the ABI a say
388 arg = tf->fty->putParam(argval->getType(), i, arg);
389 388
390 // parameter type mismatch, this is hard to get rid of 389 // parameter type mismatch, this is hard to get rid of
391 if (arg->getType() != callableTy->getParamType(j)) 390 if (arg->getType() != callableTy->getParamType(j))
392 { 391 {
393 #if 1 392 #if 1
481 } 480 }
482 } 481 }
483 else if (!retinptr) 482 else if (!retinptr)
484 { 483 {
485 // do abi specific return value fixups 484 // do abi specific return value fixups
486 retllval = tf->fty->getRet(tf->next, retllval); 485 DImValue dretval(tf->next, retllval);
486 retllval = tf->fty->getRet(tf->next, &dretval);
487 } 487 }
488 488
489 // repaint the type if necessary 489 // repaint the type if necessary
490 if (resulttype) 490 if (resulttype)
491 { 491 {