comparison gen/tocall.cpp @ 938:a904cc9bc064

Convert struct arg to integer when passing inreg to make sure LLVM doesn't ignore the attribute!
author Christian Kamm <kamm incasoftware de>
date Wed, 04 Feb 2009 18:39:33 +0100
parents 7985bb036db4
children cac9895be400
comparison
equal deleted inserted replaced
931:b6647328d11e 938:a904cc9bc064
368 Argument* fnarg = Argument::getNth(tf->parameters, i); 368 Argument* fnarg = Argument::getNth(tf->parameters, i);
369 assert(fnarg); 369 assert(fnarg);
370 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); 370 DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
371 LLValue* arg = argval->getRVal(); 371 LLValue* arg = argval->getRVal();
372 372
373 int j = tf->reverseParams ? beg + n - i - 1 : beg + i;
374
373 // if it's a struct inreg arg, load first to pass as first-class value 375 // if it's a struct inreg arg, load first to pass as first-class value
374 if (tf->structInregArg && i == (tf->reverseParams ? n - 1 : 0)) 376 if (tf->structInregArg && i == (tf->reverseParams ? n - 1 : 0))
375 { 377 {
376 assert(fnarg->llvmAttrs & llvm::Attribute::InReg); 378 assert((fnarg->llvmAttrs & llvm::Attribute::InReg) && isaStruct(tf->structInregArg));
379 arg = DtoBitCast(arg, getPtrToType(callableTy->getParamType(j)));
377 arg = DtoLoad(arg); 380 arg = DtoLoad(arg);
378 } 381 }
379
380 int j = tf->reverseParams ? beg + n - i - 1 : beg + i;
381 382
382 // parameter type mismatch, this is hard to get rid of 383 // parameter type mismatch, this is hard to get rid of
383 if (arg->getType() != callableTy->getParamType(j)) 384 if (arg->getType() != callableTy->getParamType(j))
384 { 385 {
385 #if 0 386 #if 0