Mercurial > projects > ldc
diff gen/tocall.cpp @ 930:7985bb036db4
Follow the D ABI and pass the last arg in a register if it is a struct that fits.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 03 Feb 2009 21:46:46 +0100 |
parents | 162a0502a6b9 |
children | d3a6f1a96731 a904cc9bc064 |
line wrap: on
line diff
--- a/gen/tocall.cpp Tue Feb 03 18:11:39 2009 +0100 +++ b/gen/tocall.cpp Tue Feb 03 21:46:46 2009 +0100 @@ -370,6 +370,13 @@ DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]); LLValue* arg = argval->getRVal(); + // 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); + arg = DtoLoad(arg); + } + int j = tf->reverseParams ? beg + n - i - 1 : beg + i; // parameter type mismatch, this is hard to get rid of @@ -395,7 +402,7 @@ // reverse the relevant params as well as the param attrs if (tf->reverseParams) { - std::reverse(args.begin() + tf->reverseIndex, args.end()); + std::reverse(args.begin() + tf->firstRealArg, args.end()); std::reverse(attrptr.begin(), attrptr.end()); }