comparison gen/tocall.cpp @ 939:cac9895be400

Automated merge with http://hg.dsource.org/projects/ldc
author Christian Kamm <kamm incasoftware de>
date Wed, 04 Feb 2009 18:39:39 +0100
parents d3a6f1a96731 a904cc9bc064
children 03d7c4aac654
comparison
equal deleted inserted replaced
937:6c09179ebba0 939:cac9895be400
371 Argument* fnarg = Argument::getNth(tf->parameters, i); 371 Argument* fnarg = Argument::getNth(tf->parameters, i);
372 assert(fnarg); 372 assert(fnarg);
373 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); 373 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
374 LLValue* arg = argval->getRVal(); 374 LLValue* arg = argval->getRVal();
375 375
376 int j = tf->reverseParams ? beg + n - i - 1 : beg + i;
377
376 // if it's a struct inreg arg, load first to pass as first-class value 378 // if it's a struct inreg arg, load first to pass as first-class value
377 if (tf->structInregArg && i == (tf->reverseParams ? n - 1 : 0)) 379 if (tf->structInregArg && i == (tf->reverseParams ? n - 1 : 0))
378 { 380 {
379 assert(fnarg->llvmAttrs & llvm::Attribute::InReg); 381 assert((fnarg->llvmAttrs & llvm::Attribute::InReg) && isaStruct(tf->structInregArg));
382 arg = DtoBitCast(arg, getPtrToType(callableTy->getParamType(j)));
380 arg = DtoLoad(arg); 383 arg = DtoLoad(arg);
381 } 384 }
382
383 int j = tf->reverseParams ? beg + n - i - 1 : beg + i;
384 385
385 // parameter type mismatch, this is hard to get rid of 386 // parameter type mismatch, this is hard to get rid of
386 if (arg->getType() != callableTy->getParamType(j)) 387 if (arg->getType() != callableTy->getParamType(j))
387 { 388 {
388 #if 0 389 #if 0