Refactoring: Introduce TargetABI::reverseExplicitParams()

This commit is contained in:
Martin Kinkelin 2018-05-30 22:26:25 +02:00
parent 92913d4c08
commit 29d609d63d
13 changed files with 19 additions and 47 deletions

View file

@ -238,6 +238,14 @@ bool TargetABI::canRewriteAsInt(Type *t, bool include64bit) {
//////////////////////////////////////////////////////////////////////////////
bool TargetABI::reverseExplicitParams(TypeFunction *tf) {
// Required by druntime for extern(D), except for `, ...`-style variadics.
return tf->linkage == LINKd && tf->varargs != 1 &&
Parameter::dim(tf->parameters) > 1;
}
//////////////////////////////////////////////////////////////////////////////
void TargetABI::rewriteVarargs(IrFuncTy &fty,
std::vector<IrFuncTyArg *> &args) {
for (auto arg : args) {
@ -355,6 +363,8 @@ struct IntrinsicABI : TargetABI {
bool passByVal(Type *t) override { return false; }
bool reverseExplicitParams(TypeFunction *) override { return false; }
void rewriteArgument(IrFuncTy &fty, IrFuncTyArg &arg) override {
Type *ty = arg.type->toBasetype();
if (ty->ty != Tstruct) {