Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.148
 
1.149
 
MAIN:ragge:20050905170716
 
reader.c
_>302302 #ifdef PCC_DEBUG
 303303         walkf(p, cktree);
 304304         if (e2debug) {
<>305 -                fprintf(stderr, "Entering pass2\n");
  305+                printf("Entering pass2\n");
306306                 fwalk(p, e2print, 0);
 307307         }
 308308 #endif
 309309         ip->ip_node = p;
 310310         compile4(ip);
 311311 }
 312312 
<> 313+#ifdef OLDSTYLE
313314 void
 314315 compile4(struct interpass *ip)
 315316 {
     
 !
318319 
 319320         emit(ip);
 320321 }
<> 322+#else
321323 
<> 324+static struct interpass ipole;
  325+/*
  326+ * Save a complete function before doing anything with it in both the
  327+ * optimized and unoptimized case.
  328+ */
322329 void
<> 330+compile4(struct interpass *ip)
  331+{
  332+        struct interpass_prolog *epp;
  333+
  334+        if (ip->type == IP_PROLOG)
  335+                DLIST_INIT(&ipole, qelem);
  336+
  337+        DLIST_INSERT_BEFORE(&ipole, ip, qelem);
  338+
  339+        if (ip->type != IP_EPILOG)
  340+                return;
  341+
  342+#ifdef PCC_DEBUG
  343+        if (e2debug)
  344+                printip(&ipole);
  345+#endif
  346+        epp = (struct interpass_prolog *)DLIST_PREV(&ipole, qelem);
  347+        p2maxautooff = p2autooff = epp->ipp_autos;
  348+
  349+        optimize(&ipole);
  350+        ngenregs(&ipole);
  351+
  352+        DLIST_FOREACH(ip, &ipole, qelem)
  353+                emit(ip);
  354+}
  355+#endif
  356+
  357+void
323358 emit(struct interpass *ip)
 324359 {
 325360         NODE *p;
<>326 -        int o, savautooff;
  361+        int o;
327362 
 328363         switch (ip->type) {
 329364         case IP_NODE:
 330365                 p = ip->ip_node;
 331366 
<> 367+#ifdef OLDSTYLE
332368                 if (xsaveip == 0) {
<>333 -                        savautooff = p2autooff;
  369+                        int savautooff = p2autooff;
334370 if (xnewreg == 0) {
 335371                         do {
 336372                                 geninsn(p, FOREFF);
     
 !
349385 }
 350386                         p2autooff = savautooff;
 351387                 }
<> 388+#endif
352389 
<> 390+                nodepole = p;
353391                 switch (p->n_op) {
 354392                 case CBRANCH:
 355393                         /* Only emit branch insn if RESCC */
     
 !
378416                 tmpsave = NULL/* Always forget old nodes */
 379417                 p2maxautooff = p2autooff = AUTOINIT;
 380418                 break;
<> 419+#ifdef OLDSTYLE
381420         case IP_STKOFF:
 382421                 if (xsaveip == 0) {
 383422                         p2autooff = ip->ip_off;
 384423                         if (p2autooff > p2maxautooff)
 385424                                 p2maxautooff = p2autooff;
 386425                 }
 387426                 break;
<> 427+#endif
388428         case IP_DEFLAB:
 389429                 deflab(ip->ip_lbl);
 390430                 break;
 391431         case IP_ASM:
 392432                 printf("\t%s\n", ip->ip_asm);
 393433                 break;
<> 434+#ifdef OLDSTYLE
394435         case IPSTK:
 395436                 break;
<> 437+#endif
396438         default:
 397439                 cerror("compile4 %d", ip->type);
 398440         }
     
 !
702744         r = mklnode(OREG, s, FPREG, p->n_type);
 703745         ip = ipnode(mkbinode(ASSIGN, q, p, p->n_type));
 704746 
<> 747+#ifdef OLDSTYLE
705748         if (xsaveip || xnewreg)
 706749                 storesave = ip;
 707750         else
 708751                 emit(ip);
<> 752+#else
  753+        storesave = ip;
  754+#endif
709755         return r;
 710756 }
 711757 
     
 !
769815         if (p->n_su == -1) /* For OREGs and similar */
 770816                 return gencode(p->n_left, cookie);
 771817 
<> 818+#ifdef OLDSTYLE
772819         if (xnewreg) {
 773820                 if (p->n_op == REG && p->n_rall == p->n_rval)
 774821                         return; /* pointless move to itself */
     
 !
779826                         return; /* pointless assign */
 780827                 }
 781828         }
<> 829+#else
  830+        if (p->n_op == REG && p->n_rall == p->n_rval)
  831+                return; /* meaningless move to itself */
  832+        if (p->n_op == ASSIGN && p->n_left->n_op == REG &&
  833+            p->n_left->n_rval == p->n_rall &&
  834+            p->n_right->n_rall == p->n_rall) {
  835+                gencode(p->n_right, INTAREG|INTBREG);
  836+                return; /* meaningless assign */
  837+        }
  838+#endif
782839 
 783840         if (p->n_su & DORIGHT) {
 784841                 gencode(p->n_right, INTAREG|INTBREG);
     
 !
796853                         canon(p);
 797854         }
 798855 #define F(x) (ffs(x)-1)
<> 856+#ifdef OLDSTYLE
799857         if (xnewreg && (p->n_su & RMASK) == RREG) {
<> 858+#else
  859+        if ((p->n_su & RMASK) == RREG) {
  860+#endif
800861                 if (q->needs & NSPECIAL) {
 801862                         int left, right, res, mask;
 802863 
     
 !
813874                         p->n_right->n_rval = p->n_rall;
 814875                 }
 815876         }
<> 877+#ifdef OLDSTYLE
816878         if (xnewreg && (p->n_su & LMASK) == LREG) {
<> 879+#else
  880+        if ((p->n_su & LMASK) == LREG) {
  881+#endif
817882                 if (q->needs & NSPECIAL) {
 818883                         int left, right, res, mask;
 819884 
     
 !
832897         }
 833898 
 834899         expand(p, cookie, q->cstring);
<> 900+#ifdef OLDSTYLE
835901         if (xnewreg) {
 836902                 if (callop(p->n_op) && p->n_rall != RETREG)
 837903                         rmove(RETREG, p->n_rall, p->n_type);
     
 !
842908                                 rmove(ffs(res)-1, p->n_rall, p->n_type);
 843909                 }
 844910         }
<> 911+#else
  912+        if (callop(p->n_op) && p->n_rall != RETREG)
  913+                rmove(RETREG, p->n_rall, p->n_type);
  914+        else if (q->needs & NSPECIAL) {
  915+                int left, right, res, mask;
  916+                nspecial(q, &left, &right, &res, &mask);
  917+                if (p->n_rall != ffs(res)-1)
  918+                        rmove(ffs(res)-1, p->n_rall, p->n_type);
  919+        }
  920+#endif
845921         rewrite(p, q->rewrite);
 846922 }
 847923 
 848924 int negrel[] = { NE, EQ, GT, GE, LT, LE, UGT, UGE, ULT, ULE } ;  /* negatives of relationals */
 849925 
<>850 -void
 851 -rcount()
 852 -{ /* count recursions */
 853 -        if( ++nrecur > NRECUR ){
 854 -                cerror( "expression causes compiler loop: try simplifying" );
 855 -        }
 856 -}
 857 -
858926 #ifdef PCC_DEBUG
 859927 #undef  PRTABLE
 860928 int
     
 !
9751043 }
 9761044 #endif
 9771045 
<> 1046+#if 0
9781047 /*
 9791048  * change left TEMPs into OREGs
 9801049  */
     
 !
10101079                 p->n_right = mklnode(ICON, l->n_lval, 0, INT);
 10111080         }
 10121081 }
<> 1082+#endif
10131083 
 10141084 /*
 10151085  * for pointer/integer arithmetic, set pointer at left node
     
 !
10901160                         p->n_rval = r;
 10911161                         p->n_lval = temp;
 10921162                         p->n_name = cp;
<> 1163+                        p->n_su = 0; /* To stop gencode traversal */
10931164                         tfree(q);
 10941165                         return;
 10951166                 }
     
 !
11001171 canon(p) NODE *p; {
 11011172         /* put p in canonical form */
 11021173 
<> 1174+#ifdef OLDSTYLE
11031175         if (xsaveip == 0)
 11041176                 walkf(p, deltemp);
<> 1177+#else
  1178+//      if (xssaflag == 0)
  1179+//              walkf(p, deltemp);
  1180+#endif
11051181         walkf(p, setleft);      /* ptrs at left node for arithmetic */
 11061182         walkf(p, oreg2);        /* look for and create OREG nodes */
 11071183 #ifndef FIELDOPS
     
 !
11661242                 if (q->needs & REWRITE)
 11671243                         break;  /* Done here */
 11681244 
<> 1245+#ifdef OLDSTYLE
11691246                 if (xnewreg == 0) {
 11701247                         tl = istnode(p->n_left);
 11711248                         tr = istnode(p->n_right);
 11721249                 } else
 11731250                         tl = tr = 0;
<> 1251+#else
  1252+                tl = tr = 0/* XXX remove later */
  1253+#endif
11741254                 is3 = ((q->rewrite & (RLEFT|RRIGHT)) == 0);
 11751255 
 11761256                 if (shl == SRDIR && shr== SRDIR ) {
     
 !
12031283                          * a temporary register, and the current op matches,
 12041284                          * be happy.
 12051285                          */
<> 1286+#ifdef OLDSTYLE
12061287                         if ((q->rewrite & RRIGHT) && (istnode(r) && !xnewreg)) {
 12071288                                 /* put left in temp, add to right */
 12081289                                 if (4 < mtchno) {
 12091290                                         mtchno = 4;
 12101291                                         rv = MKIDX(ixp[i], shltab[shl]);
 12111292                                 }
<>1212 -                        } else if (q->rewrite & RLEFT) {
  1293+                        } else
  1294+#endif
  1295+                        if (q->rewrite & RLEFT) {
12131296                                 if (4 < mtchno) {
 12141297                                         mtchno = 4;
 12151298                                         rv = MKIDX(ixp[i], LREG);
     
 !
12301313                          * a temporary register, and the current op matches,
 12311314                          * be happy.
 12321315                          */
<> 1316+#ifdef OLDSTYLE
12331317                         if ((q->rewrite & RLEFT) && (istnode(l) && !xnewreg)) {
 12341318                                 /* put right in temp, add to left */
 12351319                                 if (4 < mtchno) {
 12361320                                         mtchno = 4;
 12371321                                         rv = MKIDX(ixp[i], shrtab[shr]);
 12381322                                 }
<>1239 -                        } else if (q->rewrite & RRIGHT) {
  1323+                        } else
  1324+#endif
  1325+                        if (q->rewrite & RRIGHT) {
<_12401326                                 if (4 < mtchno) {
 12411327                                         mtchno = 4;
 12421328                                         rv = MKIDX(ixp[i], RREG);
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-16 06:56 +0200