Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.75
 
1.76
 
MAIN:ragge:20100521073716
 
optim2.c
_>277277 listsetup(struct interpass *ipole, struct dlnod *dl)
 278278 {
 279279         struct interpass *ip = DLIST_NEXT(ipole, qelem);
<> 280+        struct interpass *nip;
280281         struct dlnod *p, *lastp;
 281282         NODE *q;
 282283 
     
 !
311312                                 p->op = CBR;
 312313                                 p->labno = q->n_right->n_lval;
 313314                                 break;
<> 315+                        case ASSIGN:
  316+                                /* remove ASSIGN to self for regs */
  317+                                if (q->n_left->n_op == REG &&
  318+                                    q->n_right->n_op == REG &&
  319+                                    regno(q->n_left) == regno(q->n_right)) {
  320+                                        nip = DLIST_PREV(ip, qelem);
  321+                                        tfree(q);
  322+                                        DLIST_REMOVE(ip, qelem);
  323+                                        ip = nip;
  324+                                        continue;
  325+                                }
  326+                                /* FALLTHROUGH */
314327                         default:
 315328                                 p->op = STMT;
 316329                                 break;
     
 !
368381         p->labno = labno;
 369382         if (p->op == JBR)
 370383                 p->dlip->ip_node->n_left->n_lval = labno;
<>371 -        else if (p->op == CBR)
  384+        else if (p->op == CBR) {
372385                 p->dlip->ip_node->n_right->n_lval = labno;
<>373 -        else
  386+                p->dlip->ip_node->n_left->n_label = labno;
  387+        } else
374388                 comperr("setlab bad op %d", p->op);
 375389 }
 376390 
     
 !
417431                 }
 418432         }
 419433         for (p = dl->forw; p!=0; p = p->forw)
<>420 -                if (p->op==LABEL && p->refc==0
 421 -                 && (lp = nonlab(p))->op)
  434+                if (p->op==LABEL && p->refc==0 && (lp = nonlab(p))->op)
422435                         decref(p);
 423436 }
 424437 
     
 !
739752         }
 740753 
 741754         if (b2debug) {
<> 755+                static void printip2(struct interpass *);
  756+                DLIST_FOREACH(bb, &p2e->bblocks, bbelem) {
  757+                        printf("bblock %d\n", bb->bbnum);
  758+                        for (ip = bb->first; ip != bb->last;
  759+                            ip = DLIST_NEXT(ip, qelem)) {
  760+                                printip2(ip);
  761+                        }
  762+                        printip2(ip);
  763+                }
  764+
742765                 printf("Label table:\n");
 743766                 for (i = 0; i < p2e->labinfo.size; i++)
 744767                         if (p2e->labinfo.arr[i])
     
 !
10831106                 /* Make sure we get the last statement in the bblock */
 10841107                 findTemps(ip);
 10851108         }
<>1086 -   
  1109+
10871110         /* For each variable */
 10881111         for (i = 0; i < defsites.size; i++) {
 10891112                 /* While W not empty */
     
 !
11171140                            
 11181141                                 if (phifound==0) {
 11191142                                         if (b2debug)
<>1120 -                                            printf("Phi in %d (%p) for %d\n",y->dfnum,y,i+defsites.low);
  1143+                                            printf("Phi in %d(%d) (%p) for %d\n",
  1144+                                            y->dfnum,y->bbnum,y,i+defsites.low);
11211145 
 11221146                                         phi = tmpcalloc(sizeof(struct phiinfo));
 11231147                            
     
 !
12041228         struct cfgnode *cfgn2;
 12051229         int tmpregno,newtmpregno;
 12061230         struct phiinfo *phi;
<>1207 -        
  1231+
12081232         SLIST_INIT(&poplist);
<>1209 -        
  1233+
12101234         SLIST_FOREACH(phi,&bb->phi,phielem) {
 12111235                 tmpregno=phi->tmpregno-defsites.low;
 12121236                 
 12131237                 newtmpregno=p2e->epp->ip_tmpnum++;
 12141238                 phi->newtmpregno=newtmpregno;
<>1215 -                
  1239+
12161240                 stacke=tmpcalloc(sizeof (struct varstack));
 12171241                 stacke->tmpregno=newtmpregno;
 12181242                 SLIST_INSERT_FIRST(&defsites.stack[tmpregno],stacke,varstackelem);
     
 !
12211245                 stacke->tmpregno=tmpregno;
 12221246                 SLIST_INSERT_FIRST(&poplist,stacke,varstackelem);               
 12231247         }
<>1224 -        
 1225 -        
  1248+
  1249+
12261250         ip=bb->first;
<>1227 -        
  1251+
12281252         while (1) {             
 12291253                 if ( ip->type == IP_NODE) {
 12301254                         renamevarhelper(p2e,ip->ip_node,&poplist);
 12311255                 }
<>1232 -                
  1256+
12331257                 if (ip==bb->last)
 12341258                         break;
<>1235 -                
  1259+
12361260                 ip = DLIST_NEXT(ip, qelem);
 12371261         }
<>1238 -        
  1262+
12391263         SLIST_FOREACH(cfgn,&bb->children,cfgelem) {
 12401264                 j=0;
<>1241 -                
  1265+
12421266                 SLIST_FOREACH(cfgn2, &cfgn->bblock->parents, cfgelem) {
 12431267                         if (cfgn2->bblock->dfnum==bb->dfnum)
 12441268                                 break;
     
 !
12511275                 }
 12521276                 
 12531277         }
<>1254 -        
  1278+
12551279         for (h = 1; h < p2e->bbinfo.size; h++) {
 12561280                 if (!TESTBIT(bb->dfchildren, h))
 12571281                         continue;
<>1258 -                
  1282+
12591283                 renamevar(p2e,p2e->bbinfo.arr[h]);
 12601284         }
<>1261 -        
  1285+
12621286         SLIST_FOREACH(stacke,&poplist,varstackelem) {
 12631287                 tmpregno=stacke->tmpregno;
 12641288                 
     
 !
12881312 
 12891313         int label=0;
 12901314         int newlabel;
<>1291 -        
  1315+
12921316         DLIST_FOREACH(bb, &p2e->bblocks, bbelem) {              
 12931317                 SLIST_FOREACH(phi,&bb->phi,phielem) {
 12941318                         /* Look at only one, notice break at end */
     
 !
13671391                                         ip = ipnode(mkunode(GOTO, mklnode(ICON, label, 0, INT), 0, INT));
 13681392                                         DLIST_INSERT_BEFORE((bb->first), ip, qelem);
 13691393                                         pip->ip_node->n_right->n_lval=newlabel;
<> 1394+                                        if (!logop(pip->ip_node->n_left->n_op))
  1395+                                                comperr("SSA not logop");
  1396+                                        pip->ip_node->n_left->n_label=newlabel;
13701397                                         break ;
 13711398                                   case pred_falltrough:
 13721399                                         if (bb->first->type == IP_DEFLAB) {
     
 !
14551482         }
 14561483 }
 14571484 
<>1458 -void
 1459 -printip(struct interpass *pole)
  1485+static void
  1486+printip2(struct interpass *ip)
14601487 {
 14611488         static char *foo[] = {
 14621489            0, "NODE", "PROLOG", "STKOFF", "EPILOG", "DEFLAB", "DEFNAM", "ASM" };
<>1463 -        struct interpass *ip;
14641490         struct interpass_prolog *ipplg, *epplg;
 14651491         unsigned i;
 14661492 
<>1467 -        DLIST_FOREACH(ip, pole, qelem) {
 1468 -                if (ip->type > MAXIP)
 1469 -                        printf("IP(%d) (%p): ", ip->type, ip);
 1470 -                else
 1471 -                        printf("%s (%p): ", foo[ip->type], ip);
 1472 -                switch (ip->type) {
 1473 -                case IP_NODE: printf("\n");
  1493+        if (ip->type > MAXIP)
  1494+                printf("IP(%d) (%p): ", ip->type, ip);
  1495+        else
  1496+                printf("%s (%p): ", foo[ip->type], ip);
  1497+        switch (ip->type) {
  1498+        case IP_NODE: printf("\n");
14741499 #ifdef PCC_DEBUG
<>1475 -                        fwalk(ip->ip_node, e2print, 0); break;
  1500+        fwalk(ip->ip_node, e2print, 0); break;
14761501 #endif
<>1477 -                case IP_PROLOG:
 1478 -                        ipplg = (struct interpass_prolog *)ip;
 1479 -                        printf("%s %s regs",
 1480 -                            ipplg->ipp_name, ipplg->ipp_vis ? "(local)" : "");
 1481 -                        for (i = 0; i < NIPPREGS; i++)
 1482 -                                printf("%s0x%lx", i? ":" : " ",
 1483 -                                    (long) ipplg->ipp_regs[i]);
 1484 -                        printf(" autos %d mintemp %d minlbl %d\n",
 1485 -                            ipplg->ipp_autos, ipplg->ip_tmpnum, ipplg->ip_lblnum);
 1486 -                        break;
 1487 -                case IP_EPILOG:
 1488 -                        epplg = (struct interpass_prolog *)ip;
 1489 -                        printf("%s %s regs",
 1490 -                            epplg->ipp_name, epplg->ipp_vis ? "(local)" : "");
 1491 -                        for (i = 0; i < NIPPREGS; i++)
 1492 -                                printf("%s0x%lx", i? ":" : " ",
 1493 -                                    (long) epplg->ipp_regs[i]);
 1494 -                        printf(" autos %d mintemp %d minlbl %d\n",
 1495 -                            epplg->ipp_autos, epplg->ip_tmpnum, epplg->ip_lblnum);
 1496 -                        break;
 1497 -                case IP_DEFLAB: printf(LABFMT "\n", ip->ip_lbl); break;
 1498 -                case IP_DEFNAM: printf("\n"); break;
 1499 -                case IP_ASM: printf("%s\n", ip->ip_asm); break;
 1500 -                default:
 1501 -                        break;
 1502 -                }
  1502+        case IP_PROLOG:
  1503+                ipplg = (struct interpass_prolog *)ip;
  1504+                printf("%s %s regs",
  1505+                    ipplg->ipp_name, ipplg->ipp_vis ? "(local)" : "");
  1506+                for (i = 0; i < NIPPREGS; i++)
  1507+                        printf("%s0x%lx", i? ":" : " ",
  1508+                            (long) ipplg->ipp_regs[i]);
  1509+                printf(" autos %d mintemp %d minlbl %d\n",
  1510+                    ipplg->ipp_autos, ipplg->ip_tmpnum, ipplg->ip_lblnum);
  1511+                break;
  1512+        case IP_EPILOG:
  1513+                epplg = (struct interpass_prolog *)ip;
  1514+                printf("%s %s regs",
  1515+                    epplg->ipp_name, epplg->ipp_vis ? "(local)" : "");
  1516+                for (i = 0; i < NIPPREGS; i++)
  1517+                        printf("%s0x%lx", i? ":" : " ",
  1518+                            (long) epplg->ipp_regs[i]);
  1519+                printf(" autos %d mintemp %d minlbl %d\n",
  1520+                    epplg->ipp_autos, epplg->ip_tmpnum, epplg->ip_lblnum);
  1521+                break;
  1522+        case IP_DEFLAB: printf(LABFMT "\n", ip->ip_lbl); break;
  1523+        case IP_DEFNAM: printf("\n"); break;
  1524+        case IP_ASM: printf("%s\n", ip->ip_asm); break;
  1525+        default:
  1526+                break;
15031527         }
 15041528 }
 15051529 
<> 1530+void
  1531+printip(struct interpass *pole)
  1532+{
  1533+        struct interpass *ip;
  1534+
  1535+        DLIST_FOREACH(ip, pole, qelem)
  1536+                printip2(ip);
  1537+}
  1538+
<_15061539 #ifdef PCC_DEBUG
 15071540 void flownodeprint(NODE *p,FILE *flowdiagramfile);
 15081541 
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-21 02:05 +0200