Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.124
 
1.125
 
MAIN:ragge:20050403145852
 
reader.c
_>175175 }
 176176 #endif
 177177 
<>178 -#ifdef NEW_READER
179178 
<>180 -#else
181179 /* look for delayable ++ and -- operators */
 182180 void
 183181 delay(NODE *p)
 184182 {
<> 183+#ifdef NEW_READER
  184+        struct interpass *ip;
  185+        NODE *q;
  186+#endif
185187         int ty = optype(p->n_op);
 186188 
 187189         switch (p->n_op) {
     
 !
191193         case FORTCALL:
 192194         case UFORTCALL:
 193195         case CBRANCH:
<>194 -                /* for the moment, don7t delay past a conditional context, or
  196+                /* for the moment, don't delay past a conditional context, or
195197                  * inside of a call */
 196198                 return;
 197199 
     
 !
204206         case DECR:
 205207                 break;
 206208                 if( deltest( p ) ){
<> 209+#ifdef NEW_READER
  210+                        ip = ipnode(tcopy(p));
  211+                        DLIST_INSERT_BEFORE(&delayq, ip, qelem);
  212+                        q = p->n_left;
  213+                        nfree(p->n_right); /* zap constant */
  214+                        *p = *q;
  215+                        nfree(q);
  216+                        return;
  217+#else
207218                         if( deli < DELAYS ){
 208219                                 register NODE *q;
 209220                                 deltrees[deli++] = tcopy(p);
     
 !
213224                                 nfree(q);
 214225                                 return;
 215226                         }
<> 227+#endif
216228                 }
 217229 
 218230         }
     
 !
222234         if (ty != LTYPE)
 223235                 delay(p->n_left);
 224236 }
<>225 -#endif
226237 
 227238 /*
 228239  * Check if a node has side effects.
     
 !
344355 void
 345356 compile4(struct interpass *ip)
 346357 {
<>347 -        NODE *p;
 348 -        int o;
 349 -
350358         if (Oflag)
 351359                 return saveip(ip);
 352360 
<>353 -        /*
 354 -         * ends up here only if not optimizing.
 355 -         */
 356 -        switch (ip->type) {
 357 -        case IP_NODE:
 358 -                p = ip->ip_node;
 359 -                do {
 360 -                        geninsn(p, FOREFF); /* Assign instructions for tree */
 361 -                } while (sucomp(p) < 0);  /* Calculate tree evaluation order */
 362 -
 363 -                genregs(p); /* allocate registers for instructions */
 364 -                mygenregs(p);
 365 -
 366 -                switch (p->n_op) {
 367 -                case CBRANCH:
 368 -                        /* Only emit branch insn if RESCC */
 369 -                        if (table[TBLIDX(p->n_left->n_su)].rewrite & RESCC) {
 370 -                                o = p->n_left->n_op;
 371 -                                gencode(p, FORCC);
 372 -                                cbgen(o, p->n_right->n_lval);
 373 -                        } else
 374 -                                gencode(p, FORCC);
 375 -                        break;
 376 -                case FORCE:
 377 -                        gencode(p->n_left, INTAREG|INTBREG);
 378 -                        break;
 379 -                default:
 380 -                        if (p->n_op != REG || p->n_type != VOID) /* XXX */
 381 -                                gencode(p, FOREFF); /* Emit instructions */
 382 -                }
 383 -
 384 -                tfree(p);
 385 -                break;
 386 -        case IP_PROLOG:
 387 -                prologue((struct interpass_prolog *)ip);
 388 -                break;
 389 -        case IP_EPILOG:
 390 -                eoftn((struct interpass_prolog *)ip);
 391 -                tmpsave = NULL/* Always forget old nodes */
 392 -                p2maxautooff = p2autooff = AUTOINIT;
 393 -                break;
 394 -        case IP_STKOFF:
 395 -                p2autooff = ip->ip_off;
 396 -                if (p2autooff > p2maxautooff)
 397 -                        p2maxautooff = p2autooff;
 398 -                break;
 399 -        case IP_DEFLAB:
 400 -                deflab(ip->ip_lbl);
 401 -                break;
 402 -        case IP_ASM:
 403 -                printf("\t%s\n", ip->ip_asm);
 404 -                break;
 405 -        default:
 406 -                cerror("compile4 %d", ip->type);
 407 -        }
  361+        emit(ip);
408362 }
 409363 
 410364 void
<>411 -Ocompile(struct interpass *ibase)
  365+emit(struct interpass *ip)
412366 {
<>413 -#if 0
 414 -        struct interpass *ip;
415367         NODE *p;
<> 368+        int o, savautooff;
416369 
<>417 -        /* Loop over all trees, while generating instructions */
 418 -        DLIST_FOREACH(ip, ibase, qelem) {
 419 -                if (ip->type != IP_NODE)
 420 -                        continue;
 421 -
  370+        switch (ip->type) {
  371+        case IP_NODE:
422372                 p = ip->ip_node;
<>423 -                do {
 424 -                        geninsn(p, FOREFF); /* Assign instructions for tree */
 425 -                } while (sucomp(p) < 0);  /* Calculate tree evaluation order */
426373 
<>427 -                genregs(p); /* allocate registers for instructions */
 428 -                mygenregs(p);
 429 -        }
  374+                if (Oflag == 0) {
  375+                        savautooff = p2autooff;
  376+                        do {
  377+                                geninsn(p, FOREFF);
  378+                        } while (sucomp(p) < 0);
  379+                        p2autooff = savautooff;
430380 
<>431 -        /* Now also the stack max usage is complete, output insns */
 432 -        DLIST_FOREACH(ip, ibase, qelem) {
 433 -                
  381+                        genregs(p); /* allocate registers for instructions */
  382+                        mygenregs(p);
  383+                }
  384+
434385                 switch (p->n_op) {
 435386                 case CBRANCH:
 436387                         /* Only emit branch insn if RESCC */
     
 !
448399                         if (p->n_op != REG || p->n_type != VOID) /* XXX */
 449400                                 gencode(p, FOREFF); /* Emit instructions */
 450401                 }
<>451 -        }
452402 
<> 403+                tfree(p);
  404+                break;
453405         case IP_PROLOG:
 454406                 prologue((struct interpass_prolog *)ip);
 455407                 break;
     
 !
459411                 p2maxautooff = p2autooff = AUTOINIT;
 460412                 break;
 461413         case IP_STKOFF:
<>462 -                p2autooff = ip->ip_off;
 463 -                if (p2autooff > p2maxautooff)
 464 -                        p2maxautooff = p2autooff;
  414+                if (Oflag == 0) {
  415+                        p2autooff = ip->ip_off;
  416+                        if (p2autooff > p2maxautooff)
  417+                                p2maxautooff = p2autooff;
  418+                }
465419                 break;
 466420         case IP_DEFLAB:
 467421                 deflab(ip->ip_lbl);
     
 !
472426         default:
 473427                 cerror("compile4 %d", ip->type);
 474428         }
<>475 -#endif
476429 }
 477430 
 478431 #else
     
 !
596549 
 597550 #endif
 598551 
<> 552+#ifndef NEW_READER
599553 /*
 600554  * generate the code for p;
 601555  * store may call codgen recursively
     
 !
678632                         gencode(p, FOREFF); /* Emit instructions */
 679633         }
 680634 }
<> 635+#endif
681636 
 682637 #ifdef PCC_DEBUG
 683638 char *cnames[] = {
     
 !
988943         s->n_name = "";
 989944         s->n_left = q;
 990945         s->n_right = p;
<> 946+#ifdef NEW_READER
  947+        if (Oflag) {
  948+                extern struct interpass *storesave;
  949+                storesave = ipnode(s);
  950+        } else
  951+                emit(ipnode(s));
  952+#else
991953         codgen(s, FOREFF);
 992954         tfree(s);
<> 955+#endif
993956         return r;
 994957 }
 995958 
     
 !
13401303 canon(p) NODE *p; {
 13411304         /* put p in canonical form */
 13421305 
<>1343 -        walkf(p, deltemp);
  1306+//      walkf(p, deltemp);
<_13441307         walkf(p, setleft);      /* ptrs at left node for arithmetic */
 13451308         walkf(p, oreg2);        /* look for and create OREG nodes */
 13461309 #ifndef FIELDOPS
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-20 16:03 +0200