Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.16
 
1.17
 
MAIN:ragge:20100407144549
 
code.c
_>159159         NODE *p, *r;
 160160         int i, rno, typ;
 161161 
<>162 -        if (cftnsp->stype == STRTY+FTN || cftnsp->stype == UNIONTY+FTN) {
 163 -                /* Function returns struct, adjust arg offset */
 164 -                for (i = 0; i < cnt; i++)
 165 -                        s[i]->soffset += SZPOINT(LONG);
 166 -        }
 167 -
168162         /* recalculate the arg offset and create TEMP moves */
 169163         /* Always do this for reg, even if not optimizing, to free arg regs */
 170164         nsse = ngpr = 0;
 171165         nrsp = ARGINIT;
<> 166+        if (cftnsp->stype == STRTY+FTN || cftnsp->stype == UNIONTY+FTN) {
  167+                sp = cftnsp;
  168+                if (tsize(sp->stype, sp->sdf, sp->ssue) > SZLONG*2)
  169+                        ngpr++; /* For hidden argument */
  170+        }
  171+
172172         for (i = 0; i < cnt; i++) {
 173173                 sp = s[i];
 174174 
     
 !
202202                         }
 203203                         break;
 204204 
<> 205+                case STRMEM: /* Struct in memory */
  206+                        sp->soffset = nrsp;
  207+                        nrsp += tsize(sp->stype, sp->sdf, sp->ssue);
  208+                        break;
  209+
  210+                case STRREG: /* Struct in register */
  211+                        /* Allocate space on stack for the struct */
  212+                        /* For simplicity always fetch two longwords */
  213+                        autooff += (2*SZLONG);
  214+
  215+                        r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
  216+                        regno(r) = argregsi[ngpr++];
  217+                        ecomp(movtomem(r, -autooff, FPREG));
  218+
  219+                        if (tsize(sp->stype, sp->sdf, sp->ssue) > SZLONG) {
  220+                                r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
  221+                                regno(r) = argregsi[ngpr++];
  222+                                ecomp(movtomem(r, -autooff+SZLONG, FPREG));
  223+                        }
  224+
  225+                        sp->soffset = -autooff;
  226+                        break;
  227+
205228                 default:
 206229                         cerror("bfcode: %d", typ);
 207230                 }
     
 !
493516         } else if (t == LDOUBLE) {
 494517                 cl = X87; /* XXX */
 495518         } else if (t == STRTY) {
<>496 -                if (tsize(t, df, sue) > 4*SZLONG)
  519+                /* XXX no SSEOP handling */
  520+                if ((tsize(t, df, sue) > 2*SZLONG) ||
  521+                    (gcc_get_attr(sue, GCC_ATYP_PACKED) != NULL))
497522                         cl = STRMEM;
 498523                 else
<>499 -                        cerror("clasif");
  524+                        cl = STRREG;
500525         } else
 501526                 cerror("FIXME: classify");
 502527         return cl;
     
 !
506531 argput(NODE *p)
 507532 {
 508533         NODE *q;
<>509 -        int typ, r;
  534+        int typ, r, ssz;
510535 
 511536         /* first arg may be struct return pointer */
 512537         /* XXX - check if varargs; setup al */
     
 !
537562                 nfree(q);
 538563                 break;
 539564 
<> 565+        case STRREG: /* Struct in registers */
  566+                /* Cast to long pointer and move to the registers */
  567+                ssz = tsize(p->n_type, p->n_df, p->n_sue);
  568+
  569+                if (ssz <= SZLONG) {
  570+                        q = cast(p->n_left, LONG+PTR, 0);
  571+                        q = buildtree(UMUL, q, NIL);
  572+                        q = movtoreg(q, argregsi[ngpr++]);
  573+                        *p = *q;
  574+                        nfree(q);
  575+                } else if (ssz <= SZLONG*2) {
  576+                        NODE *qt, *q1, *q2, *ql, *qr;
  577+
  578+                        qt = tempnode(0, LONG+PTR, 0, MKSUE(LONG));
  579+                        q1 = ccopy(qt);
  580+                        q2 = ccopy(qt);
  581+                        ql = buildtree(ASSIGN, qt, cast(p->n_left,LONG+PTR, 0));
  582+                        qr = movtoreg(buildtree(UMUL, q1, NIL),
  583+                            argregsi[ngpr++]);
  584+                        ql = buildtree(COMOP, ql, qr);
  585+                        qr = buildtree(UMUL, buildtree(PLUS, q2, bcon(1)), NIL);
  586+                        qr = movtoreg(qr, argregsi[ngpr++]);
  587+                        q = buildtree(COMOP, ql, qr);
  588+                        *p = *q;
  589+                        nfree(q);
  590+                } else
  591+                        cerror("STRREG");
  592+                break;
  593+
540594         case STRMEM:
 541595                 /* Struct moved to memory */
<>542 -        case STRREG:
 543 -                /* Struct in registers */
544596         default:
 545597                 cerror("argument %d", typ);
 546598         }
     
 !
558610         NODE *l, *r;
 559611 
 560612         nsse = ngpr = nrsp = 0;
<> 613+        /* Check if hidden arg needed */
  614+        /* If so, add it in pass2 */
  615+        if ((l = p->n_left)->n_type == INCREF(FTN)+STRTY ||
  616+            l->n_type == INCREF(FTN)+UNIONTY) {
  617+                int ssz = tsize(BTYPE(l->n_type), l->n_df, l->n_sue);
  618+                if (ssz > 2*SZLONG)
  619+                        ngpr++;
  620+        }
<_561621         listf(p->n_right, argput);
 562622 
 563623         /* Always emit number of SSE regs used */
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-21 06:29 +0100