Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.15
 
1.16
 
MAIN:ragge:20140603201950
 
local.c
_>3434 {
 3535         struct symtab *q;
 3636         NODE *r, *l;
<> 37+        TWORD t;
3738         int o;
 3839 
<> 40+#ifdef PCC_DEBUG
  41+        if (xdebug) {
  42+                printf("clocal\n");
  43+                fwalk(p, eprint, 0);
  44+        }
  45+#endif
  46+
3947         switch( o = p->n_op ){
 4048         case NAME:
 4149                 /* handle variables */
 4250                 if ((q = p->n_sp) == NULL)
 4351                         return p; /* Nothing to care about */
 4452                 switch (q->sclass) {
<> 53+                case PARAM:
4554                 case AUTO:
<>46 -                        /* fake up a structure reference */
 47 -                        r = block(REG, NIL, NIL, PTR+STRTY, 0, 0);
 48 -                        r->n_lval = 0;
 49 -                        r->n_rval = FPREG;
 50 -                        p = stref(block(STREF, r, p, 0, 0, 0));
  55+                        if (0 && q->soffset < MAXZP * SZINT &&
  56+                            q->sclass != PARAM) {
  57+                                p->n_lval = -(q->soffset/SZCHAR) + ZPOFF*2;
  58+                                p->n_sp = NULL;
  59+                        } else {
  60+                                /* fake up a structure reference */
  61+                                r = block(REG, NIL, NIL, PTR+STRTY, 0, 0);
  62+                                r->n_lval = 0;
  63+                                r->n_rval = FPREG;
  64+                                p = stref(block(STREF, r, p, 0, 0, 0));
  65+                        }
5166                         break;
 5267                 default:
 5368                         break;
     
 !
5873         case PVCONV:
 5974                 if( p->n_right->n_op != ICON ) cerror( "bad conversion", 0);
 6075                 nfree(p);
<>61 -                return(buildtree(o==PMCONV?MUL:DIV, p->n_left, p->n_right));
  76+                p = (buildtree(o==PMCONV?MUL:DIV, p->n_left, p->n_right));
  77+                break;
6278 
 6379         case PCONV:
<> 80+                t = p->n_type;
  81+                if (t == INCREF(CHAR) || t == INCREF(UCHAR) ||
  82+                    t == INCREF(BOOL) || t == INCREF(VOID))
  83+                        break;
6484                 l = p->n_left;
<> 85+                t = l->n_type;
  86+                if (t == INCREF(CHAR) || t == INCREF(UCHAR) ||
  87+                    t == INCREF(BOOL) || t == INCREF(VOID))
  88+                        break;
  89+                if (p->n_type <= UCHAR || l->n_type <= UCHAR)
  90+                        break; /* must do runtime ptr conv */
6591                 /* if conversion to another pointer type, just remove */
 6692                 if (p->n_type > BTMASK && l->n_type > BTMASK)
 6793                         goto delp;
<> 94+                if (l->n_op == ICON && l->n_sp == NULL)
  95+                        goto delp;
6896                 break;
 6997 
 7098         delp:   l->n_type = p->n_type;
 7199                 l->n_qual = p->n_qual;
 72100                 l->n_df = p->n_df;
 73101                 l->n_ap = p->n_ap;
<>74 -                nfree(p);
 75 -                p = l;
  102+                p = nfree(p);
76103                 break;
 77104         }
 78105 
<> 106+#ifdef PCC_DEBUG
  107+        if (xdebug) {
  108+                printf("clocal end\n");
  109+                fwalk(p, eprint, 0);
  110+        }
  111+#endif
  112+
79113 #if 0
 80114         register struct symtab *q;
 81115         register NODE *r, *l;
     
 !
339373 myp2tree(NODE *p)
 340374 {
 341375         struct symtab *sp;
<> 376+        NODE *l, *r;
342377         int o = p->n_op;
 343378 
<>344 -        if (o != FCON)
 345 -                return;
  379+        switch (o) {
  380+        case NAME: /* reading from a name must be done with a subroutine */
  381+                if (p->n_type != CHAR && p->n_type != UCHAR)
  382+                        break;
  383+                l = buildtree(ADDROF, ccopy(p), NIL);
  384+                r = block(NAME, NIL, NIL, INT, 0, 0);
346385 
<>347 -        sp = inlalloc(sizeof(struct symtab));
 348 -        sp->sclass = STATIC;
 349 -        sp->sap = 0;
 350 -        sp->slevel = 1; /* fake numeric label */
 351 -        sp->soffset = getlab();
 352 -        sp->sflags = 0;
 353 -        sp->stype = p->n_type;
 354 -        sp->squal = (CON >> TSHIFT);
  386+                r->n_sp = lookup(addname("__nova_rbyte"), SNORMAL);
  387+                if (r->n_sp->sclass == SNULL) {
  388+                        r->n_sp->sclass = EXTERN;
  389+                        r->n_sp->stype = INCREF(p->n_type)+(FTN-PTR);
  390+                }
  391+                r->n_type = r->n_sp->stype;
  392+                r = clocal(r);
  393+                r = optim(buildtree(CALL, r, l));
  394+                *p = *r;
  395+                nfree(r);
  396+                break;
355397 
<>356 -        defloc(sp);
 357 -        ninval(0, tsize(sp->stype, sp->sdf, sp->sap), p);
  398+        case FCON:
  399+                sp = inlalloc(sizeof(struct symtab));
  400+                sp->sclass = STATIC;
  401+                sp->sap = 0;
  402+                sp->slevel = 1; /* fake numeric label */
  403+                sp->soffset = getlab();
  404+                sp->sflags = 0;
  405+                sp->stype = p->n_type;
  406+                sp->squal = (CON >> TSHIFT);
358407 
<>359 -        p->n_op = NAME;
 360 -        p->n_lval = 0;
 361 -        p->n_sp = sp;
  408+                defloc(sp);
  409+                ninval(0, tsize(sp->stype, sp->sdf, sp->sap), p);
362410 
<> 411+                p->n_op = NAME;
  412+                p->n_lval = 0;
  413+                p->n_sp = sp;
  414+        }
363415 }
 364416 
 365417 /*ARGSUSED*/
     
 !
397449                 printf("offcon: OFFSZ %ld type %x dim %p siz %ld\n",
 398450                     off, t, d, tsize(t, d, ap));
 399451 
<>400 -        p = bcon(0);
 401 -        p->n_lval = off/SZINT;  /* Default */
 402 -        if (ISPTR(DECREF(t)))
 403 -                return p;
 404 -        if (t == VOID || t == CHAR || t == UCHAR)
  452+        p = bcon(off/SZINT);
  453+        if (t == INCREF(CHAR) || t == INCREF(UCHAR) || t == INCREF(VOID))
405454                 p->n_lval = off/SZCHAR; /* pointer to char */
 406455         return(p);
 407456 }
     
 !
573622 
 574623 /*
 575624  * Called when a identifier has been declared, to give target last word.
<> 625+ * On Nova we put symbols over the size of an int above 24 bytes in
  626+ * offset and leave zeropage for small vars.
576627  */
 577628 void
 578629 fixdef(struct symtab *sp)
 579630 {
<> 631+#if 0
  632+        if (sp->sclass != AUTO)
  633+                return; /* not our business */
  634+        if (ISPTR(sp->stype) || sp->stype < LONG)
  635+                return;
  636+        if (sp->soffset >= (MAXZP * SZINT))
  637+                return; /* already above */
  638+        /* have to move */
  639+        /* XXX remember old autooff for reorg of smaller vars */
  640+        if (autooff < MAXZP * SZINT)
  641+                autooff = MAXZP * SZINT;
  642+        oalloc(sp, &autooff);
  643+#endif
<_580644 }
 581645 
 582646 void
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-10-31 12:29 +0100