Mercurial > projects > ddmd
diff dmd/TypeFunction.d @ 95:ae5b11064a9a
beginning of 2.036 branch
author | Trass3r |
---|---|
date | Mon, 30 Aug 2010 23:08:44 +0200 |
parents | 43073c7c7769 |
children | acd69f84627e |
line wrap: on
line diff
--- a/dmd/TypeFunction.d Mon Aug 30 22:50:30 2010 +0200 +++ b/dmd/TypeFunction.d Mon Aug 30 23:08:44 2010 +0200 @@ -653,27 +653,59 @@ RET retStyle() { //printf("TypeFunction.retStyle() %s\n", toChars()); -version (DMDV2) { +version (DMDV2) +{ if (isref) return RET.RETregs; // returns a pointer } Type tn = next.toBasetype(); + Type tns = tn; + ulong sz = tn.size(); - if (tn.ty == TY.Tstruct) +version(SARRAYVALUE) +{ + if (tn.ty == Tsarray) + { + do + { + tns = tns.nextOf().toBasetype(); + } while (tns.ty == Tsarray); + if (tns.ty != Tstruct) + { + if (global.params.isLinux && linkage != LINKd) + {} + else + { + switch (sz) + { case 1: + case 2: + case 4: + case 8: + return RETregs; // return small structs in regs + // (not 3 byte structs!) + default: + break; + } + } + return RETstack; + } + } +} + if (tns.ty == TY.Tstruct) { StructDeclaration sd = (cast(TypeStruct)tn).sym; if (global.params.isLinux && linkage != LINK.LINKd) { ; } -///version (DMDV2) { - else if (sd.dtor || sd.cpctor) { - ; +///version (DMDV2) { // TODO: + else if (sd.dtor || sd.cpctor) + { } ///} else { - switch (cast(int)tn.size()) + switch (sz) { case 1: case 2: