Ejemplo n.º 1
0
 // Returns true if the D type is passed byval (the callee getting a pointer
 // to a dedicated hidden copy).
 bool isPassedWithByvalSemantics(Type *t) const {
   return
       // * aggregates which can NOT be rewritten as integers
       //   (size > 8 bytes or not a power of 2)
       (isAggregate(t) && !canRewriteAsInt(t)) ||
       // * 80-bit real and ireal
       (realIs80bits() && (t->ty == Tfloat80 || t->ty == Timaginary80));
 }
Ejemplo n.º 2
0
bool Win64TargetABI::returnInArg(TypeFunction* tf)
{
    if (tf->isref)
        return false;

    Type* rt = tf->next->toBasetype();

    // * let LLVM return 80-bit real/ireal on the x87 stack, for DMD compliance
    if (realIs80bits() && (rt->ty == Tfloat80 || rt->ty == Timaginary80))
        return false;

    // * all POD types <= 64 bits and of a size that is a power of 2
    //   (incl. 2x32-bit cfloat) are returned in a register (RAX, or
    //   XMM0 for single float/ifloat/double/idouble)
    // * all other types are returned via struct-return (sret)
    return (rt->ty == Tstruct && !((TypeStruct*)rt)->sym->isPOD())
        || isPassedWithByvalSemantics(rt);
}