Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.22
 
1.23
 
MAIN:ragge:20100811145113
 
code.c
_>5555 int lastloc = -1;
 5656 static int stroffset;
 5757 
<>58 -static int argtyp(TWORD t, union dimfun *df, struct suedef *sue);
  58+static int argtyp(TWORD t, union dimfun *df, struct attr *ap);
5959 static NODE *movtomem(NODE *p, int off, int reg);
 6060 static NODE *movtoreg(NODE *p, int rno);
 6161 
     
 !
9090 #endif
 9191 #ifdef GCC_COMPAT
 9292         {
<>93 -                struct gcc_attrib *ga;
  93+                struct attr *ga;
9494 
<>95 -                if ((ga = gcc_get_attr(sp->ssue, GCC_ATYP_SECTION)) != NULL)
 96 -                        nextsect = ga->a1.sarg;
 97 -                if ((ga = gcc_get_attr(sp->ssue, GCC_ATYP_WEAK)) != NULL)
  95+                if ((ga = attr_find(sp->sap, GCC_ATYP_SECTION)) != NULL)
  96+                        nextsect = ga->sarg(0);
  97+                if ((ga = attr_find(sp->sap, GCC_ATYP_WEAK)) != NULL)
9898                         weak = 1;
<>99 -                if (gcc_get_attr(sp->ssue, GCC_ATYP_DESTRUCTOR)) {
  99+                if (attr_find(sp->sap, GCC_ATYP_DESTRUCTOR)) {
100100                         printf("\t.section\t.dtors,\"aw\",@progbits\n");
 101101                         printf("\t.align 8\n\t.quad\t%s\n", name);
 102102                         lastloc = -1;
 103103                 }
<>104 -                if (gcc_get_attr(sp->ssue, GCC_ATYP_CONSTRUCTOR)) {
  104+                if (attr_find(sp->sap, GCC_ATYP_CONSTRUCTOR)) {
105105                         printf("\t.section\t.ctors,\"aw\",@progbits\n");
 106106                         printf("\t.align 8\n\t.quad\t%s\n", name);
 107107                         lastloc = -1;
 108108                 }
<>109 -                if ((ga = gcc_get_attr(sp->ssue, GCC_ATYP_VISIBILITY)) &&
 110 -                    strcmp(ga->a1.sarg, "default"))
 111 -                        printf("\t.%s %s\n", ga->a1.sarg, name);
  109+                if ((ga = attr_find(sp->sap, GCC_ATYP_VISIBILITY)) &&
  110+                    strcmp(ga->sarg(0), "default"))
  111+                        printf("\t.%s %s\n", ga->sarg(0), name);
112112         }
 113113 #endif
 114114 
     
 !
121121         lastloc = s;
 122122         while (ISARY(t))
 123123                 t = DECREF(t);
<>124 -        s = ISFTN(t) ? ALINT : talign(t, sp->ssue);
  124+        s = ISFTN(t) ? ALINT : talign(t, sp->sap);
125125         if (s > ALCHAR)
 126126                 printf("        .align %d\n", s/ALCHAR);
 127127         if (weak)
     
 !
155155         t = DECREF(sp->stype);
 156156         if (t != STRTY && t != UNIONTY)
 157157                 return;
<>158 -        if (argtyp(t, sp->sdf, sp->ssue) != STRMEM)
  158+        if (argtyp(t, sp->sdf, sp->sap) != STRMEM)
159159                 return;
 160160 
 161161         /* call memcpy() to put return struct at destination */
<>162 -#define  cmop(x,y) block(CM, x, y, INT, 0, MKSUE(INT))
 163 -        r = tempnode(stroffset, INCREF(t), sp->sdf, sp->ssue);
 164 -        l = block(REG, NIL, NIL, INCREF(t), sp->sdf, sp->ssue);
  162+#define  cmop(x,y) block(CM, x, y, INT, 0, MKAP(INT))
  163+        r = tempnode(stroffset, INCREF(t), sp->sdf, sp->sap);
  164+        l = block(REG, NIL, NIL, INCREF(t), sp->sdf, sp->sap);
165165         regno(l) = RAX;
<>166 -        o = tsize(t, sp->sdf, sp->ssue)/SZCHAR;
  166+        o = tsize(t, sp->sdf, sp->sap)/SZCHAR;
167167         r = cmop(cmop(r, l), bcon(o));
 168168 
 169169         blevel++; /* Remove prototype at exit of function */
 170170         sp = lookup(addname("memcpy"), 0);
 171171         if (sp->stype == UNDEF) {
<>172 -                sp->ssue = MKSUE(VOID);
  172+                sp->sap = MKAP(VOID);
173173                 p = talloc();
 174174                 p->n_op = NAME;
 175175                 p->n_sp = sp;
<>176 -                p->n_sue = sp->ssue;
  176+                p->n_ap = sp->sap;
177177                 p->n_type = VOID|FTN|(PTR<<TSHIFT);
 178178                 defid(p, EXTERN);
 179179                 nfree(p);
     
 !
205205         nrsp = ARGINIT;
 206206         if (cftnsp->stype == STRTY+FTN || cftnsp->stype == UNIONTY+FTN) {
 207207                 sp = cftnsp;
<>208 -                if (argtyp(DECREF(sp->stype), sp->sdf, sp->ssue) == STRMEM) {
 209 -                        r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
  208+                if (argtyp(DECREF(sp->stype), sp->sdf, sp->sap) == STRMEM) {
  209+                        r = block(REG, NIL, NIL, LONG, 0, MKAP(LONG));
210210                         regno(r) = argregsi[ngpr++];
<>211 -                        p = tempnode(0, r->n_type, r->n_df, r->n_sue);
  211+                        p = tempnode(0, r->n_type, r->n_df, r->n_ap);
212212                         stroffset = regno(p);
 213213                         ecomp(buildtree(ASSIGN, p, r));
 214214                 }
     
 !
220220                 if (sp == NULL)
 221221                         continue; /* XXX when happens this? */
 222222 
<>223 -                switch (typ = argtyp(sp->stype, sp->sdf, sp->ssue)) {
  223+                switch (typ = argtyp(sp->stype, sp->sdf, sp->sap)) {
224224                 case INTEGER:
 225225                 case SSE:
 226226                         if (typ == SSE)
 227227                                 rno = XMM0 + nsse++;
 228228                         else
 229229                                 rno = argregsi[ngpr++];
<>230 -                        r = block(REG, NIL, NIL, sp->stype, sp->sdf, sp->ssue);
  230+                        r = block(REG, NIL, NIL, sp->stype, sp->sdf, sp->sap);
231231                         regno(r) = rno;
<>232 -                        p = tempnode(0, sp->stype, sp->sdf, sp->ssue);
  232+                        p = tempnode(0, sp->stype, sp->sdf, sp->sap);
233233                         sp->soffset = regno(p);
 234234                         sp->sflags |= STNODE;
 235235                         ecomp(buildtree(ASSIGN, p, r));
     
 !
239239                         sp->soffset = nrsp;
 240240                         nrsp += SZLONG;
 241241                         if (xtemps) {
<>242 -                                p = tempnode(0, sp->stype, sp->sdf, sp->ssue);
  242+                                p = tempnode(0, sp->stype, sp->sdf, sp->sap);
243243                                 p = buildtree(ASSIGN, p, nametree(sp));
 244244                                 sp->soffset = regno(p->n_left);
 245245                                 sp->sflags |= STNODE;
     
 !
249249 
 250250                 case STRMEM: /* Struct in memory */
 251251                         sp->soffset = nrsp;
<>252 -                        nrsp += tsize(sp->stype, sp->sdf, sp->ssue);
  252+                        nrsp += tsize(sp->stype, sp->sdf, sp->sap);
253253                         break;
 254254 
 255255                 case STRREG: /* Struct in register */
 256256                         /* Allocate space on stack for the struct */
 257257                         /* For simplicity always fetch two longwords */
 258258                         autooff += (2*SZLONG);
 259259 
<>260 -                        r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
  260+                        r = block(REG, NIL, NIL, LONG, 0, MKAP(LONG));
261261                         regno(r) = argregsi[ngpr++];
 262262                         ecomp(movtomem(r, -autooff, FPREG));
 263263 
<>264 -                        if (tsize(sp->stype, sp->sdf, sp->ssue) > SZLONG) {
 265 -                                r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
  264+                        if (tsize(sp->stype, sp->sdf, sp->sap) > SZLONG) {
  265+                                r = block(REG, NIL, NIL, LONG, 0, MKAP(LONG));
266266                                 regno(r) = argregsi[ngpr++];
 267267                                 ecomp(movtomem(r, -autooff+SZLONG, FPREG));
 268268                         }
     
 !
294294         /* Save reg arguments in the reg save area */
 295295         p = NIL;
 296296         for (i = ngpr; i < 6; i++) {
<>297 -                r = block(REG, NIL, NIL, LONG, 0, MKSUE(LONG));
  297+                r = block(REG, NIL, NIL, LONG, 0, MKAP(LONG));
298298                 regno(r) = argregsi[i];
 299299                 r = movtomem(r, -RSALONGOFF(i)-autooff, FPREG);
<>300 -                p = (p == NIL ? r : block(COMOP, p, r, INT, 0, MKSUE(INT)));
  300+                p = (p == NIL ? r : block(COMOP, p, r, INT, 0, MKAP(INT)));
301301         }
 302302         for (i = nsse; i < 8; i++) {
<>303 -                r = block(REG, NIL, NIL, DOUBLE, 0, MKSUE(DOUBLE));
  303+                r = block(REG, NIL, NIL, DOUBLE, 0, MKAP(DOUBLE));
304304                 regno(r) = i + XMM0;
 305305                 r = movtomem(r, -RSADBLOFF(i)-autooff, FPREG);
<>306 -                p = (p == NIL ? r : block(COMOP, p, r, INT, 0, MKSUE(INT)));
  306+                p = (p == NIL ? r : block(COMOP, p, r, INT, 0, MKAP(INT)));
307307         }
 308308         autooff += RSASZ;
 309309         rsaoff = autooff;
     
 !
363363         reg_save_area = addname("reg_save_area");
 364364 
 365365         rp = bstruct(NULL, STNAME, NULL);
<>366 -        p = block(NAME, NIL, NIL, UNSIGNED, 0, MKSUE(UNSIGNED));
  366+        p = block(NAME, NIL, NIL, UNSIGNED, 0, MKAP(UNSIGNED));
367367         soumemb(p, gp_offset, 0);
 368368         soumemb(p, fp_offset, 0);
 369369         p->n_type = VOID+PTR;
<>370 -        p->n_sue = MKSUE(VOID);
  370+        p->n_ap = MKAP(VOID);
371371         soumemb(p, overflow_arg_area, 0);
 372372         soumemb(p, reg_save_area, 0);
 373373         nfree(p);
 374374         q = dclstruct(rp);
 375375         c = addname("__builtin_va_list");
<>376 -        p = block(LB, bdty(NAME, c), bcon(1), INT, 0, MKSUE(INT));
  376+        p = block(LB, bdty(NAME, c), bcon(1), INT, 0, MKAP(INT));
377377         p = tymerge(q, p);
 378378         p->n_sp = lookup(c, 0);
 379379         defid(p, TYPEDEF);
     
 !
386386 {
 387387         NODE *p;
 388388 
<>389 -        p = block(REG, NIL, NIL, PTR|typ, 0, MKSUE(LONG));
  389+        p = block(REG, NIL, NIL, PTR|typ, 0, MKAP(LONG));
390390         regno(p) = FPREG;
 391391         return buildtree(PLUS, p, bcon(off/SZCHAR));
 392392 }
     
 !
441441             buildtree(COLON, cm1, cm2));
 442442 
 443443         nt = (dt == DOUBLE ? DOUBLE : LONG);
<>444 -        l1 = block(NAME, NIL, NIL, nt|PTR, 0, MKSUE(nt));
  444+        l1 = block(NAME, NIL, NIL, nt|PTR, 0, MKAP(nt));
445445         l1 = buildtree(CAST, l1, qc);
 446446         qc = l1->n_right;
 447447         nfree(l1->n_left);
     
 !
451451         addto = dt == DOUBLE ? 2 : 1;
 452452         qc = buildtree(UMUL, buildtree(PLUS, qc, bcon(-addto)), NIL);
 453453 
<>454 -        l1 = block(NAME, NIL, NIL, dt, 0, MKSUE(BTYPE(dt)));
  454+        l1 = block(NAME, NIL, NIL, dt, 0, MKAP(BTYPE(dt)));
455455         l1 = buildtree(CAST, l1, qc);
 456456         qc = l1->n_right;
 457457         nfree(l1->n_left);
     
 !
504504 {
 505505         NODE *r;
 506506 
<>507 -        r = block(REG, NIL, NIL, p->n_type, p->n_df, p->n_sue);
  507+        r = block(REG, NIL, NIL, p->n_type, p->n_df, p->n_ap);
508508         regno(r) = rno;
 509509         return clocal(buildtree(ASSIGN, r, p));
 510510 
     
 !
517517 
 518518         s.stype = p->n_type;
 519519         s.sdf = p->n_df;
<>520 -        s.ssue = p->n_sue;
  520+        s.sap = p->n_ap;
521521         s.soffset = off;
 522522         s.sclass = AUTO;
 523523 
 524524         l = block(REG, NIL, NIL, PTR+STRTY, 0, 0);
 525525         l->n_lval = 0;
 526526         regno(l) = reg;
 527527 
<>528 -        r = block(NAME, NIL, NIL, p->n_type, p->n_df, p->n_sue);
  528+        r = block(NAME, NIL, NIL, p->n_type, p->n_df, p->n_ap);
529529         r->n_sp = &s;
 530530         r = stref(block(STREF, l, r, 0, 0, 0));
 531531 
     
 !
537537  * AMD64 parameter classification.
 538538  */
 539539 static int
<>540 -argtyp(TWORD t, union dimfun *df, struct suedef *sue)
  540+argtyp(TWORD t, union dimfun *df, struct attr *ap)
541541 {
 542542         int cl = 0;
 543543 
     
 !
549549                 cl = X87; /* XXX */
 550550         } else if (t == STRTY) {
 551551                 /* XXX no SSEOP handling */
<>552 -                if ((tsize(t, df, sue) > 2*SZLONG) ||
 553 -                    (gcc_get_attr(sue, GCC_ATYP_PACKED) != NULL))
  552+                if ((tsize(t, df, ap) > 2*SZLONG) ||
  553+                    (attr_find(ap, GCC_ATYP_PACKED) != NULL))
554554                         cl = STRMEM;
 555555                 else
 556556                         cl = STRREG;
     
 !
567567 
 568568         /* first arg may be struct return pointer */
 569569         /* XXX - check if varargs; setup al */
<>570 -        switch (typ = argtyp(p->n_type, p->n_df, p->n_sue)) {
  570+        switch (typ = argtyp(p->n_type, p->n_df, p->n_ap)) {
571571         case INTEGER:
 572572         case SSE:
 573573                 q = talloc();
     
 !
596596 
 597597         case STRREG: /* Struct in registers */
 598598                 /* Cast to long pointer and move to the registers */
<>599 -                ssz = tsize(p->n_type, p->n_df, p->n_sue);
  599+                ssz = tsize(p->n_type, p->n_df, p->n_ap);
600600 
 601601                 if (ssz <= SZLONG) {
 602602                         q = cast(p->n_left, LONG+PTR, 0);
     
 !
607607                 } else if (ssz <= SZLONG*2) {
 608608                         NODE *qt, *q1, *q2, *ql, *qr;
 609609 
<>610 -                        qt = tempnode(0, LONG+PTR, 0, MKSUE(LONG));
  610+                        qt = tempnode(0, LONG+PTR, 0, MKAP(LONG));
611611                         q1 = ccopy(qt);
 612612                         q2 = ccopy(qt);
 613613                         ql = buildtree(ASSIGN, qt, cast(p->n_left,LONG+PTR, 0));
     
 !
646646         /* If so, add it in pass2 */
 647647         if ((l = p->n_left)->n_type == INCREF(FTN)+STRTY ||
 648648             l->n_type == INCREF(FTN)+UNIONTY) {
<>649 -                int ssz = tsize(BTYPE(l->n_type), l->n_df, l->n_sue);
  649+                int ssz = tsize(BTYPE(l->n_type), l->n_df, l->n_ap);
650650                 if (ssz > 2*SZLONG)
 651651                         ngpr++;
 652652         }
     
 !
671671         /* Always emit number of SSE regs used */
 672672         l = movtoreg(bcon(nsse), RAX);
 673673         if (p->n_right->n_op != CM) {
<>674 -                p->n_right = block(CM, l, p->n_right, INT, 0, MKSUE(INT));
  674+                p->n_right = block(CM, l, p->n_right, INT, 0, MKAP(INT));
675675         } else {
 676676                 for (r = p->n_right; r->n_left->n_op == CM; r = r->n_left)
 677677                         ;
<>678 -                r->n_left = block(CM, l, r->n_left, INT, 0, MKSUE(INT));
  678+                r->n_left = block(CM, l, r->n_left, INT, 0, MKAP(INT));
<_679679         }
 680680         return p;
 681681 }
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-08-21 12:12 +0200