Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.159
 
1.160
 
MAIN:ragge:20051208201038
 
reader.c
_>267267                 myreader(ip->ip_node); /* local massage of input */
 268268                 mkhardops(ip->ip_node);
 269269                 gencall(ip->ip_node, NIL);
<> 270+                if (xtemps == 0)
  271+                        walkf(ip->ip_node, deltemp);
270272                 compile2(ip);
 271273         } else
 272274                 compile4(ip);
     
 !
314316 {
 315317         struct interpass_prolog *epp;
 316318 
<>317 -        if (ip->type == IP_PROLOG)
  319+        if (ip->type == IP_PROLOG) {
  320+                tmpsave = NULL;
318321                 DLIST_INIT(&ipole, qelem);
<> 322+        }
319323 
 320324         DLIST_INSERT_BEFORE(&ipole, ip, qelem);
 321325 
     
 !
488492 
 489493         case INCR:
 490494         case DECR:
<>491 -                if ((rv = findops(p, cookie)) < 0) {
 492 -                        if (setbin(p))
 493 -                                goto again;
 494 -                } else {
 495 -                        /* Do tree rewriting to ensure correct incr */
 496 -                        if ((rv & LMASK) != LREG)
 497 -                                goto sw;
 498 -                }
  495+                rv = findops(p, cookie);
  496+                if (rv != FFAIL)
  497+                        break;
  498+
499499                 /*
 500500                  * Rewrite x++ to (x = x + 1) -1;
 501501                  */
     
 !
527527                 rv = findasg(p, cookie);
 528528                 break;
 529529 
<>530 -                /*
 531 -                 * Do subnodes conversions (if needed).
 532 -                 */
 533 -sw:             switch (rv & LMASK) {
 534 -                case LREG:
 535 -                        geninsn(p->n_left, INREGS);
 536 -                        break;
 537 -                case LOREG:
 538 -                        if (p->n_left->n_op == FLD) {
 539 -                                offstar(p->n_left->n_left->n_left, 0); /* XXX */
 540 -                                p->n_left->n_left->n_su = -1;
 541 -                        } else
 542 -                                offstar(p->n_left->n_left, 0);
 543 -                        p->n_left->n_su = -1;
 544 -                        break;
 545 -                case LTEMP:
 546 -                        geninsn(p->n_left, INTEMP);
 547 -                        break;
 548 -                }
 549 -
 550 -                switch (rv & RMASK) {
 551 -                case RREG:
 552 -                        geninsn(p->n_right, INREGS);
 553 -                        break;
 554 -                case ROREG:
 555 -                        offstar(p->n_right->n_left, 0);
 556 -                        p->n_right->n_su = -1;
 557 -                        break;
 558 -                case RTEMP:
 559 -                        geninsn(p->n_right, INTEMP);
 560 -                        break;
 561 -                }
 562 -                p->n_su = rv;
 563 -                break;
 564 -
565530         case REG:
 566531         case TEMP:
 567532         case NAME:
 568533         case ICON:
 569534         case OREG:
<>570 -#if 0
 571 -                if ((cookie & (INTAREG|INTBREG)) == 0)
 572 -                        comperr("geninsn OREG, node %p", p);
 573 -#endif
574535                 rv = findleaf(p, cookie);
 575536                 break;
 576537 
     
 !
585546                         p->n_su = -1;
 586547                         break;
 587548                 }
<>588 -#if 0
 589 -                if ((cookie & INTAREG) == 0)
 590 -                        comperr("bad umul!");
 591 -#endif
  549+
592550                 if (offstar(p->n_left, 0)) {
 593551                         p->n_op = OREG;
 594552                         if ((rv = findleaf(p, cookie)) < 0)
 595553                                 comperr("bad findleaf"); /* XXX */
 596554                         p->n_op = UMUL;
<>597 -                        p->n_su = rv | LOREG;
598555                         break;
 599556                 }
 600557                 /* FALLTHROUGH */
     
 !
628585         default:
 629586                 comperr("geninsn: bad op %d, node %p", o, p);
 630587         }
<>631 -        switch (o) {
 632 -        case REG:
 633 -        case TEMP:
 634 -        case NAME:
 635 -        case ICON:
 636 -        case OREG:
 637 -        case ASSIGN:
 638 -        case PLUS:
 639 -        case MINUS:
 640 -        case MUL:
 641 -        case DIV:
 642 -        case MOD:
 643 -        case AND:
 644 -        case OR:
 645 -        case ER:
 646 -        case LS:
 647 -        case RS:
 648 -        case COMPL:
 649 -        case UMINUS:
 650 -        case PCONV:
 651 -        case SCONV:
 652 -        case INIT:
 653 -        case GOTO:
 654 -        case FUNARG:
 655 -        case UCALL:
 656 -        case USTCALL:
 657 -                switch (rv) {
 658 -                case FRETRY:
 659 -                        goto again;
 660 -                case FFAIL:
 661 -                        goto failed;
 662 -                }
 663 -        }
  588+        if (rv == FFAIL)
  589+                comperr("Cannot generate code, node %p op %s", p,opst[p->n_op]);
  590+        if (rv == FRETRY)
  591+                goto again;
664592         return rv;
<>665 -
 666 -failed:
 667 -        comperr("Cannot generate code, node %p op %s", p, opst[p->n_op]);
 668 -        return 0; /* XXX gcc */
669593 }
 670594 
 671595 /*
     
 !
693617  * Rewrite node after instruction emit.
 694618  */
 695619 static void
<>696 -rewrite(NODE *p, int rewrite)
  620+rewrite(NODE *p, int rewrite, int cookie)
697621 {
 698622 //      struct optab *q = &table[TBLIDX(p->n_su)];
 699623         NODE *l, *r;
     
 !
709633         p->n_lval = 0;
 710634         p->n_name = "";
 711635 
<> 636+        if (cookie != FOREFF) {
712637         if (rewrite & RLEFT) {
 713638 #ifdef PCC_DEBUG
 714639                 if (l->n_op != REG)
     
 !
724649         } else if (rewrite & RESC1) {
 725650                 p->n_rval = p->n_reg;
 726651         } else if (rewrite & RESC2)
<>727 -#ifdef MULTICLASS
728652                 p->n_reg = p->n_rval = p->n_reg;
<>729 -#else
 730 -                p->n_rval = p->n_rall + szty(p->n_type);
 731 -#endif
732653         else if (rewrite & RESC3)
<>733 -#ifdef MULTICLASS
734654                 p->n_rval = 0; /* XXX */
<>735 -#else
 736 -                p->n_rval = p->n_rall + 2*szty(p->n_type);
 737 -#endif
738655         else if (p->n_su == DORIGHT)
<>739 -#ifdef MULTICLASS
740656                 p->n_reg = p->n_rval = l->n_rval; /* XXX special */
<>741 -#else
 742 -                p->n_rall = p->n_rval = l->n_rval; /* XXX special */
 743 -#endif
  657+        }
744658         if (optype(o) != LTYPE)
 745659                 tfree(l);
 746660         if (optype(o) == BITYPE)
     
 !
751665 gencode(NODE *p, int cookie)
 752666 {
 753667         struct optab *q = &table[TBLIDX(p->n_su)];
<> 668+        NODE *r;
754669 
 755670         if (p->n_su == -1) /* For OREGs and similar */
 756671                 return gencode(p->n_left, cookie);
     
 !
762677             (p->n_su & RMASK) &&
 763678             p->n_right->n_reg == p->n_reg) {
 764679                 gencode(p->n_right, INREGS);
<> 680+                r = p->n_right;
  681+                nfree(p->n_left);
  682+                *p = *r;
  683+                nfree(r);
765684                 return; /* meaningless assign */
 766685         }
 767686 
     
 !
824743                 if (rr >= 0 && p->n_reg != rr)
 825744                         rmove(rr, p->n_reg, TCLASS(p->n_su));
 826745         }
<>827 -        rewrite(p, q->rewrite);
  746+        rewrite(p, q->rewrite, cookie);
828747 }
 829748 
 830749 int negrel[] = { NE, EQ, GT, GE, LT, LE, UGT, UGE, ULT, ULE } ;  /* negatives of relationals */
     
 !
967886 }
 968887 #endif
 969888 
<>970 -#if 0
971889 /*
 972890  * change left TEMPs into OREGs
 973891  */
     
 !
1003921                 p->n_right = mklnode(ICON, l->n_lval, 0, INT);
 1004922         }
 1005923 }
<>1006 -#endif
1007924 
 1008925 /*
 1009926  * for pointer/integer arithmetic, set pointer at left node
     
 !
10951012 canon(p) NODE *p; {
 10961013         /* put p in canonical form */
 10971014 
<>1098 -//      if (xssaflag == 0)
 1099 -//              walkf(p, deltemp);
<_11001015         walkf(p, setleft);      /* ptrs at left node for arithmetic */
 11011016         walkf(p, oreg2);        /* look for and create OREG nodes */
 11021017 #ifndef FIELDOPS
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-23 03:59 +0100