Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/gen/tocall.cpp Tue Feb 03 21:46:54 2009 +0100 +++ b/gen/tocall.cpp Wed Feb 04 18:39:33 2009 +0100 @@ -370,15 +370,16 @@ DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); LLValue* arg = argval->getRVal(); + int j = tf->reverseParams ? beg + n - i - 1 : beg + i; + // if it's a struct inreg arg, load first to pass as first-class value if (tf->structInregArg && i == (tf->reverseParams ? n - 1 : 0)) { - assert(fnarg->llvmAttrs & llvm::Attribute::InReg); + assert((fnarg->llvmAttrs & llvm::Attribute::InReg) && isaStruct(tf->structInregArg)); + arg = DtoBitCast(arg, getPtrToType(callableTy->getParamType(j))); arg = DtoLoad(arg); } - int j = tf->reverseParams ? beg + n - i - 1 : beg + i; - // parameter type mismatch, this is hard to get rid of if (arg->getType() != callableTy->getParamType(j)) {