Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.311
 
1.312
 
MAIN:ragge:20110407185015
 
pftn.c
_>264264          * Its allowed to add attributes to existing declarations.
 265265          * Be care ful though not to trash existing attributes.
 266266          */
<>267 -        if (p->sap->atype <= ATTR_MAX) {
  267+        if (p->sap && p->sap->atype <= ATTR_MAX) {
268268                 /* nothing special, just overwrite */
 269269                 p->sap = q->n_ap;
 270270         } else {
     
 !
373373         if (type < BTMASK && (ap = attr_find(q->n_ap, GCC_ATYP_MODE))) {
 374374                 int u = ISUNSIGNED(type);
 375375                 type = u ? ENUNSIGN(ap->iarg(0)) : ap->iarg(0);
<>376 -                if (type != XTYPE) {
 377 -                        for (ap = q->n_ap;
 378 -                            ap->next->atype != ATTR_BASETYP; ap = ap->next)
 379 -                                ;
 380 -                        ap->next = MKAP(type);
 381 -                } else
  376+                if (type == XTYPE)
382377                         uerror("fix XTYPE basetyp");
 383378         }
 384379         p->stype = type;
 385380         p->squal = qual;
 386381         p->sclass = (char)class;
 387382         p->slevel = (char)blevel;
 388383         p->soffset = NOOFFSET;
<>389 -        if (q->n_ap == NULL)
 390 -                cerror("q->n_ap == NULL");
 391 -        p->sap = attr_add(q->n_ap, p->sap);
  384+        if (q->n_ap)
  385+                p->sap = attr_add(q->n_ap, p->sap);
392386 
 393387         /* copy dimensions */
 394388         p->sdf = q->n_df;
     
 !
416410                 break;
 417411 
 418412         case PARAM:
<>419 -                oalloc(p, &argoff);
  413+                /* oalloc(p, &argoff); */
420414                 break;
 421415                 
 422416         case STATIC:
     
 !
447441         }
 448442 
 449443 #ifdef STABS
<>450 -        if (gflag)
  444+        if (gflag && p->stype != FARG)
451445                 stabs_newsym(p);
 452446 #endif
 453447 
     
 !
570564                         uerror("parameter %d name missing", i);
 571565                         p = &nulsym; /* empty symtab */
 572566                 }
<>573 -                if (p->stype == FARG) {
  567+                if (p->stype == FARG)
574568                         p->stype = INT;
<>575 -                        p->sap = MKAP(INT);
 576 -                }
577569                 if (ISARY(p->stype)) {
 578570                         p->stype += (PTR-ARY);
 579571                         p->sdf++;
     
 !
641633 static struct attr *
 642634 seattr(void)
 643635 {
<>644 -        return attr_add(attr_new(ATTR_BASETYP, 4), attr_new(ATTR_STRUCT, 1));
  636+        return attr_add(attr_new(GCC_ATYP_ALIGNED, 4), attr_new(ATTR_STRUCT, 2));
645637 }
 646638 
 647639 /*
     
 !
706698                 if (sp->stype != UNDEF)
 707699                         sp = hide(sp);
 708700                 sp->stype = INT; /* always */
<>709 -                sp->sap = MKAP(INT);
710701                 sp->sclass = MOE;
 711702                 sp->soffset = enummer;
 712703         } else
     
 !
739730                 defstr(sp, ENAME);
 740731         }
 741732         if (sp->sap == NULL)
<>742 -                sp->sap = seattr();
 743 -        ap = attr_find(sp->sap, ATTR_STRUCT);
  733+                ap = sp->sap = attr_new(ATTR_STRUCT, 4);
  734+        else
  735+                ap = attr_find(sp->sap, ATTR_STRUCT);
744736         ap->amlist = sp;
 745737         return sp;
 746738 }
     
 !
751743 NODE *
 752744 enumdcl(struct symtab *sp)
 753745 {
<>754 -        struct attr *ap;
755746         NODE *p;
 756747         TWORD t;
 757748 
     
 !
766757                 t = ctype(INT);
 767758 #endif
 768759         
<>769 -        if (sp) {
  760+        if (sp)
770761                 sp->stype = t;
<>771 -                ap = attr_find(sp->sap, ATTR_BASETYP);
 772 -                ap->atypsz = (MKAP(t))->atypsz;
 773 -                ap->aalign = (MKAP(t))->aalign;
 774 -                ap = sp->sap;
 775 -        } else
 776 -                ap = MKAP(t);
 777 -        p = mkty(t, 0, ap);
  762+        p = mkty(t, 0, 0);
778763         p->n_sp = sp;
 779764         return p;
 780765 }
     
 !
828813                 sp = deftag(name, soru);
 829814                 if (sp->sap == NULL)
 830815                         sp->sap = seattr();
<>831 -                ap = attr_find(sp->sap, ATTR_BASETYP);
 832 -                if (ap->aalign != 0) {
  816+                ap = attr_find(sp->sap, GCC_ATYP_ALIGNED);
  817+                if (ap->iarg(0) != 0) {
833818                         if (sp->slevel < blevel) {
 834819                                 sp = hide(sp);
 835820                                 defstr(sp, soru);
     
 !
868853         struct symtab *sp;
 869854         int al, sa, sz, coff;
 870855 
<>871 -        apb = attr_find(r->ap, ATTR_BASETYP);
  856+        apb = attr_find(r->ap, GCC_ATYP_ALIGNED);
872857         aps = attr_find(r->ap, ATTR_STRUCT);
 873858         aps->amlist = r->rb;
 874859 
     
 !
899884 
 900885         SETOFF(rpole->rstr, al);
 901886 
<>902 -        apb->atypsz = rpole->rstr;
 903 -        apb->aalign = al;
  887+        aps->amsize = rpole->rstr;
  888+        apb->iarg(0) = al;
904889 
 905890 #ifdef PCC_DEBUG
 906891         if (ddebug) {
 907892                 printf("dclstruct(%s): size=%d, align=%d\n",
 908893                     r->rsym ? r->rsym->sname : "??",
<>909 -                    apb->atypsz, apb->aalign);
  894+                    aps->amsize, apb->iarg(0));
910895         }
 911896         if (ddebug>1) {
 912897                 printf("\tsize %d align %d link %p\n",
<>913 -                    apb->atypsz, apb->aalign, aps->amlist);
  898+                    aps->amsize, apb->iarg(0), aps->amlist);
914899                 for (sp = aps->amlist; sp != NULL; sp = sp->snext) {
 915900                         printf("\tmember %s(%p)\n", sp->sname, sp);
 916901                 }
     
 !
10701055 talign(unsigned int ty, struct attr *apl)
 10711056 {
 10721057         struct attr *al;
<>1073 -        int i;
  1058+        int i, a;
10741059 
<>1075 -        if (ISPTR(ty))
 1076 -                return(ALPOINT); /* shortcut */
 1077 -
 1078 -        if(apl == NULL && ty!=INT && ty!=CHAR && ty!=SHORT &&
 1079 -            ty!=UNSIGNED && ty!=UCHAR && ty!=USHORT) {
 1080 -                return(fldal(ty));
 1081 -        }
 1082 -
10831060         for( i=0; i<=(SZINT-BTSHIFT-1); i+=TSHIFT ){
 10841061                 switch( (ty>>i)&TMASK ){
 10851062 
     
 !
10941071                         }
 10951072                 }
 10961073 
<>1097 -        
  1074+        /* check for alignment attribute */
10981075         if ((al = attr_find(apl, GCC_ATYP_ALIGNED)))
 10991076                 return al->iarg(0);
<>1100 -        al = attr_find(apl, ATTR_BASETYP);
 1101 -        if (al == NULL)
 1102 -                cerror("no basetyp");
 1103 -        if (al->aalign == 0)
  1077+
  1078+        ty = BTYPE(ty);
  1079+        if (ISUNSIGNED(ty))
  1080+                ty = DEUNSIGN(ty);
  1081+
  1082+        switch (ty) {
  1083+        case BOOL: a = ALBOOL; break;
  1084+        case CHAR: a = ALCHAR; break;
  1085+        case SHORT: a = ALSHORT; break;
  1086+        case INT: a = ALINT; break;
  1087+        case LONG: a = ALLONG; break;
  1088+        case LONGLONG: a = ALLONGLONG; break;
  1089+        case FLOAT: a = ALFLOAT; break;
  1090+        case DOUBLE: a = ALDOUBLE; break;
  1091+        case LDOUBLE: a = ALLDOUBLE; break;
  1092+        default:
11041093                 uerror("no alignment");
<>1105 -        return al->aalign;
  1094+                a = ALINT;
  1095+        }
  1096+        return a;
11061097 }
 11071098 
 11081099 /* compute the size associated with type ty,
     
 !
11381129                         }
 11391130                 }
 11401131 
<>1141 -        ap = attr_find(apl, ATTR_BASETYP);
 1142 -        sz = ap->atypsz;
 1143 -        
 1144 -#ifdef GCC_COMPAT
  1132+        ty = BTYPE(ty);
11451133         if (ty == VOID)
<>1146 -                sz = SZCHAR;
 1147 -#endif
 1148 -        if (!ISSOU(BTYPE(ty))) {
 1149 -                if (sz == 0) {
 1150 -                        uerror("unknown size");
 1151 -                        return(SZINT);
 1152 -                }
 1153 -        } else {
 1154 -                if (talign(ty, apl) == 0)
  1134+                ty = CHAR;
  1135+
  1136+        if (ISUNSIGNED(ty))
  1137+                ty = DEUNSIGN(ty);
  1138+
  1139+        switch (ty) {
  1140+        case BOOL: sz = SZBOOL; break;
  1141+        case CHAR: sz = SZCHAR; break;
  1142+        case SHORT: sz = SZSHORT; break;
  1143+        case INT: sz = SZINT; break;
  1144+        case LONG: sz = SZLONG; break;
  1145+        case LONGLONG: sz = SZLONGLONG; break;
  1146+        case FLOAT: sz = SZFLOAT; break;
  1147+        case DOUBLE: sz = SZDOUBLE; break;
  1148+        case LDOUBLE: sz = SZLDOUBLE; break;
  1149+        case STRTY:
  1150+        case UNIONTY:
  1151+                if ((ap = strattr(apl)) == NULL) {
11551152                         uerror("unknown structure/union/enum");
<> 1153+                        sz = SZINT;
  1154+                } else
  1155+                        sz = ap->amsize;
  1156+                break;
  1157+        default:
  1158+                uerror("unknown type");
  1159+                sz = SZINT;
11561160         }
 11571161 
 11581162         return((unsigned int)sz * mult);
     
 !
11871191                 sp->sdf = permalloc(sizeof(union dimfun));
 11881192                 if (wide) {
 11891193                         sp->stype = WCHAR_TYPE+ARY;
<>1190 -                        sp->sap = MKAP(WCHAR_TYPE);
11911194                 } else {
 11921195                         if (funsigned_char) {
 11931196                                 sp->stype = UCHAR+ARY;
<>1194 -                                sp->sap = MKAP(UCHAR);
11951197                         } else {
 11961198                                 sp->stype = CHAR+ARY;
<>1197 -                                sp->sap = MKAP(CHAR);
11981199                         }
 11991200                 }
 12001201                 for (wr = sp->sname, i = 1; *wr; i++)
     
 !
12291230                         p->n_lval = esccon(&s);
 12301231                 else
 12311232                         p->n_lval = (unsigned char)s[-1];
<>1232 -                ninval(0, (MKAP(WCHAR_TYPE))->atypsz, p);
  1233+                ninval(0, tsize(WCHAR_TYPE, NULL, NULL), p);
12331234         } while (s[-1] != 0);
 12341235         nfree(p);
 12351236 }
     
 !
13491350                 if (!ISARY(t))
 13501351                         continue;
 13511352                 if (df->ddim == -1) {
<>1352 -                        p = tempnode(0, INT, 0, MKAP(INT));
  1353+                        p = tempnode(0, INT, 0, 0);
13531354                         df->ddim = -regno(p);
 13541355                         edelay(buildtree(ASSIGN, p, arrstk[astkp++]));
 13551356                 }
     
 !
14121413                 if (!ISARY(t))
 14131414                         break;
 14141415                 if (df->ddim < 0)
<>1415 -                        n = tempnode(-df->ddim, INT, 0, MKAP(INT));
  1416+                        n = tempnode(-df->ddim, INT, 0, 0);
14161417                 else
 14171418                         n = bcon(df->ddim);
 14181419 
     
 !
14411442                 type = INT;
 14421443         }
 14431444 
<>1444 -        al = btattr[type].aalign;
 1445 -        sz = btattr[type].atypsz;
  1445+        al = talign(type, NULL);
  1446+        sz = tsize(type, NULL, NULL);
14461447 
 14471448         if (w > sz) {
 14481449                 uerror("field too big");
     
 !
16101611 {
 16111612         struct typctx *tc = arg;
 16121613 
<>1613 -#define cmop(x,y) block(CM, x, y, INT, 0, MKAP(INT))
  1614+#define cmop(x,y) block(CM, x, y, INT, 0, 0)
16141615         switch (p->n_op) {
 16151616         case ATTRIB:
 16161617                 if (tc->saved && (tc->saved->n_qual & 1)) {
     
 !
17861787                         t = INT;
 17871788                         MODTYPE(tc.type, INT);
 17881789                 }
<>1789 -                qmkty(tc.type, 0, MKAP(t));
  1790+                qmkty(tc.type, 0, 0);
17901791         }
 17911792         q->n_ap = attr_add(q->n_ap, tc.post);
 17921793         q->n_qual = tc.qual;
     
 !
18381839         NODE *p;
 18391840         union dimfun *j;
 18401841         struct tylnk *base, tylnk, *tylkp;
<>1841 -        struct attr *ap, *bap;
  1842+        struct attr *bap;
18421843         int ntdim, i;
 18431844 
 18441845 #ifdef PCC_DEBUG
     
 !
18801881                 idp->n_df = NULL;
 18811882 
 18821883         /* now idp is a single node: fix up type */
<>1883 -        if ((t = ctype(idp->n_type)) != idp->n_type) {
  1884+        if ((t = ctype(idp->n_type)) != idp->n_type)
18841885                 idp->n_type = t;
<>1885 -                t = BTYPE(t);
 1886 -                if (bap->atype == ATTR_BASETYP)
 1887 -                        bap = MKAP(t);
 1888 -                else {
 1889 -                        for (ap = bap;
 1890 -                            ap->next->atype != ATTR_BASETYP; ap = ap->next)
 1891 -                                ;
 1892 -                        ap->next = MKAP(t);
 1893 -                }
 1894 -        }
18951886         
 18961887         if (idp->n_op != NAME) {
 18971888                 for (p = idp->n_left; p->n_op != NAME; p = p->n_left)
     
 !
21122103                 }
 21132104                 if (ISSOU(t)) {
 21142105                         al++;
<>2115 -                        struct attr *ap = attr_find(al->sap, ATTR_BASETYP);
 2116 -                        printf(" (size %d align %d)", ap->atypsz,
 2117 -                            ap->aalign);
  2106+                        printf(" (size %d align %d)", (int)tsize(t, 0, al->sap),
  2107+                            (int)talign(t, al->sap));
21182108                 }
 21192109                 printf("\n");
 21202110         }
     
 !
23682358 skip:           if (ISSOU(BTYPE(arrt))) {
 23692359                         MKTY(apole->node, arrt, 0, al[1].sap)
 23702360                 } else {
<>2371 -                        MKTY(apole->node, arrt, 0, MKAP(BTYPE(arrt)))
  2361+                        MKTY(apole->node, arrt, 0, 0)
23722362                 }
 23732363 
 23742364 out:            al++;
     
 !
27282718 {
 27292719         NODE *p;
 27302720 
<>2731 -        p = block(NAME, NIL, NIL, FTN+VOID, 0, MKAP(VOID));
  2721+        p = block(NAME, NIL, NIL, FTN+VOID, 0, 0);
27322722         p->n_sp = lookup(stack_chk_fail, SNORMAL);
 27332723         defid(p, EXTERN);
 27342724         nfree(p);
 27352725 
<>2736 -        p = block(NAME, NIL, NIL, INT, 0, MKAP(INT));
  2726+        p = block(NAME, NIL, NIL, INT, 0, 0);
27372727         p->n_sp = lookup(stack_chk_guard, SNORMAL);
 27382728         defid(p, EXTERN);
 27392729         nfree(p);
     
 !
27442734 {
 27452735         NODE *p, *q;
 27462736 
<>2747 -        q = block(NAME, NIL, NIL, INT, 0, MKAP(INT));
  2737+        q = block(NAME, NIL, NIL, INT, 0, 0);
27482738         q->n_sp = lookup(stack_chk_guard, SNORMAL);
 27492739         q = clocal(q);
 27502740 
 27512741         p = block(REG, NIL, NIL, INT, 0, 0);
 27522742         p->n_lval = 0;
 27532743         p->n_rval = FPREG;
<>2754 -        q = block(ER, p, q, INT, 0, MKAP(INT));
  2744+        q = block(ER, p, q, INT, 0, 0);
27552745         q = clocal(q);
 27562746 
<>2757 -        p = block(NAME, NIL, NIL, INT, 0, MKAP(INT));
  2747+        p = block(NAME, NIL, NIL, INT, 0, 0);
27582748         p->n_qual = VOL >> TSHIFT;
 27592749         p->n_sp = lookup(stack_chk_canary, SNORMAL);
 27602750         defid(p, AUTO);
     
 !
27782768         if (t == BOOL)
 27792769                 t = BOOL_TYPE;
 27802770 
<>2781 -        p = block(NAME, NIL, NIL, INT, 0, MKAP(INT));
  2771+        p = block(NAME, NIL, NIL, INT, 0, 0);
27822772         p->n_sp = lookup(stack_chk_canary, SNORMAL);
 27832773         p = clocal(p);
 27842774 
 27852775         q = block(REG, NIL, NIL, INT, 0, 0);
 27862776         q->n_lval = 0;
 27872777         q->n_rval = FPREG;
<>2788 -        q = block(ER, p, q, INT, 0, MKAP(INT));
  2778+        q = block(ER, p, q, INT, 0, 0);
27892779 
<>2790 -        p = block(NAME, NIL, NIL, INT, 0, MKAP(INT));
  2780+        p = block(NAME, NIL, NIL, INT, 0, 0);
27912781         p->n_sp = lookup(stack_chk_guard, SNORMAL);
 27922782         p = clocal(p);
 27932783 
 27942784         lab = getlab();
 27952785         cbranch(buildtree(EQ, p, q), bcon(lab));
 27962786 
<>2797 -        p = block(NAME, NIL, NIL, FTN+VOID, 0, MKAP(VOID));
  2787+        p = block(NAME, NIL, NIL, FTN+VOID, 0, 0);
27982788         p->n_sp = lookup(stack_chk_fail, SNORMAL);
 27992789         p = clocal(p);
 28002790 
     
 !
29192909         ddebug = 0;
 29202910         real = addname("__real");
 29212911         imag = addname("__imag");
<>2922 -        p = block(NAME, NIL, NIL, FLOAT, 0, MKAP(FLOAT));
  2912+        p = block(NAME, NIL, NIL, FLOAT, 0, 0);
29232913         for (i = 0; i < 3; i++) {
 29242914                 p->n_type = FLOAT+i;
<>2925 -                p->n_ap = MKAP(FLOAT+i);
<_29262915                 rpole = rp = bstruct(NULL, STNAME, NULL);
 29272916                 soumemb(p, real, 0);
 29282917                 soumemb(p, imag, 0);
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-18 18:25 +0100