Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.45
 
1.46
 
MAIN:ragge:20101225191445
 
code.c
_>3232 
 3333 static int nsse, ngpr, nrsp, rsaoff;
 3434 static int thissse, thisgpr, thisrsp;
<>35 -enum { INTEGER = 1, INTMEM, SSE, SSEMEM, X87, STRREG, STRMEM };
  35+enum { INTEGER = 1, INTMEM, SSE, SSEMEM, X87, STRREG, STRMEM, STRCPX };
3636 static const int argregsi[] = { RDI, RSI, RDX, RCX, R08, R09 };
 3737 /*
 3838  * The Register Save Area looks something like this.
     
 !
173173         extern int gotnr;
 174174         TWORD t;
 175175         NODE *p, *r, *l;
<>176 -        int typ, ssz;
  176+        int typ, ssz, rno;
177177 
 178178         gotnr = 0;      /* new number for next fun */
 179179         sp = cftnsp;
     
 !
182182                 return;
 183183 
 184184         /* XXX should have one routine for this */
<>185 -        if ((typ = argtyp(t, sp->sdf, sp->sap)) == STRREG) {
  185+        if ((typ = argtyp(t, sp->sdf, sp->sap)) == STRREG || typ == STRCPX) {
186186                 /* Cast to long pointer and move to the registers */
 187187                 /* XXX can overrun struct size */
 188188                 /* XXX check carefully for SSE members */
 189189 
 190190                 if ((ssz = tsize(t, sp->sdf, sp->sap)) > SZLONG*2)
 191191                         cerror("efcode1");
 192192 
<> 193+                if (typ == STRCPX) {
  194+                        t = DOUBLE;
  195+                        rno = XMM0;
  196+                } else {
  197+                        t = LONG;
  198+                        rno = RAX;
  199+                }
193200                 if (ssz > SZLONG) {
<>194 -                        p = block(REG, NIL, NIL, LONG+PTR, 0, MKAP(LONG));
  201+                        p = block(REG, NIL, NIL, INCREF(t), 0, MKAP(t));
195202                         regno(p) = RAX;
 196203                         p = buildtree(UMUL, buildtree(PLUS, p, bcon(1)), NIL);
<>197 -                        ecomp(movtoreg(p, RDX));
  204+                        ecomp(movtoreg(p, rno+1));
198205                 }
<>199 -                p = block(REG, NIL, NIL, LONG+PTR, 0, MKAP(LONG));
  206+                p = block(REG, NIL, NIL, INCREF(t), 0, MKAP(t));
200207                 regno(p) = RAX;
 201208                 p = buildtree(UMUL, p, NIL);
<>202 -                ecomp(movtoreg(p, RAX));
  209+                ecomp(movtoreg(p, rno));
203210         } else if (typ == STRMEM) {
 204211                 r = block(REG, NIL, NIL, INCREF(t), sp->sdf, sp->sap);
 205212                 regno(r) = RAX;
     
 !
298305                         nrsp += SZLDOUBLE;
 299306                         break;
 300307 
<> 308+                case STRCPX:
301309                 case STRREG: /* Struct in register */
 302310                         /* Allocate space on stack for the struct */
 303311                         /* For simplicity always fetch two longwords */
 304312                         autooff += (2*SZLONG);
 305313 
<>306 -                        r = block(REG, NIL, NIL, LONG, 0, MKAP(LONG));
 307 -                        regno(r) = argregsi[ngpr++];
  314+                        if (typ == STRCPX) {
  315+                                t = DOUBLE;
  316+                                rno = XMM0 + nsse++;
  317+                        } else {
  318+                                t = LONG;
  319+                                rno = argregsi[ngpr++];
  320+                        }
  321+                        r = block(REG, NIL, NIL, t, 0, MKAP(t));
  322+                        regno(r) = rno;
308323                         ecomp(movtomem(r, -autooff, FPREG));
 309324 
 310325                         if (tsize(sp->stype, sp->sdf, sp->sap) > SZLONG) {
<>311 -                                r = block(REG, NIL, NIL, LONG, 0, MKAP(LONG));
 312 -                                regno(r) = argregsi[ngpr++];
  326+                                r = block(REG, NIL, NIL, t, 0, MKAP(t));
  327+                                regno(r) = (typ == STRCPX ?
  328+                                    XMM0 + nsse++ : argregsi[ngpr++]);
313329                                 ecomp(movtomem(r, -autooff+SZLONG, FPREG));
 314330                         }
 315331 
     
 !
680696         } else if (t == STRTY || t == UNIONTY) {
 681697                 int sz = tsize(t, df, ap);
 682698 
<>683 -                if (sz > 2*SZLONG || ((sz+SZLONG)/SZLONG)+ngpr > 6 ||
  699+                if (sz <= 2*SZLONG && attr_find(ap, ATTR_COMPLEX) != NULL) {
  700+                        cl = nsse < 7 ? STRCPX : STRMEM;
  701+                } else if (sz > 2*SZLONG || ((sz+SZLONG)/SZLONG)+ngpr > 6 ||
684702                     attr_find(ap, GCC_ATYP_PACKED) != NULL)
 685703                         cl = STRMEM;
 686704                 else
     
 !
699717 argput(NODE *p)
 700718 {
 701719         NODE *q;
<> 720+        TWORD ty;
702721         int typ, r, ssz;
 703722 
 704723         if (p->n_op == CM) {
     
 !
739758                 p = movtomem(p, r, STKREG);
 740759                 break;
 741760 
<> 761+        case STRCPX:
742762         case STRREG: /* Struct in registers */
 743763                 /* Cast to long pointer and move to the registers */
 744764                 /* XXX can overrun struct size */
 745765                 /* XXX check carefully for SSE members */
 746766                 ssz = tsize(p->n_type, p->n_df, p->n_ap);
 747767 
<> 768+                if (typ == STRCPX) {
  769+                        ty = DOUBLE;
  770+                        r = XMM0 + nsse++;
  771+                } else {
  772+                        ty = LONG;
  773+                        r = argregsi[ngpr++];
  774+                }
748775                 if (ssz <= SZLONG) {
<>749 -                        q = cast(p->n_left, LONG+PTR, 0);
  776+                        q = cast(p->n_left, INCREF(ty), 0);
750777                         nfree(p);
 751778                         q = buildtree(UMUL, q, NIL);
<>752 -                        p = movtoreg(q, argregsi[ngpr++]);
  779+                        p = movtoreg(q, r);
753780                 } else if (ssz <= SZLONG*2) {
 754781                         NODE *ql, *qr;
 755782 
<>756 -                        qr = cast(ccopy(p->n_left), LONG+PTR, 0);
 757 -                        qr = movtoreg(buildtree(UMUL, qr, NIL),
 758 -                            argregsi[ngpr++]);
  783+                        qr = cast(ccopy(p->n_left), INCREF(ty), 0);
  784+                        qr = movtoreg(buildtree(UMUL, qr, NIL), r);
759785 
<>760 -                        ql = cast(p->n_left, LONG+PTR, 0);
  786+                        ql = cast(p->n_left, INCREF(ty), 0);
761787                         ql = buildtree(UMUL, buildtree(PLUS, ql, bcon(1)), NIL);
<>762 -                        ql = movtoreg(ql, argregsi[ngpr++]);
  788+                        r = (typ == STRCPX ? XMM0 + nsse++ : argregsi[ngpr++]);
  789+                        ql = movtoreg(ql, r);
<_763790 
 764791                         nfree(p);
 765792                         p = buildtree(CM, ql, qr);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-01 13:16 +0200